Using word embedding layer and convolutional layer
显示 更早的评论
Hello everyone. I'm new to use MATLAB. i had to implement a neural network described in keras in MATLAB for a project. I have to use various layer such as wordembedding layer and convolutional layer. i don't understand if the wordembedding layer of matlab equals the embedding layer of keras. As input i have sequence of 200 amino acids. Using deep network designer I built this net but it keep giving me error in the convolutional layer because there is a mismatch.

lgraph = layerGraph();
tempLayers = [
sequenceInputLayer(1,"Name","sequence")
wordEmbeddingLayer(128,3,"Name","word-embedding")
sequenceFoldingLayer("Name","seqfold")];
reluLayer
lgraph = addLayers(lgraph,tempLayers);
tempLayers = [
convolution2dLayer([1 16],64,"Name","conv","BiasInitializer","narrow-normal","Padding","same","Stride",1)
batchNormalizationLayer("Name","batchnorm")
reluLayer("Name","relu")
maxPooling2dLayer([5 1],"Name","maxpool","Padding","same")
];
lgraph = addLayers(lgraph,tempLayers);
tempLayers = [
sequenceUnfoldingLayer("Name","sequnfold")
flattenLayer("Name","flatten")
lstmLayer(100,"Name","lstm","OutputMode","last")
dropoutLayer(0.1,"Name","dropout")
%fullyConnectedLayer(numClasses)
sigmoidLayer("Name","sigmoid")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
lgraph = addLayers(lgraph,tempLayers);
lgraph = connectLayers(lgraph,"seqfold/out","conv");
lgraph = connectLayers(lgraph,"seqfold/miniBatchSize","sequnfold/miniBatchSize");
lgraph = connectLayers(lgraph,"maxpool","sequnfold/in");
1 个评论
Anshika Chaurasia
2021-9-15
Hi
Can you share the Keras model which you are trying to implement in MATLAB?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!