PyTorch torch.divide function
PyTorch torch reference manual
torch.divide is a PyTorch function for element-wise division (equivalent to div).
Function definition
torch.divide(input, other, *, rounding_mode=None, out=None)
Usage examples
Example
import
torch
Element-wise division example
x
=
torch.
tensor
(
[
10.0
,
20.0
,
30.0
]
)
y
=
torch.
tensor
(
[
2.0
,
4.0
,
5.0
]
)
result
=
torch.
divide
(
x
,
y
)
(
result
)