burn icon indicating copy to clipboard operation
burn copied to clipboard

support the pow operation between two tensors

Open L-M-Sherlock opened this issue 1 year ago • 5 comments

I find that the tensor could be taken the power by a scalar value:

https://docs.rs/burn/latest/burn/tensor/struct.Tensor.html#method.powf

But I haven't found the method to take the power of a tensor with another tensor, like torch:

https://pytorch.org/docs/stable/generated/torch.pow.html

L-M-Sherlock avatar Aug 05 '23 17:08 L-M-Sherlock

Try result = (power * base.log()).exp(). This is equivalent to base^power.

Gadersd avatar Aug 06 '23 14:08 Gadersd

@Gadersd, thanks for your suggestion! I have another problem. Is there an equivalent to torch.nonzero?

https://pytorch.org/docs/stable/generated/torch.nonzero.html

L-M-Sherlock avatar Aug 06 '23 15:08 L-M-Sherlock

I think we should still support the pow operation between two tensors and not force people to use a combination of mul, log and exp.

nathanielsimard avatar Aug 06 '23 15:08 nathanielsimard

Is there a plan to support pow operation? If not, I'll close the issue.

L-M-Sherlock avatar Sep 18 '23 10:09 L-M-Sherlock

We will support that operation, so we can keep the issue open!

nathanielsimard avatar Sep 18 '23 14:09 nathanielsimard

Completed via https://github.com/tracel-ai/burn/pull/748

antimora avatar Mar 29 '24 00:03 antimora