class_docstr: Demodulation layer for StyleGAN.
  
  This layer applies the Demodulated Convolution layer from StyleGANv2
  that is used in the paper "
  Analyzing and Improving the Image Quality of StyleGAN".
  https://arxiv.org/pdf/1912.04958.pdf
  
  It takes in the style input and applies demodulation on the features.
class_docstr_tok: ["Demodulation","layer","for","StyleGAN",".","This","layer","applies","the","Demodulated","Convolution","layer","from","StyleGANv2","that","is","used","in","the","paper","``","Analyzing","and","Improving","the","Image","Quality","of","StyleGAN","''",".","https",":","\/\/arxiv.org\/pdf\/1912.04958.pdf","It","takes","in","the","style","input","and","applies","demodulation","on","the","features","."]
docstr: Returns the demodaulted features.
  
  Args:
    inputs: Two elements, the input feature map and the mapped latent code.
  
  Returns:
    The feature map after applying the demodulated convolution.
docstr_tok: ["Returns","the","demodaulted","features",".","Args",":","inputs",":","Two","elements",",","the","input","feature","map","and","the","mapped","latent","code",".","Returns",":","The","feature","map","after","applying","the","demodulated","convolution","."]
code: def call(
      self, inputs: Union[List[tf.Tensor], Tuple[tf.Tensor, tf.Tensor]]
  ) -> tf.Tensor:
      """Returns the demodaulted features.
  
      Args:
        inputs: Two elements, the input feature map and the mapped latent code.
  
      Returns:
        The feature map after applying the demodulated convolution.
      """
      if len(inputs) != 2:
          raise ValueError("inputs needs to have two elements.")
  
      feature_map, mapped_latent_code = inputs
      style = self._dense_layer(mapped_latent_code)[
          :, tf.newaxis, tf.newaxis, :
      ]
  
      modulated_features = self._conv_layer(feature_map * style)
      weight = self._conv_layer.kernel[tf.newaxis, :, :, :, :]
  
      demodulation = tf.math.rsqrt(
          tf.math.reduce_sum(
              (tf.math.square(weight * style[:, :, :, :, tf.newaxis])),
              [1, 2, 3],
          )
          + 1e-8
      )
      demodulated_features = (
          modulated_features
          * demodulation[:, tf.newaxis, tf.newaxis, :]
      )
  
      return tf.nn.bias_add(demodulated_features, self._bias)
  
imports: import math
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union, List
  import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling the DemodulatedConvolution obj's underlying member method code with example usage: obj.call(inputs) and returns: tf