torch.Tensor.add — PyTorch 2.7 documentation (original) (raw)

Tensor.add(other, *, alpha=1) → Tensor

Add a scalar or tensor to self tensor. If both alphaand other are specified, each element of other is scaled byalpha before being used.

When other is a tensor, the shape of other must bebroadcastable with the shape of the underlying tensor

See torch.add()

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.