How to define a custom layer in deep learning toolbox which makes multiple copies of a matrix ?
1 回表示 (過去 30 日間)
古いコメントを表示
I have to design a deep fully connected neural network for regression task. I am using examples from the deep learning toolbox for images. My input matrix size and precticted matrix Y has the same size of [1 1 32]. But my target matrix T has size [168 1 32]. Since the regressionLayer requires the predicted Y and target T matrices to be of same size, for the purpose of my loss function I need to replicate the predicted matrix Y 168 times.
So, I want to know how to add a Layer while designing neural network which just does repmat() before I pass it to the last regressionLayer.
Thank you.
1 件のコメント
Jyotsna Talluri
2019 年 8 月 22 日
編集済み: Jyotsna Talluri
2019 年 8 月 22 日
Can you share your model and dataset?
回答 (1 件)
Hon Wah Yeung
2019 年 11 月 6 日
I kind of have this problem a while ago but now fixed it. It can be done by the following, just one line.
suppose the [1 1 32] is your X1, and you want N row copies of this
Ones = ones([N 1],'like',X1);
Z=Ones.*X1;
and the 2019b version will automatically do the backward function for you.
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!