tfp.substrates.numpy.math.trapz

Integrate y(x) on the specified axis using the trapezoidal rule.

Computes ∫ y(x) dx ≈ Σ [0.5 (yk + y{k+1}) * (x_{k+1} - x_k)]

y Float Tensor of values to integrate.
x Optional, Float Tensor of points corresponding to the y values. The shape of x should match that of y. If x is None, the sample points are assumed to be evenly spaced dx apart.
dx Scalar float Tensor. The spacing between sample points when x is None. If neither x nor dx is provided then the default is dx = 1.
axis Scalar integer Tensor. The axis along which to integrate.
name Python str name prefixed to ops created by this function. Default value: None, uses name='trapz'.

Float Tensor integral approximated by trapezoidal rule. Has the shape of y but with the dimension associated with axis removed.