Double precision in deep learning

Hello guys,
i want to train my LSTM using double precision but the deep learning toolbox only allows single precision. Can i change that to double precision or how do i train my neural network using double precision ?
Thanks.

5 件のコメント

KSSV
KSSV 2022 年 11 月 28 日
To my knowledge, the present deep learning toolbox uses single precision. Though you give input in double, it will be converted to single and trained.
bah
bah 2022 年 11 月 29 日
but using custom training loops it is possible to use double precision right ?
Matt J
Matt J 2022 年 11 月 29 日
I don't know, but you should be mindful that training could be slower on the GPU, not just because of the increased precision, but because some GPUs are not optimized for double precision.
bah
bah 2022 年 11 月 29 日
Thanks a lot for the information.
Walter Roberson
Walter Roberson 2023 年 11 月 12 日
A lot of Nvidia models have double precision at 1/32 of single precision rates. Some improve to 1/24. And a few uncommon models more intended for server improve to 1/8: you have to examine the models carefully to determine the best for your purposes.

サインインしてコメントする。

 採用された回答

Joss Knight
Joss Knight 2022 年 12 月 18 日

0 投票

This is possible with a dlnetwork but it is (currently) more of a workaround than anything else. Once your dlnetwork is ready to go, convert it to double precision:
net = dlupdate(@double, net);
net.State = dlupdate(@double, net.State);
Then make sure your input data to the network is always in double precision. Everything should then remain in double as you train and use the network.
Let me know if this doesn't work for you.

2 件のコメント

Rohan Mahala
Rohan Mahala 2023 年 11 月 12 日
Hi Joss, can you please tell how to do this without a dlnetwork
Joss Knight
Joss Knight 2023 年 11 月 12 日
To do this without a dlnetwork you will need to implement your network in functional form. Either way, to train it will require use of automatic differentiation and a custom training loop.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

質問済み:

bah
2022 年 11 月 28 日

コメント済み:

2023 年 11 月 12 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by