trapezoid(y) tensor(10.5) >>> # Computes the same trapezoidal rule directly to verify >>> (1 + 10 + 10) / 2 10.5 >>> # Computes the trapezoidal rule in 1D with constant spacing of 2 >>> # NOTE: the result is the same as before, but multiplied by 2 >>> torch.trapezoid(y,...
沿着dim 累积计算 trapezoidal rule 。默认情况下,元素之间的间距假定为 1,但 dx 可用于指定不同的常量间距,并且 x 可用于指定沿 dim 的任意间距。 更多详情,请阅读 torch.trapezoid() 。 torch.trapezoid() 与此函数之间的区别在于, torch.trapezoid() 为每个积分返回一个值,而此函数为积分中的每个间距返回...