class_docstr: A densely connected layer that uses tf.einsum as the backing computation.
  
  This layer can perform einsum calculations of arbitrary dimensionality.
  
  Attributes:
    output_shape: Positive integer or tuple, dimensionality of the output space.
    num_summed_dimensions: The number of dimensions to sum over. Standard 2D
      matmul should use 1, 3D matmul should use 2, and so forth.
    activation: Activation function to use. If you don't specify anything, no
      activation is applied
      (ie. "linear" activation: `a(x) = x`).
    use_bias: Boolean, whether the layer uses a bias vector.
    kernel_initializer: Initializer for the `kernel` weights matrix.
    bias_initializer: Initializer for the bias vector.
    kernel_regularizer: Regularizer function applied to the `kernel` weights
      matrix.
    bias_regularizer: Regularizer function applied to the bias vector.
    activity_regularizer: Regularizer function applied to the output of the
      layer (its "activation")..
    kernel_constraint: Constraint function applied to the `kernel` weights
      matrix.
    bias_constraint: Constraint function applied to the bias vector.
  Input shape:
    N-D tensor with shape: `(batch_size, ..., input_dim)`. The most common
      situation would be a 2D input with shape `(batch_size, input_dim)`.
  Output shape:
    N-D tensor with shape: `(batch_size, ..., units)`. For instance, for a 2D
      input with shape `(batch_size, input_dim)`, the output would have shape
      `(batch_size, units)`.
code: def build(self, input_shape):
      input_shape = tf.TensorShape(input_shape)
      input_rank = input_shape.rank
      free_input_dims = input_rank - self._num_summed_dimensions
      output_dims = len(self._output_shape)
  
      self._einsum_string = self._build_einsum_string(
          free_input_dims, self._num_summed_dimensions, output_dims
      )
  
      # This is only saved for testing purposes.
      self._kernel_shape = input_shape[free_input_dims:].concatenate(
          self._output_shape
      )
  
      self._kernel = self.add_weight(
          "kernel",
          shape=self._kernel_shape,
          initializer=self._kernel_initializer,
          regularizer=self._kernel_regularizer,
          constraint=self._kernel_constraint,
          dtype=self.dtype,
          trainable=True,
      )
      if self._use_bias:
          self._bias = self.add_weight(
              "bias",
              shape=self._output_shape,
              initializer=self._bias_initializer,
              regularizer=self._bias_regularizer,
              constraint=self._bias_constraint,
              dtype=self.dtype,
              trainable=True,
          )
      else:
          self._bias = None
      super(DenseEinsum, self).build(input_shape)
  
file_path: autodist/examples/benchmark/utils/modeling/layers/dense_einsum.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
label_desc: Use image node_id 3 for calling the DenseEinsum obj's underlying member method code with example usage: obj.build(input_shape) without return types