0

If I have this array (its an INDArray but I'm simplifying the view) myArray = [[0, 0.7], [0, 0]], and I do this res = myArray.eq(0.7) I get res = [[false, true], [false, false]]

Is there a Nd4j method that can convert boolean INDArrays to 0/1 Arrays ? to get this [[0, 1], [0, 0]]

4

1 回答 1

0

In INDArray there’s cast method available, it will give you exactly what you want - array of 0s and 1s

于 2020-01-14T00:06:44.503 回答