class_docstr: Superclass for models used for the classification or agreement model.
  
  Attributes:
    aggregation: A string representing the way to aggregate two inputs provided
      in the function `_aggregate`. This is designed for the agreement model,
      where the source and target inputs need to be integrated. The allowed
      options are the following:
        None: no aggregation is performed.
        - `add`: the two inputs are added
        - `dist`: squared distance between the two inputs, elementwise.
        - `concat`: the two inputs are concatenated along axis=1.
        - `project_add`: the two inputs are first projected to a different space
          using a fully connected network with the hidden units provided in
          hidden_aggregation, and followed by the activation function in
          activation. Then the projected inputs are added, like in `add`.
        - `project_dist`: The two inputs are projected as in `project_add`,
          followed by a distance calculation like in `dist`.
        - `project_concat`: The two inputs are projected as in `project_add`,
          followed by a concatenation like in `concat`.
    hidden_aggregation: A tuple or list of integers representing the number of
      hidden units in each layer of the projection network described above.
    activation: An activation function to be applied to the outputs of each
      fully connected layer of the aggregation multilayer perceptron.
docstr: Projects the provided inputs using a multilayer perceptron.
  
  Args:
    inputs: A batch of features whose first dimension is the batch size.
    reuse: A boolean specifying whether to reuse the same projection weights
      or create new ones.
  
  Returns:
    Projected inputs, having the same batch size as the first dimension.
docstr_tok: ["Projects","the","provided","inputs","using","a","multilayer","perceptron",".","Args",":","inputs",":","A","batch","of","features","whose","first","dimension","is","the","batch","size",".","reuse",":","A","boolean","specifying","whether","to","reuse","the","same","projection","weights","or","create","new","ones",".","Returns",":","Projected","inputs",",","having","the","same","batch","size","as","the","first","dimension","."]
code: def _project(self, inputs, reuse=tf.compat.v1.AUTO_REUSE):
      """Projects the provided inputs using a multilayer perceptron.
  
      Args:
        inputs: A batch of features whose first dimension is the batch size.
        reuse: A boolean specifying whether to reuse the same projection weights
          or create new ones.
  
      Returns:
        Projected inputs, having the same batch size as the first dimension.
      """
      with tf.variable_scope("aggregation", reuse=reuse):
          # Reshape inputs in case they have more than 2 dimensions.
          num_features = inputs.get_shape().dims[1:]
          num_features = np.prod([f.value for f in num_features])
          if len(inputs.shape) > 2:
              inputs = tf.reshape(inputs, [-1, num_features])
          # Create the fully connected layers.
          hidden = inputs
          for layer_index, num_units in enumerate(
              self.hidden_aggregation
          ):
              input_size = hidden.get_shape().dims[-1].value
              weights = tf.get_variable(
                  "W_" + str(layer_index),
                  initializer=glorot((input_size, num_units)),
                  use_resource=True,
              )
              bias = tf.get_variable(
                  "b_" + str(layer_index),
                  shape=(num_units,),
                  initializer=tf.zeros_initializer(),
                  use_resource=True,
              )
              hidden = self.activation(
                  tf.nn.xw_plus_b(hidden, weights, bias)
              )
          return hidden
  
file_path: neural-structured-learning/research/gam/gam/models/models_base.py
imports: import abc
  import logging
  import numpy
  import tensorflow
label_desc: Use image node_id 9 for calling the Model obj's underlying member method code with example usage: obj._project(inputs, reuse) and returns: hidden