Computing a mask using Conditions

Hi, can someone help me how to formulate ‘advanced’ conditions with ND4J?
For example:

  • (s1 > 1) & (s2 < s1)

So when using
INDArray s1 = Nd4j.create(new double {1, 2, 3, 4});
INDArray s2 = Nd4j.create(new double {4, 3, 2, 1});

the expected output would be an array with [false, false, true, true]

@mado89 Sorry missed this one.
Please ping me if you don’t see anything.

For future users:

You would want to use where(…) to evaluate conditions and the bitwise operations for comparisons. Each ndarray has the following:
for elementwise comparisons.
For comparisons I would recommend using NDBitwise as follows:

import org.nd4j.linalg.factory.ops.NDBitwise;
NDBitwise bitwise = new NDBitwise();
INDArray mask = bitwise.and(,;

We also have where if you need that as well.