Non traceable loss function in neural network
1 回表示 (過去 30 日間)
古いコメントを表示
Pere Garau Burguera
2020 年 9 月 25 日
回答済み: Divya Gaddipati
2020 年 10 月 15 日
Hi,
I would want to know if there's any possibility of having a loss function that looks like this:
This is used in a siamese network for metric learning. There are 2 identical networks with the same weights, where the Xs are the inputs and Y are the outputs. The thing is that the operations performed on the dlarrays are not permitted so the gradients cannot be computed.
Is there an alternative way to make this work?
function loss = lossfunc(Y1,Y2,X1,X2,dist)
% accepts the network's predictions Y1, Y2, the inputs
% X1, X2, and the true distance between X1 and X2, and returns the loss value.
loss = .5*((X1-X2)'*pinv(Y1*Y1')*(X1-X2)...
+ (X1-X2)'*pinv(Y2*Y2')*(X1-X2))...
-dist^2);
end
0 件のコメント
採用された回答
Divya Gaddipati
2020 年 10 月 15 日
Currently, pinv is not supported for dlarray inputs.
Alternatively, you could try replacing the function with their own logic using the functions in the below link that are supported by dlarray.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!