PyTorch torch.xlogy function
PyTorch torch reference manual
torch.xlogy A function in PyTorch that computes input * log(other) element by element. When other is 0, it returns 0.
Function definition
torch.xlogy(input, other, out=None)
Usage examples
Example
import
torch
Compute x * log(y)
x
=
torch.
tensor
(
[
1.0
,
2.0
,
3.0
]
)
y
=
torch.
tensor
(
[
2.0
,
3.0
,
4.0
]
)
result
=
torch.
xlogy
(
x
,
y
)
(
result
)