Torch.pow, tensor of exponents?

Looking to use torch.pow(input, exponent)
I’m wondering what options I have when input is a scalar and exponent is a tensor…

input = 10
exponent = torch.Tensor([5,8,4,6], requires_grad=False)
out = torch.pow(input, exponent)

Reading the doc of torch.pow, you’ll see that if exponent is a tensor then the output is input_i^exponent_i, or in your case

out = [10^5, 10^8, 10^4, 10^6]
1 Like