torch.xlogy¶
-
torch.
xlogy
(input, other, *, out=None) → Tensor¶ Computes
input * log(other)
with the following cases.Similar to SciPy’s scipy.special.xlogy.
Note
At least one of
input
orother
must be a tensor.- Keyword Arguments
out (Tensor, optional) – the output tensor.
Example:
>>> x = torch.zeros(5,) >>> y = torch.tensor([-1, 0, 1, float('inf'), float('nan')]) >>> torch.xlogy(x, y) tensor([0., 0., 0., 0., nan]) >>> x = torch.tensor([1, 2, 3]) >>> y = torch.tensor([3, 2, 1]) >>> torch.xlogy(x, y) tensor([1.0986, 1.3863, 0.0000]) >>> torch.xlogy(x, 4) tensor([1.3863, 2.7726, 4.1589]) >>> torch.xlogy(2, y) tensor([2.1972, 1.3863, 0.0000])