Custom layer with B-splines approximation and backpropagation

Hello, I am currently trying to implement a MLP with a custom layer.
This custom layer takes as input a sequence of 2d points p and a parameterization t for these points
and approximates the sequence of points p using B-Splines functions. The loss is then calculated as the
distance between the sequence of points p and the approximation calculated by this approach.

Checking Scipy’s documentation I found

https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.BSpline.html#scipy.interpolate.BSpline

which allows you to represent a B-spline and

https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.make_lsq_spline.html

usable to approximate a sequence of points provided with parameterization using B-splines.

So I was wondering in what way I could implement this layer in PyTorch in order to correctly perform
backpropagation. It is possible to somehow reuse the methods in the links above that use Numpy arrays
or is it necessary to implement these operations using PyTorch Tensors?

1 Like

did you ever find a solution to this

Hello,

I know there is The spline-based convolutional operator.
Related to the paper “SplineCNN: Fast Geometric Deep Learning with Continuous B-Spline Kernels”
I hope it works for you.