Simple way of using any data type

Hi there. Is there any way to configure SameDiff to use some specific DataType by default? As far as I understand almost all operations (except the ones working with indices) use FLOAT as the default one. If I want to use BFLOAT16 or FLOAT16 - do I have to use casting everywhere, or could I simply let the SameDiff know my type preferences?

And another related question - should using any of the mentioned above data types decrease the performance? I tried already casting to FLOAT16 but I notices that in this case the performance got some 10-15% slowdown.

@partarstu
You’ll use nd4j for that:

        Nd4j.setDefaultDataTypes(DataType.DOUBLE,DataType.FLOAT);

Regarding fp16 most benefits will come from GPUs. I can try profiling that and see if there can be any improvements though.

1 Like

Perfect. Thanks a lot for a prompt response!