tfg.math.interpolation.bspline.knot_weights

Function that converts cardinal B-spline positions to knot weights.

Note:

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 C is the number of knots and D is the spline degree.
num_knots A strictly positive int describing the number of knots in the spline.
degree An int describing the degree of the spline, which must be smaller than num_knots.
cyclical A bool describing whether the spline is cyclical.
sparse_mode A bool describing 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 "bspline_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 tf.int32.

ValueError If degree is greater than 4 or num_knots - 1, or less than 0.
InvalidArgumentError If positions are not in the right range.