class_docstr: Convolutional Neural Network for image classification.
  
  It assumes the inputs are images of shape width x height x channels.
  The precise architecture follows the Tensorflow CNN
  tutorial at https://www.tensorflow.org/tutorials/images/deep_cnn.
  Note that this CNN works both for the agreement and classification models.
  In the agreement case, the provided inputs will be a tuple
  (inputs_src, inputs_target), which are aggregated into one input after the
  convolution layers, right before the fully connected network that makes the
  final prediction.
  
  Attributes:
    output_dim: Integer representing the number of classes.
    channels: Integer representing the number of channels in the input images
      (e.g., 1 for black and white, 3 for RGB).
    aggregation: String representing an aggregation operation, that is applied
      on the two inputs of the agreement model, after they are encoded through
      the convolution layers. See superclass attributes for details.
    activation: An activation function to be applied to the outputs of each
      fully connected layer of the aggregation network.
    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: ["Convolutional","Neural","Network","for","image","classification",".","It","assumes","the","inputs","are","images","of","shape","width","x","height","x","channels",".","The","precise","architecture","follows","the","Tensorflow","CNN","tutorial","at","https",":","\/\/www.tensorflow.org\/tutorials\/images\/deep_cnn",".","Note","that","this","CNN","works","both","for","the","agreement","and","classification","models",".","In","the","agreement","case",",","the","provided","inputs","will","be","a","tuple","(","inputs_src",",","inputs_target",")",",","which","are","aggregated","into","one","input","after","the","convolution","layers",",","right","before","the","fully","connected","network","that","makes","the","final","prediction",".","Attributes",":","output_dim",":","Integer","representing","the","number","of","classes",".","channels",":","Integer","representing","the","number","of","channels","in","the","input","images","(","e.g.",",","1","for","black","and","white",",","3","for","RGB",")",".","aggregation",":","String","representing","an","aggregation","operation",",","that","is","applied","on","the","two","inputs","of","the","agreement","model",",","after","they","are","encoded","through","the","convolution","layers",".","See","superclass","attributes","for","details",".","activation",":","An","activation","function","to","be","applied","to","the","outputs","of","each","fully","connected","layer","of","the","aggregation","network",".","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 the model hidden representations and prediction ops.
  
  For this model, the hidden representation is the last layer
  before the logit computation. The predictions are unnormalized logits.
  
  Args:
    inputs: A tensor containing the model inputs. The first dimension is the
      batch size.
    **unused_kwargs: Other unused keyword arguments.
  
  Returns:
    encoding: A tensor containing an encoded batch of samples. The first
      dimension corresponds to the batch size.
    all_vars: A dictionary mapping from variable name to TensorFlow op
      containing all variables used in this model.
    reg_params: A dictionary mapping from a variable name to a Tensor of
      parameters which will be used for regularization.
docstr_tok: ["Creates","the","model","hidden","representations","and","prediction","ops",".","For","this","model",",","the","hidden","representation","is","the","last","layer","before","the","logit","computation",".","The","predictions","are","unnormalized","logits",".","Args",":","inputs",":","A","tensor","containing","the","model","inputs",".","The","first","dimension","is","the","batch","size",".","*","*","unused_kwargs",":","Other","unused","keyword","arguments",".","Returns",":","encoding",":","A","tensor","containing","an","encoded","batch","of","samples",".","The","first","dimension","corresponds","to","the","batch","size",".","all_vars",":","A","dictionary","mapping","from","variable","name","to","TensorFlow","op","containing","all","variables","used","in","this","model",".","reg_params",":","A","dictionary","mapping","from","a","variable","name","to","a","Tensor","of","parameters","which","will","be","used","for","regularization","."]
code: def get_encoding_and_params(self, inputs, **unused_kwargs):
      """Creates the model hidden representations and prediction ops.
  
      For this model, the hidden representation is the last layer
      before the logit computation. The predictions are unnormalized logits.
  
      Args:
        inputs: A tensor containing the model inputs. The first dimension is the
          batch size.
        **unused_kwargs: Other unused keyword arguments.
  
      Returns:
        encoding: A tensor containing an encoded batch of samples. The first
          dimension corresponds to the batch size.
        all_vars: A dictionary mapping from variable name to TensorFlow op
          containing all variables used in this model.
        reg_params: A dictionary mapping from a variable name to a Tensor of
          parameters which will be used for regularization.
      """
      # Build layers.
      with tf.variable_scope(self.name):
          if isinstance(inputs, (list, tuple)):
              # If we have multiple inputs (e.g., in the case of the agreement model),
              # split into left and right inputs, compute the hidden representation of
              # each branch, then aggregate.
              left = inputs[0]
              right = inputs[1]
              with tf.variable_scope("encoding"):
                  hidden1, reg_params = self._construct_layers(left)
              with tf.variable_scope("encoding", reuse=True):
                  hidden2, _ = self._construct_layers(right)
              hidden = self._aggregate((hidden1, hidden2))
          else:
              with tf.variable_scope("encoding"):
                  hidden, reg_params = self._construct_layers(inputs)
  
          # Store model variables for easy access.
          variables = tf.get_collection(
              tf.GraphKeys.GLOBAL_VARIABLES,
              scope=tf.get_default_graph().get_name_scope(),
          )
          all_vars = {var.name: var for var in variables}
  
      return hidden, all_vars, reg_params
  
file_path: neural-structured-learning/research/gam/gam/models/cnn.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from .models_base import Model
  import tensorflow
label_desc: Use image node_id 3 for calling the ImageCNNAgreement obj's underlying member method code with example usage: obj.get_encoding_and_params(inputs) and returns: hidden,  all_vars,  reg_params