javanumpynd4j

Nd4J: get index where a value exists


how to get index where a certain value exists. In numpy:

import numpy as np
myArr = np.array()
index = np.where(myArr == someValue)
// Output: an index value consisting rows and cols will be given

In ND4J, I have reached here, but I dont know what to put in condition parameter:

INDArray index = myArr.getWhere(someValue, condition=??);

In other words, how to find an element in INDArray in ND4J?


Solution

  • BooleanIndexing.firstIndex(INDArray, Condition) is what you're looking i think.