poplar.utilities
General utility functions.
Functions
|
One-dimensional linear interpolation for monotonically increasing sample |
Module Contents
- poplar.utilities.interpolate(x: torch.Tensor, xp: torch.Tensor, fp: torch.Tensor) torch.Tensor
One-dimensional linear interpolation for monotonically increasing sample points.
Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points \((xp, fp)\), evaluated at \(x\).
From https://github.com/pytorch/pytorch/issues/50334#issuecomment-1247611276.
- Parameters:
- xtorch.Tensor
the \(x\)-coordinates at which to evaluate the interpolated values.
- xptorch.Tensor
the \(x\)-coordinates of the data points, must be increasing.
- fptorch.Tensor
the \(y\)-coordinates of the data points, same length as xp.
- Returns:
- torch.Tensor
the interpolated values, same size as x