I'm pretty new in Java. I would like to initiate an array using Nd4j library INDArray x = new Nd4j.linspace(0, 1, 100);, doing something like x = np.linspace(0, 1, 100) in Python.
And I ran into an error
java: cannot find symbol
symbol: class linspace location: class
org.nd4j.linalg.factory.Nd4j
Although my Nd4j was well installed adding the following in pom.xml, and my IDE IntelliJ can detect ND4j class.
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-api</artifactId>
<version>1.0.0-M2</version>
</dependency>
Am I missing or misunderstood anything? Thanks for your kind help
The problem is:
Because you use
new, Java tries to create a class calledNd4j.linspace, which does not exist (as indicated by the "cannot find symbol, symbol: class linspace"). The classNd4jdoes have a methodlinspace. To fix this, removenewso you call the method: