class_docstr: Defines how the inputs, hidden layers, and outputs are connected.
  
  This represents the architecture of a NN by a sequence with this pattern:
  
  (Layer 0)_______
  |InputSelector  |
  |Combiner       | (Node 0)
  |Block__________|
  (Layer 1)_______
  |InputSelector  |
  |Combiner       | (Node 1)
  |Block__________|
  (Layer 2)_______
  |InputSelector  |
  |Combiner       | (Node 2)
  |Block__________|
  (Layer 3)
  .
  .
  .
  (Layer d)
  
  Since every InputSelector has access to all preceding layers, we can represent
  any arbitrary DAG. To obtain the adjacency matrix, we can traverse the
  sequence and concatentate the InputSelectors' outputs.
class_docstr_tok: ["Defines","how","the","inputs",",","hidden","layers",",","and","outputs","are","connected",".","This","represents","the","architecture","of","a","NN","by","a","sequence","with","this","pattern",":","(","Layer","0",")","_______","|InputSelector","|","|Combiner","|","(","Node","0",")","|Block__________|","(","Layer","1",")","_______","|InputSelector","|","|Combiner","|","(","Node","1",")","|Block__________|","(","Layer","2",")","_______","|InputSelector","|","|Combiner","|","(","Node","2",")","|Block__________|","(","Layer","3",")",".",".",".","(","Layer","d",")","Since","every","InputSelector","has","access","to","all","preceding","layers",",","we","can","represent","any","arbitrary","DAG",".","To","obtain","the","adjacency","matrix",",","we","can","traverse","the","sequence","and","concatentate","the","InputSelectors","'","outputs","."]
docstr: Creates the logits for the tower.
  
  Args:
    phoenix_spec: The trial's `phoenix_spec_pb2.PhoenixSpec` proto.
    pre_logits: `tf.Tensor` of the layer before the logits layer.
    dimension: int - the output tensor last axis dimension.
    is_frozen: Whether the tower should be frozen.
    lengths: A tensor of shape [batch] holding the sequence length for a
      sequential problem (rnn).
  
  Returns:
    A LogitsSpec containing the main and auxiliary logits and the architecture
    of the underlying tower.
code: def create_logits_spec(
      self, phoenix_spec, pre_logits, dimension, is_frozen, lengths=None
  ):
      """Creates the logits for the tower.
  
      Args:
        phoenix_spec: The trial's `phoenix_spec_pb2.PhoenixSpec` proto.
        pre_logits: `tf.Tensor` of the layer before the logits layer.
        dimension: int - the output tensor last axis dimension.
        is_frozen: Whether the tower should be frozen.
        lengths: A tensor of shape [batch] holding the sequence length for a
          sequential problem (rnn).
  
      Returns:
        A LogitsSpec containing the main and auxiliary logits and the architecture
        of the underlying tower.
      """
  
      logits_weight = 1.0
      aux_logits = None
      aux_logits_weight = None
      if (
          phoenix_spec.problem_type
          == phoenix_spec_pb2.PhoenixSpec.RNN_ALL_ACTIVATIONS
      ):
          logits = tf.compat.v1.layers.conv1d(
              inputs=pre_logits, filters=dimension, kernel_size=1
          )
      elif (
          phoenix_spec.problem_type
          == phoenix_spec_pb2.PhoenixSpec.RNN_LAST_ACTIVATIONS
      ):
          if lengths is not None:
              logits = utils.last_activations_in_sequence(
                  tf.compat.v1.layers.conv1d(
                      inputs=pre_logits,
                      filters=dimension,
                      kernel_size=1,
                  ),
                  lengths,
              )
          else:
              logging.warning(
                  "Length is missing for rnn_last problem type."
              )
              logits = tf.compat.v1.layers.conv1d(
                  inputs=pre_logits, filters=dimension, kernel_size=1
              )
      elif phoenix_spec.problem_type in (
          phoenix_spec_pb2.PhoenixSpec.CNN,
          phoenix_spec_pb2.PhoenixSpec.DNN,
      ):
          logits = tf.keras.layers.Dense(dimension, name="dense")(
              pre_logits
          )
      else:
          raise ValueError(
              "phoenix_spec.problem_type must be either DNN, CNN, "
              "RNN_LAST_ACTIVATIONS, or RNN_ALL_ACTIVATIONS."
          )
  
      logits = tf.identity(logits, name="logits")
      if aux_logits is not None:
          aux_logits = tf.identity(aux_logits, name="aux_logits")
  
      # TODO(b/172564129): Remove from eval graph.
      if is_frozen:
          logits = tf.stop_gradient(logits)
          if aux_logits is not None:
              aux_logits = tf.stop_gradient(aux_logits)
  
      return architecture_utils.LogitsSpec(
          logits, logits_weight, aux_logits, aux_logits_weight
      )
  
imports: import abc
  import collections
  import enum
  import time
  from absl import logging
  from model_search import block_builder
  from model_search import utils
  from model_search.architecture import architecture_utils
  from model_search.proto import phoenix_spec_pb2
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling the Architecture obj's underlying member method code with example usage: obj.create_logits_spec(phoenix_spec, pre_logits, dimension, is_frozen, lengths) and returns: architecture_utils