A problem about "embedAndReshapeLayer"
Show older comments
My matlab version is: '9.13.0.2399474 (R2022b) Update 7'
I try to copy a code section from the official example about the conditional GAN with the link below (the code section is listed behind):
Two problems occurred:
1. Seems to be a grammar issue related to layer "projectAndReshapeLayer" definition. The command window indicates:
'Error using projectAndReshapeLayer
projectAndReshapeLayer(projectionSize,numLatentInputs,'proj');
↑
Invalid argument at position 2. A name is expected.
Error in untitled (line 11)
projectAndReshapeLayer(projectionSize,numLatentInputs,'proj');
2. I tried to adjust the above issued statement by keeping projectionSize but deleting numLatentInputs. This statement is all good but another error occured in the command window:
'embedAndReshapeLayer' is used in Generate Synthetic Signals Using Conditional GAN.
Error in untitled (line 32)
embedAndReshapeLayer(projectionSize(1:2),embeddingDimension,numClasses,'emb')];
Do I have to construct the whole GAN (Generator and Discriminator) to solve this error? Instead, I just want to loop more in depth about the data size variation in the generator network.
% Generator Network
numFilters = 64;
numLatentInputs = 100;
projectionSize = [4 1 1024];
numClasses = 2;
embeddingDimension = 100;
layersGenerator = [
imageInputLayer([1 1 numLatentInputs],'Normalization','none','Name','in')
projectAndReshapeLayer(projectionSize,numLatentInputs,'proj');
concatenationLayer(3,2,'Name','cat');
transposedConv2dLayer([5 1],8*numFilters,'Name','tconv1')
batchNormalizationLayer('Name','bn1','Epsilon',5e-5)
reluLayer('Name','relu1')
transposedConv2dLayer([10 1],4*numFilters,'Stride',4,'Cropping',[1 0],'Name','tconv2')
batchNormalizationLayer('Name','bn2','Epsilon',5e-5)
reluLayer('Name','relu2')
transposedConv2dLayer([12 1],2*numFilters,'Stride',4,'Cropping',[1 0],'Name','tconv3')
batchNormalizationLayer('Name','bn3','Epsilon',5e-5)
reluLayer('Name','relu3')
transposedConv2dLayer([5 1],numFilters,'Stride',4,'Cropping',[1 0],'Name','tconv4')
batchNormalizationLayer('Name','bn4','Epsilon',5e-5)
reluLayer('Name','relu4')
transposedConv2dLayer([7 1],1,'Stride',2,'Cropping',[1 0],'Name','tconv5')
];
lgraphGenerator = layerGraph(layersGenerator);
layers = [
imageInputLayer([1 1],'Name','labels','Normalization','none')
embedAndReshapeLayer(projectionSize(1:2),embeddingDimension,numClasses,'emb')];
lgraphGenerator = addLayers(lgraphGenerator,layers);
lgraphGenerator = connectLayers(lgraphGenerator,'emb','cat/in2');
Accepted Answer
More Answers (0)
Categories
Find more on Install Products 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!