Will the deep learning toolbox train convert double-precision training data into single-precision during training in default?

12 views (last 30 days)
Hengfa Lu
Hengfa Lu on 14 Jan 2022
Commented: yanqi liu on 18 Jan 2022
I am using the MATLAB deep learning toolbox to build and train a neural network. I trained the network using the provided function 'trainNetwork' using my double-precision data. But the obtained trained weights are in single-precision. My question is that does MATLAB deep learning tool automatically convert the double-precision training data into single-precision first and then do the consequent training in single-precision?
If so, does the two following cases will produce the same results (ignoring the uncertainty brought by SGD)?
1. Training data in double-precision and single-precision network weights.
2. Training data in single-precision and single-precision network weights.
The MATLAB doc says that 'When you train a network using the trainNetwork function, or when you use prediction or validation functions with DAGNetwork and SeriesNetwork objects, the software performs these computations using single-precision, floating-point arithmetic.' I checked the trainNetwork function and found that the network weights were initialized in single-precision but did not see any command on changing the training data precision.
Thank you! Any feedback and suggestion will be much appreciated.

Answers (1)

yanqi liu
yanqi liu on 17 Jan 2022
yes,sir,in trainNetwork,the precision make to single,such as

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by