I started working with ND4j recently and came upon an issue I don't have an explanation for.
INDArray test =
Nd4j.create(new double[] {1.0, 1.0, 2.0, 1.0}, new long[] {2, 2}, DataType.UINT16);
BooleanIndexing.replaceWhere(test, 0.0, Conditions.greaterThan(0)); // test not updated
INDArray testCasted = test.castTo(DataType.FLOAT);
BooleanIndexing.replaceWhere(testCasted, 0.0, Conditions.greaterThan(0)); // testCasted is updated
In the code above, an array created with UINT16
datatype doesn't get updated by the replaceWhere
function. But when the array is casted to a FLOAT
, replaceWhere
works as expected. Why is this?