PyTorch torch.multiply function
PyTorch torch reference manual
torch.multiply is a function in PyTorch used for element-wise multiplication. Similar to torch.mul in functionality.
Function definition
torch.multiply(input, other, out=None)
Usage examples
Example
import
torch
Element-wise multiplication
x
=
torch.
tensor
(
[
1.0
,
2.0
,
3.0
]
)
y
=
torch.
tensor
(
[
4.0
,
5.0
,
6.0
]
)
result
=
torch.
multiply
(
x
,
y
)
(
result
)