java - 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 中找到一个元素?
解决方案
BooleanIndexing.firstIndex(INDArray, Condition) 就是我想的你在看的东西。
推荐阅读
- python - Django不断返回分配错误之前引用的局部变量“产品”
- php - 如何使用 preg_replace_callback 而不是 preg_replace 用链接 html 替换单词?
- python - “找不到任何有价值的窗口提供程序”错误
- python - 如何进一步优化这段代码?
- lstm - 如何使用二进制标签计算 LSTM 的累积分数?
- wso2dss - WSO2EI DSS 中未发现 ERP 操作错误
- swift - GKState:为什么 StateMachine == nil 代表调用?
- php - 我想通过比较两个索引从嵌套关联数组中删除
- c# - 在 ListBoxItem DataTemplate 内的嵌套控件中处理相同的单击事件 - WPF
- c# - Listview 行工具提示显示持续时间