class_docstr: Multilayer Perceptron for binary and multi-class classification.
  
  Attributes:
    output_dim: Integer representing the number of classes.
    hidden_sizes: List containing the sizes of the hidden layers.
    activation: An activation function to apply to the output of each hidden
      layer.
    aggregation: String representing an aggregation operation that could be
      applied to the inputs. Valid options: None, `add`. If None, then no
      aggregation is performed. If `add`, the first half of the features
      dimension is added to the second half (see the `_aggregate` function
      for details).
    hidden_aggregation: A tuple or list of integers representing the number of
      hidden units in each layer of the projection network described above.
    is_binary_classification: Boolean specifying if this is model for
      binary classification. If so, it uses a different loss function and
      returns predictions with a single dimension, batch size.
    name: String representing the model name.
class_docstr_tok: ["Multilayer","Perceptron","for","binary","and","multi-class","classification",".","Attributes",":","output_dim",":","Integer","representing","the","number","of","classes",".","hidden_sizes",":","List","containing","the","sizes","of","the","hidden","layers",".","activation",":","An","activation","function","to","apply","to","the","output","of","each","hidden","layer",".","aggregation",":","String","representing","an","aggregation","operation","that","could","be","applied","to","the","inputs",".","Valid","options",":","None",",","`","add","`",".","If","None",",","then","no","aggregation","is","performed",".","If","`","add","`",",","the","first","half","of","the","features","dimension","is","added","to","the","second","half","(","see","the","`","_aggregate","`","function","for","details",")",".","hidden_aggregation",":","A","tuple","or","list","of","integers","representing","the","number","of","hidden","units","in","each","layer","of","the","projection","network","described","above",".","is_binary_classification",":","Boolean","specifying","if","this","is","model","for","binary","classification",".","If","so",",","it","uses","a","different","loss","function","and","returns","predictions","with","a","single","dimension",",","batch","size",".","name",":","String","representing","the","model","name","."]
docstr: Creates all hidden layers of the model, before the prediction layer.
  
  Args:
    inputs: A tensor containing the model inputs. The first dimension is the
      batch size.
  
  Returns:
    A tuple containing the encoded representation of the inputs and a
    dictionary of regularization parameters.
docstr_tok: ["Creates","all","hidden","layers","of","the","model",",","before","the","prediction","layer",".","Args",":","inputs",":","A","tensor","containing","the","model","inputs",".","The","first","dimension","is","the","batch","size",".","Returns",":","A","tuple","containing","the","encoded","representation","of","the","inputs","and","a","dictionary","of","regularization","parameters","."]
code: def _construct_layers(self, inputs):
      """Creates all hidden layers of the model, before the prediction layer.
  
      Args:
        inputs: A tensor containing the model inputs. The first dimension is the
          batch size.
  
      Returns:
        A tuple containing the encoded representation of the inputs and a
        dictionary of regularization parameters.
      """
      reg_params = {}
      # Reshape inputs in case they are not of shape (batch_size, features).
      num_features = np.prod(inputs.shape[1:])
      inputs = tf.reshape(inputs, [-1, num_features])
      hidden = inputs
      for layer_index, output_size in enumerate(self.hidden_sizes):
          input_size = hidden.get_shape().dims[-1].value
          weights_name = "W_" + str(layer_index)
          weights = tf.get_variable(
              name=weights_name,
              initializer=glorot((input_size, output_size)),
              use_resource=True,
          )
          reg_params[weights_name] = weights
          biases = tf.get_variable(
              "b_" + str(layer_index),
              initializer=tf.zeros([output_size], dtype=tf.float32),
              use_resource=True,
          )
          hidden = self.activation(
              tf.nn.xw_plus_b(hidden, weights, biases)
          )
      return hidden, reg_params
  
file_path: neural-structured-learning/research/gam/gam/models/mlp.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from .models_base import glorot
  from .models_base import Model
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling the MLP obj's underlying member method code with example usage: obj._construct_layers(inputs) and returns: hidden,  reg_params