tensor_utils¶
Top-level package imports for clean user-facing APIs.
- tensor_utils.add_past_windows(A, lb, strict_lookback, axis=0)[source]¶
Build a rolling window of past values along one axis of a tensor.
- Parameters:
A (ndarray) – An n-dimensional tensor.
lb (int) – The rolling window size.
strict_lookback (bool) – If True, exclude the value at timestamp T from the rolling window constructed for time T.
axis (int) – The axis along which to compute the rolling window.
- Returns:
An (n+1)-dimensional tensor, A_dimsxW, with the last dimension being the window’s dimension.
- Return type:
- tensor_utils.add_future_windows(A, lb, strict_lookahead, axis=0)[source]¶
Build a rolling window of future values along one axis of a tensor.
- Parameters:
A (ndarray) – a n-dimensional tensor.
lb (int) – the rolling windows size.
strict_lookahead (bool) – If True, exclude the value at timestamp T from the rolling window constructed for time T.
axis (int) – the axis along which to compute the rolling window.
- Returns:
An (n+1)-dimensional tensor, A_dimsxW, with the last dimension being the window’s dimension.
- Return type: