Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spectral Normalization #380

merged 5 commits into from Apr 2, 2019


None yet
3 participants
Copy link

TE-KazukiYoshiyama commented Mar 30, 2019

Implementation of the spectral normalization.

Now, we also added the apply_w and apply_b argument to the following functions

  • convolution / deconvolution,
  • affine,
  • embed,

which applies a function to a parameter variable.

Spectral normalization is applied to e.g., the convolution like

import nnabla as nn
import nnabla.parametric_functions as PF

b, c, h, w = 4, 64, 32, 32

# Spectrally normalized convolution
apply_w = lambda w: PF.spectral_norm(w, dim=0)
h = nn.Variable.from_numpy_array(np.random.randn(b, c, h, w))
h = PF.convolution(h, with_bias=False, apply_w=apply_w)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.