PyTorch torch.div Function
Pytorch torch Reference Manual
torch.divIt is a function in PyTorch used to perform element-wise division.
Function Definition
torch.div(input, other, rounding_mode, out)
Usage Example
Example
import torch
a = torch.tensor([10, 20, 30])
b = torch.tensor([2, 4, 5])
# Element-wise division
c = torch.div(a, b)
print(c)
a = torch.tensor([10, 20, 30])
b = torch.tensor([2, 4, 5])
# Element-wise division
c = torch.div(a, b)
print(c)
The output result is:
tensor([5., 5., 6.])
Other Extensions