use of org.nd4j.linalg.api.ops.impl.indexaccum.LastIndex in project nd4j by deeplearning4j.
the class BooleanIndexing method lastIndex.
/**
* This method returns last index matching given condition
*
* PLEASE NOTE: This method will return -1 value if condition wasn't met
*
* @param array
* @param condition
* @return
*/
public static INDArray lastIndex(INDArray array, Condition condition) {
if (!(condition instanceof BaseCondition))
throw new UnsupportedOperationException("Only static Conditions are supported");
LastIndex idx = new LastIndex(array, condition);
Nd4j.getExecutioner().exec(idx);
return Nd4j.scalar((double) idx.getFinalResult());
}
Aggregations