class_docstr: Keras `Layer` to parameterize a Pixel CNN++ distribution.
  
  This is a Keras implementation of the Pixel CNN++ network, as described in
  Salimans et al. (2017)[1] and van den Oord et al. (2016)[2].
  (https://github.com/openai/pixel-cnn).
  
  #### References
  
  [1]: Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P. Kingma.
       PixelCNN++: Improving the PixelCNN with Discretized Logistic Mixture
       Likelihood and Other Modifications. In _International Conference on
       Learning Representations_, 2017.
       https://pdfs.semanticscholar.org/9e90/6792f67cbdda7b7777b69284a81044857656.pdf
       Additional details at https://github.com/openai/pixel-cnn
  
  [2]: Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt,
       Alex Graves, and Koray Kavukcuoglu. Conditional Image Generation with
       PixelCNN Decoders. In _30th Conference on Neural Information Processing
       Systems_, 2016.
       https://papers.nips.cc/paper/6527-conditional-image-generation-with-pixelcnn-decoders.pdf
class_docstr_tok: ["Keras","`","Layer","`","to","parameterize","a","Pixel","CNN++","distribution",".","This","is","a","Keras","implementation","of","the","Pixel","CNN++","network",",","as","described","in","Salimans","et","al",".","(","2017",")","[","1","]","and","van","den","Oord","et","al",".","(","2016",")","[","2","]",".","(","https",":","\/\/github.com\/openai\/pixel-cnn",")",".","#","#","#","#","References","[","1","]",":","Tim","Salimans",",","Andrej","Karpathy",",","Xi","Chen",",","and","Diederik","P.","Kingma",".","PixelCNN++",":","Improving","the","PixelCNN","with","Discretized","Logistic","Mixture","Likelihood","and","Other","Modifications",".","In","_International","Conference","on","Learning","Representations_",",","2017.","https",":","\/\/pdfs.semanticscholar.org\/9e90\/6792f67cbdda7b7777b69284a81044857656.pdf","Additional","details","at","https",":","\/\/github.com\/openai\/pixel-cnn","[","2","]",":","Aaron","van","den","Oord",",","Nal","Kalchbrenner",",","Oriol","Vinyals",",","Lasse","Espeholt",",","Alex","Graves",",","and","Koray","Kavukcuoglu",".","Conditional","Image","Generation","with","PixelCNN","Decoders",".","In","_30th","Conference","on","Neural","Information","Processing","Systems_",",","2016.","https",":","\/\/papers.nips.cc\/paper\/6527-conditional-image-generation-with-pixelcnn-decoders.pdf"]
docstr: Initialize the neural network for the Pixel CNN++ distribution.
  
  Args:
    dropout_p: `float`, the dropout probability. Should be between 0 and 1.
    num_resnet: `int`, the number of layers (shown in Figure 2 of [2]) within
      each highest-level block of Figure 2 of [1].
    num_hierarchies: `int`, the number of hightest-level blocks (separated by
      expansions/contractions of dimensions in Figure 2 of [1].)
    num_filters: `int`, the number of convolutional filters.
    num_logistic_mix: `int`, number of components in the logistic mixture
      distribution.
    receptive_field_dims: `tuple`, height and width in pixels of the receptive
      field of the convolutional layers above and to the left of a given
      pixel. The width (second element of the tuple) should be odd. Figure 1
      (middle) of [2] shows a receptive field of (3, 5) (the row containing
      the current pixel is included in the height). The default of (3, 3) was
      used to produce the results in [1].
    resnet_activation: `string`, the type of activation to use in the resnet
      blocks. May be 'concat_elu', 'elu', or 'relu'.
    use_weight_norm: `bool`, if `True` then use weight normalization.
    use_data_init: `bool`, if `True` then use data-dependent initialization
      (has no effect if `use_weight_norm` is `False`).
    dtype: Data type of the layer.
docstr_tok: ["Initialize","the","neural","network","for","the","Pixel","CNN++","distribution",".","Args",":","dropout_p",":","`","float","`",",","the","dropout","probability",".","Should","be","between","0","and","1.","num_resnet",":","`","int","`",",","the","number","of","layers","(","shown","in","Figure","2","of","[","2","]",")","within","each","highest-level","block","of","Figure","2","of","[","1","]",".","num_hierarchies",":","`","int","`",",","the","number","of","hightest-level","blocks","(","separated","by","expansions\/contractions","of","dimensions","in","Figure","2","of","[","1","]",".",")","num_filters",":","`","int","`",",","the","number","of","convolutional","filters",".","num_logistic_mix",":","`","int","`",",","number","of","components","in","the","logistic","mixture","distribution",".","receptive_field_dims",":","`","tuple","`",",","height","and","width","in","pixels","of","the","receptive","field","of","the","convolutional","layers","above","and","to","the","left","of","a","given","pixel",".","The","width","(","second","element","of","the","tuple",")","should","be","odd",".","Figure","1","(","middle",")","of","[","2","]","shows","a","receptive","field","of","(","3",",","5",")","(","the","row","containing","the","current","pixel","is","included","in","the","height",")",".","The","default","of","(","3",",","3",")","was","used","to","produce","the","results","in","[","1","]",".","resnet_activation",":","`","string","`",",","the","type","of","activation","to","use","in","the","resnet","blocks",".","May","be","'concat_elu","'",",","'elu","'",",","or","'relu","'",".","use_weight_norm",":","`","bool","`",",","if","`","True","`","then","use","weight","normalization",".","use_data_init",":","`","bool","`",",","if","`","True","`","then","use","data-dependent","initialization","(","has","no","effect","if","`","use_weight_norm","`","is","`","False","`",")",".","dtype",":","Data","type","of","the","layer","."]
code: def __init__(
      self,
      dropout_p=0.5,
      num_resnet=5,
      num_hierarchies=3,
      num_filters=160,
      num_logistic_mix=10,
      receptive_field_dims=(3, 3),
      resnet_activation="concat_elu",
      use_weight_norm=True,
      use_data_init=True,
      dtype=tf.float32,
  ):
      """Initialize the neural network for the Pixel CNN++ distribution.
  
      Args:
        dropout_p: `float`, the dropout probability. Should be between 0 and 1.
        num_resnet: `int`, the number of layers (shown in Figure 2 of [2]) within
          each highest-level block of Figure 2 of [1].
        num_hierarchies: `int`, the number of hightest-level blocks (separated by
          expansions/contractions of dimensions in Figure 2 of [1].)
        num_filters: `int`, the number of convolutional filters.
        num_logistic_mix: `int`, number of components in the logistic mixture
          distribution.
        receptive_field_dims: `tuple`, height and width in pixels of the receptive
          field of the convolutional layers above and to the left of a given
          pixel. The width (second element of the tuple) should be odd. Figure 1
          (middle) of [2] shows a receptive field of (3, 5) (the row containing
          the current pixel is included in the height). The default of (3, 3) was
          used to produce the results in [1].
        resnet_activation: `string`, the type of activation to use in the resnet
          blocks. May be 'concat_elu', 'elu', or 'relu'.
        use_weight_norm: `bool`, if `True` then use weight normalization.
        use_data_init: `bool`, if `True` then use data-dependent initialization
          (has no effect if `use_weight_norm` is `False`).
        dtype: Data type of the layer.
      """
      super(_PixelCNNNetwork, self).__init__(dtype=dtype)
      self._dropout_p = dropout_p
      self._num_resnet = num_resnet
      self._num_hierarchies = num_hierarchies
      self._num_filters = num_filters
      self._num_logistic_mix = num_logistic_mix
      self._receptive_field_dims = receptive_field_dims
      self._resnet_activation = resnet_activation
  
      if use_weight_norm:
  
          def layer_wrapper(layer):
              def wrapped_layer(*args, **kwargs):
                  return weight_norm.WeightNorm(
                      layer(*args, **kwargs), data_init=use_data_init
                  )
  
              return wrapped_layer
  
          self._layer_wrapper = layer_wrapper
      else:
          self._layer_wrapper = lambda layer: layer
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.distributions import categorical
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import logistic
  from tensorflow_probability.python.distributions import mixture_same_family
  from tensorflow_probability.python.distributions import quantized_distribution
  from tensorflow_probability.python.distributions import transformed_distribution
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import reparameterization
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.layers import weight_norm
label_desc: Use image node_id 1 to create a new _PixelCNNNetwork object from inherited base classes: tf_keras.layers with example: obj = _PixelCNNNetwork(dropout_p, num_resnet, num_hierarchies, num_filters, num_logistic_mix, receptive_field_dims, resnet_activation, use_weight_norm, use_data_init, dtype)