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

Hi
Can you share the Keras model which you are trying to implement in MATLAB?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 8월 26일

댓글:

2021년 9월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by