Spline#

class Spline(order=4, knots=None, control_points=None)[source]#

Bases: Module

Spline model.

Parameters:
  • order (int) – the order of the spline.

  • knots (torch.Tensor) – the knot vector.

  • control_points (torch.Tensor) – the control points.

basis(x, k, i, t)[source]#

Recursive function to compute the basis functions of the spline.

Parameters:
Returns:

the basis functions evaluated at x

Return type:

torch.Tensor

forward(x)[source]#

Forward pass of the spline model.

Parameters:

x (torch.Tensor) – points to be evaluated.

Returns:

the spline evaluated at x

Return type:

torch.Tensor