class_docstr: Basic affine layer.
class_docstr_tok: ["Basic","affine","layer","."]
docstr: Constructs layer.
  
  Args:
    input_size: ...
    output_size: ...
    kernel_initializer: ...
      Default value: `None` (i.e.,
      `tfp.experimental.nn.initializers.glorot_uniform()`).
    bias_initializer: ...
      Default value: `None` (i.e., `tf_keras.initializers.zeros()`).
    make_kernel_bias_fn: ...
      Default value: `tfp.experimental.nn.util.make_kernel_bias`.
    dtype: ...
      Default value: `tf.float32`.
    batch_shape: ...
      Default value: `()`.
    activation_fn: ...
      Default value: `None`.
    name: ...
      Default value: `None` (i.e., `'Affine'`).
docstr_tok: ["Constructs","layer",".","Args",":","input_size",":","...","output_size",":","...","kernel_initializer",":","...","Default","value",":","`","None","`","(","i.e.",",","`","tfp.experimental.nn.initializers.glorot_uniform","(",")","`",")",".","bias_initializer",":","...","Default","value",":","`","None","`","(","i.e.",",","`","tf_keras.initializers.zeros","(",")","`",")",".","make_kernel_bias_fn",":","...","Default","value",":","`","tfp.experimental.nn.util.make_kernel_bias","`",".","dtype",":","...","Default","value",":","`","tf.float32","`",".","batch_shape",":","...","Default","value",":","`","(",")","`",".","activation_fn",":","...","Default","value",":","`","None","`",".","name",":","...","Default","value",":","`","None","`","(","i.e.",",","`","'Affine","'","`",")","."]
code: def __init__(
      self,
      input_size,
      output_size,
      # Weights
      kernel_initializer=None,  # tfp.nn.initializers.glorot_uniform()
      bias_initializer=None,  # tf_keras.initializers.zeros()
      make_kernel_bias_fn=kernel_bias_lib.make_kernel_bias,
      dtype=tf.float32,
      batch_shape=(),
      # Misc
      activation_fn=None,
      name=None,
  ):
      """Constructs layer.
  
      Args:
        input_size: ...
        output_size: ...
        kernel_initializer: ...
          Default value: `None` (i.e.,
          `tfp.experimental.nn.initializers.glorot_uniform()`).
        bias_initializer: ...
          Default value: `None` (i.e., `tf_keras.initializers.zeros()`).
        make_kernel_bias_fn: ...
          Default value: `tfp.experimental.nn.util.make_kernel_bias`.
        dtype: ...
          Default value: `tf.float32`.
        batch_shape: ...
          Default value: `()`.
        activation_fn: ...
          Default value: `None`.
        name: ...
          Default value: `None` (i.e., `'Affine'`).
      """
      batch_shape = (
          tf.constant([], dtype=tf.int32)
          if batch_shape is None
          else ps.cast(ps.reshape(batch_shape, shape=[-1]), tf.int32)
      )
      batch_ndims = ps.size(batch_shape)
      kernel_shape = ps.concat(
          [batch_shape, [input_size, output_size]], axis=0
      )
      bias_shape = ps.concat([batch_shape, [output_size]], axis=0)
      apply_kernel_fn = lambda x, k: tf.matmul(
          x[..., tf.newaxis, :], k
      )[
          ..., 0, :
      ]  # pylint-disable=long-lambda
      kernel, bias = make_kernel_bias_fn(
          kernel_shape,
          bias_shape,
          kernel_initializer,
          bias_initializer,
          batch_ndims,
          batch_ndims,
          dtype,
      )
      self._make_kernel_bias_fn = make_kernel_bias_fn  # For tracking.
      super(Affine, self).__init__(
          kernel=kernel,
          bias=bias,
          apply_kernel_fn=apply_kernel_fn,
          activation_fn=activation_fn,
          dtype=dtype,
          name=name,
      )
  
imports: import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.experimental.nn import layers
  from tensorflow_probability.python.experimental.nn import variational_base
  from tensorflow_probability.python.experimental.nn.util import kernel_bias
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 1 to create a new Affine object from inherited base classes: layers_lib with example: obj = Affine(input_size, output_size, kernel_initializer, bias_initializer, make_kernel_bias_fn, dtype, batch_shape, activation_fn, name)