You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
recommend using spectralNormalize
layers = [
imageInputLayer(inputSize)
convolution2dLayer(filterSize,fs,'Stride',s,'Padding','same','Name','conv1')
] ;
lg = layerGraph(layers);
net = dlnetwork(lg);
u = nan;
v = nan;
% in each iteration before foward(net,x)
[u,v,net] = spectralNormalize(u,v,net)
--------------------------------------------------------------------------------------------------------------------------------
input a conv2d layer or transposedconv2d layer and name for sn layer.
inputlayer need : filter size , num filters (output channel size), num channels(input channel size).
example :
SpectralNormalization(convolution2dLayer(filterSize,numFilters,"NumChannels", 3, 'Stride',2,'Padding','same','Name','conv1') , "sn1" )
SpectralNormalization( transposedConv2dLayer(filterSize, numFilters,"NumChannels", 64, 'Name','detc5',"Stride",2 ,'Cropping','same') , "sn19" )
or you can see how the SpectralNormalization work in code, then coding by self
Cite As
KaSyow Riyuu (2026). SpectralNormalization Layer (for SNGAN) (https://www.mathworks.com/matlabcentral/fileexchange/91740-spectralnormalization-layer-for-sngan), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0 (2.09 KB)
MATLAB Release Compatibility
- Compatible with R2021a
Platform Compatibility
- Windows
- macOS
- Linux
