PyTorch función torch.subtract
Manual de referencia de Pytorch torch
torch.subtractEs la función en PyTorch utilizada para realizar la resta elemento a elemento. Contorch.subfuncionalidad idéntica.
Definición de la función
torch.subtract(input, other, out=None)
Ejemplo de uso
Ejemplo
import torch
# Resta elemento a elemento
x = torch.tensor([5.0, 6.0, 7.0])
y = torch.tensor([1.0, 2.0, 3.0])
result = torch.subtract(x, y)
print(result)
# Resta elemento a elemento
x = torch.tensor([5.0, 6.0, 7.0])
y = torch.tensor([1.0, 2.0, 3.0])
result = torch.subtract(x, y)
print(result)
Otras extensiones