patrick-kidger / torchcubicspline

Interpolating natural cubic splines. Includes batching, GPU support, support for missing values, evaluating derivatives of the spline, and backpropagation.
Apache License 2.0
198 stars 18 forks source link

Evaluating Each Spline at Unique Time Values in the Output Tensor #16

Closed andidietsche closed 8 months ago

andidietsche commented 8 months ago

I Patrick, Great repo, I have a short question regarding the evaluation function. It returns the dim (batch, batch, time, time, and channel) Is it possible to evaluate a different t for each spline and return that? Let's say I have 3 splines, and I want to assess each at a different t-value. At the moment, I always get an out-tensor where each spline gets evaluated with each t-value. However, I would like to have the first spline evaluated at the first t-value, and so on.

Thank you

patrick-kidger commented 8 months ago

Unfortunately not. If you're free to use JAX instead, and are happy with a slightly different kind of cubic spline (backward Hermite), then this functionality is available in diffrax.backward_hermite_coefficients. That's the best I can offer I'm afraid!

andidietsche commented 8 months ago

Thank you. I will have a look at Diffrax.