pysiglib.sig_join_backprop

pysiglib.sig_join_backprop#

Added in version v3.0.0.

Warning

Where possible, pysiglib.torch_api should be used rather than explicitly calling backpropagation functions. Explicit backpropagation can introduce subtle errors if called incorrectly. In addition, some pysiglib functions can only be backpropagated through using their pysiglib.torch_api variants and do not expose explicit backpropagation functions.

sig_join_backprop(d_out, sig, displacement, dimension, degree, *, prepend=False, n_jobs=1)[source]#

This function is required to backpropagate through pysiglib.sig_join. Given the derivatives of a scalar function \(F\) with respect to the result of pysiglib.sig_join, \(\partial F / \partial S(x * v)\), returns the derivatives of \(F\) with respect to the original signature and the displacement vector, \(\partial F / \partial S(x)\) and \(\partial F / \partial v\).

Parameters:
  • d_out (numpy.ndarray | torch.tensor) – Derivative with respect to the output of sig_join, \(\partial F / \partial S(x * v)\)

  • sig (numpy.ndarray | torch.tensor) – The original truncated signature, \(S(x)\)

  • displacement (numpy.ndarray | torch.tensor) – The displacement vector, \(v\)

  • dimension (int) – Dimension of the underlying space, \(d\).

  • degree (int) – Truncation level of the signatures, \(N\)

  • prepend (bool) – Must match the value used in the forward sig_join call. If True, the linear segment was prepended to the front of the path rather than appended. Default is False.

  • n_jobs (int) – Number of threads to run in parallel. If n_jobs = 1, the computation is run serially. If set to -1, all available threads are used. For n_jobs below -1, (max_threads + 1 + n_jobs) threads are used. For example if n_jobs = -2, all threads but one are used.

Returns:

Derivatives with respect to sig and displacement

Return type:

Tuple[numpy.ndarray | torch.tensor, numpy.ndarray | torch.tensor]

Example:#

import numpy as np
import pysiglib

dimension, degree = 5, 3
path = np.random.uniform(size=(100, dimension))
sig = pysiglib.sig(path, degree)
displacement = np.random.uniform(size=(dimension,))

extended = pysiglib.sig_join(sig, displacement, dimension, degree)
d_out = np.ones_like(extended)

d_sig, d_displacement = pysiglib.sig_join_backprop(
    d_out, sig, displacement, dimension, degree
)
print(d_sig.shape, d_displacement.shape)

Citation#

If you found this library useful in your research, please consider citing the paper:

@article{shmelev2025pysiglib,
  title={pySigLib-Fast Signature-Based Computations on CPU and GPU},
  author={Shmelev, Daniil and Salvi, Cristopher},
  journal={arXiv preprint arXiv:2509.10613},
  year={2025}
}