Rate this Page

Function torch::stable::subtract#

Function Documentation#

inline torch::stable::Tensor torch::stable::subtract(const torch::stable::Tensor &self, const torch::stable::Tensor &other, double alpha = 1.0)#

Stable version of the subtract.Tensor op.

Subtracts the other tensor from self, with an optional scaling factor alpha. Computes: self - alpha * other.

Minimum compatible version: PyTorch 2.10.

Note

The alpha parameter is typed as double API uses double for the Scalar parameter.

Parameters:
  • self – The input tensor.

  • other – The tensor to subtract.

  • alpha – The scaling factor for other. Defaults to 1.0.

Returns:

The result of self - alpha * other.