Train Generative Adversarial Network (GAN) Example projectAndReshapeLayer

17 views (last 30 days)
New to deep learning here, I was follwing the GAN example from: https://au.mathworks.com/help/deeplearning/ug/train-generative-adversarial-network.html
layersGenerator = [
featureInputLayer(numLatentInputs,'Name','in')
projectAndReshapeLayer(projectionSize,numLatentInputs,'Name','proj');
transposedConv2dLayer(filterSize,4*numFilters,'Name','tconv1')
batchNormalizationLayer('Name','bnorm1')
reluLayer('Name','relu1')
transposedConv2dLayer(filterSize,2*numFilters,'Stride',2,'Cropping','same','Name','tconv2')
batchNormalizationLayer('Name','bnorm2')
reluLayer('Name','relu2')
transposedConv2dLayer(filterSize,numFilters,'Stride',2,'Cropping','same','Name','tconv3')
batchNormalizationLayer('Name','bnorm3')
reluLayer('Name','relu3')
transposedConv2dLayer(filterSize,3,'Stride',2,'Cropping','same','Name','tconv4')
tanhLayer('Name','tanh')];
At the projectAndReshapeLayer() line reading:
'projectAndReshapeLayer' is used in the following examples:
Generate Synthetic Signals Using Conditional Generative Adversarial Network
Include Custom Layer in Network
Train Conditional Generative Adversarial Network (CGAN)
Train Generative Adversarial Network (GAN)
Train Wasserstein GAN with Gradient Penalty (WGAN-GP)
Error in GANtestrun (line 31)
projectAndReshapeLayer(projectionSize,numLatentInputs,'Name','proj');
I tried clicking on the train GAN example, I'm not sure what to make of it. projectionSize is defined at [4 4 512] and numLatentInputs is 100
I don't know what is the cause of error since Matlab isn't showing it.

Answers (1)

Hrishikesh Borate
Hrishikesh Borate on 23 Jul 2021
Hi,
One possible reason for the occurrence of the error can be that the code is being executed from a directory where the projectAndReshapeLayer.m file is not located. To counter this error, execute the code from the directory which is accessed when the following command is executed in the Command Window.
openExample('nnet/TrainGenerativeAdversarialNetworkGANExample')

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by