Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.div function

PyTorch torch.div function


PyTorch torch reference manual PyTorch torch reference manual

torch.div is a PyTorch function for performing element-wise division.

Function definition

torch.div(input, other, rounding_mode, out)


Usage examples

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

)

The output is:

tensor([5., 5., 6.])


PyTorch torch reference manual PyTorch torch reference manual