torch.gradient
torch.gradient(input, *, spacing=1, dim=None, edge_order=1) -> List of Tensors
Estimates the gradient of a function g : \mathbb{R}^n \rightarrow
   \mathbb{R} in one or more dimensions using the second-order
   accurate central differences method.
The gradient of g is estimated using samples. By default, when
   "spacing" is not specified, the samples are entirely described by
   "input", and the mapping of input coordinates to an output is the
   same as the tensor's mapping of indices to values. For example, for
   a three-dimensional "input" the function described is g :
   \mathbb{R}^3 \rightarrow \mathbb{R}, and g(1, 2, 3)\ == input[1, 2,
   3].
When "spacing" is specified, it modifies the relationship between
   "input" and input coordinates. This is detailed in the "Keyword
   Arguments" section below.
The gradient is estimated by estimating each partial derivative of
   g independently. This estimation is accurate if g is in C^3 (it has