필터 지우기
필터 지우기

How to use double precision in deep learning toolbox?

조회 수: 11 (최근 30일)
Rohan Mahala
Rohan Mahala 2023년 11월 12일
댓글: Rohan Mahala 2023년 12월 26일
It seems like deep learning toolbox has defalut set single precision. I want double precision in my neural network, how to achieve this? Please Help!
  댓글 수: 2
Matt J
Matt J 2023년 11월 12일
Are you saying you want to train in double precision, or just do inference in double precision?
Rohan Mahala
Rohan Mahala 2023년 11월 13일
Both actually, train as well as inference in double precision.

댓글을 달려면 로그인하십시오.

답변 (1개)

Angelo Yeo
Angelo Yeo 2023년 11월 14일
I understand that you want to use trainNetwork and trainnet to train and predict in double precision This is currently not possible in MATLAB R2023b. Internally, 'trainnet' defaults to single precision and hence cannot be used in this case. This functionality is something the developers are actively working on for a future release.
A workaround is to use a custom training loop. You can refer the following example for a general reference -
1. Once the learnable network parameters are initialized, they must be converted to type double by using 'dlupdate'
net = dlupdate(@double, net);
2. Ensure data is double precision. This can be set using the 'OutputCast' of 'minibatchqueue' to 'double'. Note that this parameter is read-only. It cannot be modified after construction of 'minibatchqueue'.
Please also note that it is not possible to train in double precision if you are using DAGNetwork or SeriesNetwork.
  댓글 수: 1
Rohan Mahala
Rohan Mahala 2023년 12월 26일
I am not using 'trainnet', instead I am using acclerated custom training loop.
I did the OutputCast of 'minibatchqueue' to 'double' and now I am getting the predictions in double cast, However i am not able to achieve the desired accuracy.
Can you please suggest me some other pointers to keep in mind so that the training happens correctly in 'double' precision mode only.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by