aesara.tensor.diff

Contents

aesara.tensor.diff#

aesara.tensor.diff(x, n=1, axis=-1)[source]#

Calculate the n-th order discrete difference along the given axis.

The first order difference is given by out[i] = a[i + 1] - a[i] along the given axis, higher order differences are calculated by using diff recursively. This is heavily inspired by numpy.diff.

Parameters:
  • x – Input tensor variable.

  • n – The number of times values are differenced, default is 1.

  • axis – The axis along which the difference is taken, default is the last axis.

New in version 0.6.