首页 > 解决方案 > Nd4J:获取值存在的索引

问题描述

如何获取存在某个值的索引。在 numpy 中:

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

在 ND4J 中,我已经到达这里,但我不知道在条件参数中放入什么:

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

换句话说,如何在 ND4J 的 INDArray 中找到一个元素?

标签: javanumpynd4j

解决方案


BooleanIndexing.firstIndex(INDArray, Condition) 就是我想的你在看的东西。


推荐阅读