softmax層内での計算方法
Show older comments
MATLABのHPにあるドキュメンテーション「イメージ分類用の積層自己符号化器の学習」で求めた重み・バイアスの値を用いて、C言語で数字認識を行おうと考えています。
softmax層で行われている計算を、C言語で以下のように組んでいるのですが、数字認識の結果がMATLABとC言語で異なってしまいます。
以下の計算式とMATLAB内での計算の差異を教えていただけないでしょうか?
sum = 0.0;
for(j = 0; j < 10; j++){
Dst_soft[j] = 0.0;
for(i = 0; i < 50; i++){
a = input[i] * SW[j][i];
Dst_soft[j] = Dst_soft[j] + a;
}
Dst_soft[j] = Dst_soft[j] + SB[j];
sum = sum + exp(Dst_soft[j]);
}
for(j = 0; j < 10; j++){
Dst_soft[j] = exp(Dst_soft[j])/sum;
}
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!