SpectralNormalizati​on Layer (for SNGAN)

spectral normalization layer input : layer , name

47 Downloads

Updated Mon, 14 Nov 2022 14:25:59 +0000

View License

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 (2023). SpectralNormalization Layer (for SNGAN) (https://www.mathworks.com/matlabcentral/fileexchange/91740-spectralnormalization-layer-for-sngan), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with R2021a
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1.0

sn

1.0.3

update u v

1.0.2

fix parameter u v

1.0.1

l2 norm

1.0.0