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

PyTorch torch.addcdiv Function

PyTorch torch.addcdiv Function


PyTorch torch reference manual PyTorch torch reference manual

torch.addcdiv is a function in PyTorch used to perform input + value * (tensor1 / tensor2) element-wise operations.

Function definition



torch.addcdiv(input, tensor1, tensor2, value=1, out=None)

Parameter Description


Usage examples

Example

import

torch

Creating tensors

input

=

torch.

tensor

(

[

1.0

,

2.0

,

3.0

]

)

tensor1

=

torch.

tensor

(

[

4.0

,

8.0

,

12.0

]

)

tensor2

=

torch.

tensor

(

[

2.0

,

2.0

,

2.0

]

)

Perform input + value * (tensor1 / tensor2)

result

=

torch.

addcdiv

(

input

,

tensor1

,

tensor2

,

value

=

1

)

print

(

result

)

The output is:



tensor([3., 6., 9.])


PyTorch torch reference manual PyTorch torch reference manual