Shortcuts

Resample

class torchtime.transforms.Resample(sz: Optional[int], scale_factor: Optional[float], mode: str = 'linear')[source]

Down/up samples the given time series to either the given size or by the given scale_factor.

The algorithm used for interpolation is determined by mode.

The input dimensions are interpreted in the form: mini-batch x channels x width.

The modes available for resizing are: linear, bilinear, area, nearest-exact.

Parameters:
  • sz (int) – output temporal size.

  • scale_factor (float) – multiplier for temporal size.

  • mode (str) – algorithm used for upsampling: 'linear' | 'bilinear' | 'nearest-exact'. Default: 'linear'

forward(ts: Tensor) Tensor[source]
Parameters:

ts (Tensor) – Tensor time series to resample.

Returns:

Resampled time series.

Return type:

Tensor