What is the difference between formatted and unformatted dlarrays?

7 views (last 30 days)
I am trying to implement a custom deeplearning training loop and i noticed that starting from:
dlY1; % Unformatted dlarray 175x1x53696
dlY2=dlarray(dlY1,'CBT') % Formatted version of dlY1
The functions:
res1=lstm(dlY1,H0,C0,Weights,RecurrentWeights,parameters.LSTM.Bias,'DataFormat','CBT');
res2=lstm(dlY2,H0,C0,Weights,RecurrentWeights,parameters.LSTM.Bias);
Give two different results:
res1; %53696x3 dlarray
res2; %3x1x53696 dlarray
Can someone explain this? I was expecting the same values as results

Accepted Answer

Sai Bhargav Avula
Sai Bhargav Avula on 25 Mar 2020
Edited: Sai Bhargav Avula on 25 Mar 2020
Hi, By having formatted dlarray enforces the order of labels 'SCBTU'. This enforcement eliminates ambiguous semantics in operations, which implicitly match labels between inputs. dlarray also enforces that the labels 'C', 'B', and 'T' can each appear at most once. The functions that use these labels accept at most one dimension for each label.
Here in your case the value of the results are same, but their format is different as formatted dlarray enforce the format constraints, where as unformatted dlarray does not enforce any constraints
Hope this helps!

More Answers (0)

Community Treasure Hunt

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

Start Hunting!