class_docstr: Dense layer with spectral normalization applied to weights, as in.
  
  [BJC19]_.
docstr: Adapted from https://github.com/apache/incubator-
  mxnet/blob/master/example/gluon/sn_gan/model.py.
docstr_tok: ["Adapted","from","https",":","\/\/github.com\/apache\/incubator-","mxnet\/blob\/master\/example\/gluon\/sn_gan\/model.py","."]
code: def _spectral_norm(self, weight: Tensor, u: Tensor) -> Tensor:
      """
      Adapted from https://github.com/apache/incubator-
      mxnet/blob/master/example/gluon/sn_gan/model.py.
      """
      w = weight
      w_mat = nd.reshape(w, [w.shape[0], -1])
  
      _u = u
      _v = None
  
      for _ in range(self._num_power_iter):
          _v = nd.L2Normalization(nd.dot(_u, w_mat))
          _u = nd.L2Normalization(nd.dot(_v, w_mat.T))
  
      sigma = nd.sum(nd.dot(_u, w_mat) * _v)
  
      # this is different from standard spectral normalization
      sigma = nd.maximum(nd.ones(1, ctx=self._ctx), sigma / self._coeff)
  
      if sigma == 0.0:
          sigma = EPSILON
  
      with autograd.pause():
          self._u.set_data(_u)
  
      return w / sigma
  
file_path: gluonts/src/gluonts/mx/block/sndense.py
imports: from typing import Optional
  import mxnet
  from mxnet import nd
  from mxnet import autograd
  from mxnet import init
  from gluonts.core.component import validated
  from gluonts.mx.context import get_mxnet_context
  from gluonts.mx import Tensor
  from gluonts.mx.activation import get_activation
label_desc: Use image node_id 5 for calling the SNDense obj's underlying member method code with example usage: obj._spectral_norm(weight, u) and returns: unknown