INDArray power method


Its my first question/post so I wanted to first thank the developers and maintainers of this awesome product.

I am new to ND4J. I am trying to learn DL4J. I was creating a linear regression model from scratch and I got stuck a little. I can see the INDArray interface defines most operations like add, subtract, divide etc. but I couldnt find a method that takes a scalar and raises all values in the array to the power of the value provided. Something like INDArray.pow(int).

I went through the javadoc and came across org.nd4j.linalg.api.ops.impl.scalar.Pow and PowPairwise but I dont think thats what I am looking for.

I can always recursively use the mul method but thought I would ask if I am missing something obvious.

Thanks in advance for your time.

The method you are looking for is Nd4j.math.pow(array, power).

See also: and in particular.

Thank you @treo. Appreciate the help very much.