Function that converts cardinal B-spline positions to knot weights.
tfg.math.interpolation.bspline.knot_weights( positions, num_knots, degree, cyclical, sparse_mode=False, name=None )
In the following, A1 to An are optional batch dimensions.
positions: A tensor with shape
[A1, .. An]. Positions must be between
[0, C - D)for non-cyclical and
[0, C)for cyclical splines, where
Cis the number of knots and
Dis the spline degree.
num_knots: A strictly positive
intdescribing the number of knots in the spline.
intdescribing the degree of the spline, which must be smaller than
booldescribing whether the spline is cyclical.
booldescribing whether to return a result only for the knots with nonzero weights. If set to True, the function returns the weights of only the
degree+ 1 knots that are non-zero, as well as the indices of the knots.
name: A name for this op. Defaults to "bsplines_knot_weights".
A tensor with dense weights for each control point, with the shape
[A1, ... An, C] if
sparse_mode is False.
Otherwise, returns a tensor of shape
[A1, ... An, D + 1] that contains the
non-zero weights, and a tensor with the indices of the knots, with the type
ValueError: If degree is greater than 4 or num_knots - 1, or less than 0.
InvalidArgumentError: If positions are not in the right range.