我正在使用 DeepLearning4J 和 nd4j-cuda-10.2。使用 shuffle() 方法后,所有 DataSet 元素都变为零。我已经跟踪了代码,我认为 registerAction() 方法有问题。
DataSet data;
...
data.shuffle();
这是洗牌前的数据:
===========INPUT===================
[[ 0, 0, 0, ... 0, 0, 16.0000],
[ 0, 0, 0, ... 0, 1.0000, 16.0000],
[ 1.0000, 0, 0, ... 0, 2.0000, 16.0000],
...,
[ 5.0000, 39.0000, 0, ... 25.0000, 19.0000, 16.0000],
[ 5.0000, 40.0000, 0, ... 25.0000, 19.0000, 16.0000],
[ 5.0000, 41.0000, 0, ... 25.0000, 19.0000, 16.0000]]
=================OUTPUT==================
[[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 1.0000, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, 1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 1.0000, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 1.0000, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, 0, 1.0000],
[ 0, 0, 0, 1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, 0, 0, 1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 1.0000, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, 0, -1.0000],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, 0, -1.0000],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, 0, 0, -1.0000, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, -1.0000, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, -1.0000, 0, 0, 0],
[ 0, 0, 0, -1.0000, 0]]
之后:
===========INPUT===================
[[ 0, 0, 0, ... 0, 0, 0],
[ 0, 0, 0, ... 0, 0, 0],
[ 0, 0, 0, ... 0, 0, 0],
...,
[ 0, 0, 0, ... 0, 0, 0],
[ 0, 0, 0, ... 0, 0, 0],
[ 0, 0, 0, ... 0, 0, 0]]
=================OUTPUT==================
[[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0],
[ 0, 0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ext context, INDArray result, INDArray... operands) {
if (result != null && !result.isEmpty()) {
AllocationPoint point = this.allocator.getAllocationPoint(result);
point.tickDeviceWrite();
INDArray[] var5 = operands;
int var6 = operands.length;
for(int var7 = 0; var7 < var6; ++var7) {
INDArray operand = var5[var7];
if (operand != null && !operand.isEmpty()) {
AllocationPoint pointOperand = this.allocator.getAllocationPoint(operand);
pointOperand.tickDeviceRead();
}
}
}
}