Failed to calculate output shapes for op

I am running the following in a JUnit test.

INDArray conditions = Nd4j.ones(1, 5);
INDArray[] testWhere = Nd4j.where(conditions, null, null);

But get the following error:

java.lang.RuntimeException: Data types validation failed
at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.calculateOutputShape(NativeOpExecutioner.java:1700)
at org.nd4j.linalg.cpu.nativecpu.ops.NativeOpExecutioner.calculateOutputShape(NativeOpExecutioner.java:1613)
at org.nd4j.linalg.factory.Nd4j.where(Nd4j.java:5559)

I also see

Op [where_np] failed check for input [0], DataType: [FLOAT]
Failed to calculate output shapes for op [0]... (goes on to list the input args and their shapes)

in the logs.

This is using 1.0.0-beta7 of nd4j-api and nd4j-native-platform. I am using Java 15 for my project.

I saw a similar post where there was a shape mismatch issue with concat. I was expecting this to go through and simply return the indices of my conditions array. Happy to add in further details to help investigate this.

@masterchief please specify the data type. Nd4j.ones(…) without a data type specified will cause this data type error.
In the next release in our own unit tests, we’ve actually removed the use of the default types. The problem with the default floating point type (which if you click in Nd4j.ones(…) a call to Nd4j.defaultFloatingPointType()) is it’s not thread safe and will generally cause issues.
Specifying the data type will usually fix this. If you still have issues, please try snapshots, otherwise feel free to post here if you have any other questions.

@agibsonccc

I tried running

    INDArray conditions = Nd4j.ones(DataType.INT32, 1, 5);
    INDArray[] testWhere = Nd4j.where(conditions, null, null);

but still see the same error with FLOAT replaced with INT32.

@masterchief
Hm, it appears something may be off. Could you please file an issue at https://github.com/eclipse/deeplearning4j/issues/new and I will get a fix up in the next day or so.
Fully reproducible code would be appreciated.

From there, you can use snapshots till the next release due out soonish.

@masterchief for now use boolean inputs only as follows:

        INDArray arr = Nd4j.create(new boolean[][]{{false,true,false},{false,false,true},{false,false,true}});

We’ll allow ints and other conversions at a later date.
You can see our unit tests that cover this here:

This works. Thank you!