SR2IntermediateDiff

Source: models/common/IntermediateDiff.py

Finite difference along an intermediate dimension.

Mirrors C++ IntermediateDiff<SR2>: apply the n-th order finite difference along the selected sub-batch axis. The selected axis length shrinks by n; sub_batch_ndim is preserved (this is a per-axis differencing operator, not a reduction).

The reduces HIT parameter names the sub-batch label of the differencing axis – the chain rule on that label is structurally non-diagonal (each output site depends on several input sites along the label).

Inputs

frominput · SR2 · required

Variable to reduce

Outputs

tooutput · SR2 · required

The reduced variable

Other options

dimint · required

Intermediate dimension to take the finite difference

nint · default 1

Order of the differentiation

reducesstr · required

Sub-batch label of the differencing axis.