class_docstr: Single block for a glow model.
  
  This bijector contains `num_steps` steps of the flow, each consisting of an
  actnorm-OneByOneConv-RealNVP chain of bijectors. Use of actnorm is optional
  and the RealNVP behavior is controlled by the coupling_bijector_fn, which
  implements a function (e.g. deep neural network) to dictate the behavior of
  the flow. A default (GlowDefaultNetwork) function is provided.
class_docstr_tok: ["Single","block","for","a","glow","model",".","This","bijector","contains","`","num_steps","`","steps","of","the","flow",",","each","consisting","of","an","actnorm-OneByOneConv-RealNVP","chain","of","bijectors",".","Use","of","actnorm","is","optional","and","the","RealNVP","behavior","is","controlled","by","the","coupling_bijector_fn",",","which","implements","a","function","(","e.g",".","deep","neural","network",")","to","dictate","the","behavior","of","the","flow",".","A","default","(","GlowDefaultNetwork",")","function","is","provided","."]
code: def __init__(
      self,
      input_shape,
      num_steps,
      coupling_bijector_fn,
      use_actnorm,
      seedstream,
  ):
      parameters = dict(locals())
      rnvp_block = [identity.Identity()]
      this_nchan = input_shape[-1]
  
      for j in range(num_steps):  # pylint: disable=unused-variable
          this_layer_input_shape = input_shape[:-1] + (
              input_shape[-1] // 2,
          )
          this_layer = coupling_bijector_fn(this_layer_input_shape)
          bijector_fn = self.make_bijector_fn(this_layer)
  
          # For each step in the block, we do (optional) actnorm, followed
          # by an invertible 1x1 convolution, then affine coupling.
          this_rnvp = invert.Invert(
              real_nvp.RealNVP(this_nchan // 2, bijector_fn=bijector_fn)
          )
  
          # Append the layer to the realNVP bijector for variable tracking.
          this_rnvp.coupling_bijector_layer = this_layer
          rnvp_block.append(this_rnvp)
  
          rnvp_block.append(
              invert.Invert(
                  OneByOneConv(
                      this_nchan,
                      seed=seedstream(),
                      dtype=dtype_util.common_dtype(
                          this_rnvp.variables, dtype_hint=tf.float32
                      ),
                  )
              )
          )
  
          if use_actnorm:
              rnvp_block.append(
                  ActivationNormalization(
                      this_nchan,
                      dtype=dtype_util.common_dtype(
                          this_rnvp.variables, dtype_hint=tf.float32
                      ),
                  )
              )
  
      # Note that we reverse the list since Chain applies bijectors in reverse
      # order.
      super(GlowBlock, self).__init__(
          chain.Chain(rnvp_block[::-1]),
          parameters=parameters,
          name="glow_block",
      )
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.bijectors import bijector
  from tensorflow_probability.python.bijectors import blockwise
  from tensorflow_probability.python.bijectors import chain
  from tensorflow_probability.python.bijectors import composition
  from tensorflow_probability.python.bijectors import exp
  from tensorflow_probability.python.bijectors import identity
  from tensorflow_probability.python.bijectors import invert
  from tensorflow_probability.python.bijectors import real_nvp
  from tensorflow_probability.python.bijectors import reshape
  from tensorflow_probability.python.bijectors import scale
  from tensorflow_probability.python.bijectors import scale_matvec_lu
  from tensorflow_probability.python.bijectors import shift
  from tensorflow_probability.python.bijectors import transpose
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.util.deferred_tensor import TransformedVariable
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 1 to create a new GlowBlock object from inherited base classes: composition with example: obj = GlowBlock(input_shape, num_steps, coupling_bijector_fn, use_actnorm, seedstream)