# Simple way of using any data type

**URL:** <https://community.konduit.ai/t/simple-way-of-using-any-data-type/2330>\
**Category:** SameDiff\
**Created:** [March 13, 2023, 8:47am UTC](https://community.konduit.ai/t/simple-way-of-using-any-data-type/2330 "2023-03-13T08:47:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![partarstu](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/partarstu/32/276_2.png) [@partarstu](https://community.konduit.ai/u/partarstu)\
**Post date:** [March 13, 2023, 8:47am UTC](https://community.konduit.ai/t/simple-way-of-using-any-data-type/2330/1 "2023-03-13T08:47:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [March 13, 2023, 9:05am UTC](https://community.konduit.ai/t/simple-way-of-using-any-data-type/2330/2 "2023-03-13T09:05:40Z")

</div>

@partarstu  
You’ll use nd4j for that:

```auto
        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.

---

<div class="post-metadata">

**Author:** ![partarstu](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/partarstu/32/276_2.png) [@partarstu](https://community.konduit.ai/u/partarstu)\
**Post date:** [March 13, 2023, 10:33am UTC](https://community.konduit.ai/t/simple-way-of-using-any-data-type/2330/3 "2023-03-13T10:33:46Z")

</div>

Perfect. Thanks a lot for a prompt response!
