pysiglib.sig_backprop

pysiglib.sig_backprop#

Added in version v0.2.

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_backprop(path, sig, sig_derivs, degree, time_aug=False, lead_lag=False, end_time=1.0, n_jobs=1)[source]#

This function is required to backpropagate through the signature computation. Given the derivatives of a scalar function \(F\) with respect to the signature, \(\partial F / \partial S(x)\), returns the derivatives of \(F\) with respect to the underlying path, \(\partial F / \partial x\).

Parameters:
  • path (numpy.ndarray | torch.tensor) – The underlying path or batch of paths, given as a numpy.ndarray or torch.tensor. For a single path, this must be of shape (length, dimension). For a batch of paths, this must be of shape (batch_size, length, dimension).

  • sig (numpy.ndarray | torch.tensor) – Signature(s) of the path or batch of paths.

  • sig_derivs (numpy.ndarray | torch.tensor) – Derivatives of the scalar function \(F\) with respect to the signature(s), \(\partial F / \partial S(x)\). This must be an array of the same shape as the provided signature(s).

  • degree (int) – The truncation level of the signature, \(N\).

  • time_aug (bool) – If set to True, will compute the signature of the time-augmented path, \(\hat{x}_t := (t, x_t)\), defined as the original path with an extra channel set to time, \(t\). This channel spans \([0, t_L]\), where \(t_L\) is given by the parameter end_time.

  • lead_lag (bool) – If set to True, will compute the signature of the path after applying the lead-lag transformation.

  • end_time (float) – End time for time-augmentation, \(t_L\).

Returns:

Derivatives of the scalar function \(F\) with respect to the path(s), \(\partial F / \partial x\). This is an array of the same shape as the provided path(s).

Return type:

numpy.ndarray | torch.tensor


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}
}