class_docstr: An AdaNet subnetwork.
  
  In the AdaNet paper, an :class:`adanet.subnetwork.Subnetwork` is are called a
  *subnetwork*, and indicated by *h*. A collection of weighted subnetworks form
  an AdaNet ensemble.
  
  Args:
    last_layer: :class:`tf.Tensor` output or dict of string to
      :class:`tf.Tensor` outputs (for multi-head) of the last layer of the
      subnetwork, i.e the layer before the logits layer. When the mixture weight
      type is :class:`MATRIX`, the AdaNet algorithm takes care of computing
      ensemble mixture weights matrices (one per subnetwork) that multiply the
      various last layers of the ensemble's subnetworks, and regularize them
      using their subnetwork's complexity. This field is represented by *h* in
      the AdaNet paper.
    logits: :class:`tf.Tensor` logits or dict of string to :class:`tf.Tensor`
      logits (for multi-head) for training the subnetwork. These logits are not
      used in the ensemble's outputs if the mixture weight type is
      :class:`MATRIX`, instead AdaNet learns its own logits (mixture weights)
      from the subnetwork's `last_layers` with complexity regularization. The
      logits are used in the ensemble only when the mixture weights type is
      :class:`SCALAR` or :class:`VECTOR`. Even though the logits are not used
      in the ensemble in some cases, they should always be supplied as adanet
      uses the logits to train the subnetworks.
    complexity: A scalar :class:`tf.Tensor` representing the complexity of the
      subnetwork's architecture. It is used for choosing the best subnetwork at
      each iteration, and for regularizing the weighted outputs of more complex
      subnetworks.
    persisted_tensors: DEPRECATED. See `shared`. Optional nested dictionary of
      string to :class:`tf.Tensor` to persist across iterations. At the end of
      an iteration, the :class:`tf.Tensor` instances will be available to
      subnetworks in the next iterations, whereas others that are not part of
      the `Subnetwork` will be pruned. This allows later
      :class:`adanet.subnetwork.Subnetwork` instances to dynamically build
      upon arbitrary :class:`tf.Tensors` from previous
      :class:`adanet.subnetwork.Subnetwork` instances.
    shared: Optional Python object(s), primitive(s), or function(s) to share
      with subnetworks within the same iteration or in future iterations.
    local_init_ops: Iterable of :class:`tf.Operation` objects to run to
      initialize local variables.
  
  Returns:
    A validated :class:`adanet.subnetwork.Subnetwork` object.
  
  Raises:
    ValueError: If last_layer is None.
    ValueError: If logits is None.
    ValueError: If logits is a dict but last_layer is not.
    ValueError: If last_layer is a dict but logits is not.
    ValueError: If complexity is None.
    ValueError: If persisted_tensors is present but not a dictionary.
    ValueError: If persisted_tensors contains an empty nested dictionary.
class_docstr_tok: ["An","AdaNet","subnetwork",".","In","the","AdaNet","paper",",","an",":","class",":","`","adanet.subnetwork.Subnetwork","`","is","are","called","a","*","subnetwork","*",",","and","indicated","by","*","h","*",".","A","collection","of","weighted","subnetworks","form","an","AdaNet","ensemble",".","Args",":","last_layer",":",":","class",":","`","tf.Tensor","`","output","or","dict","of","string","to",":","class",":","`","tf.Tensor","`","outputs","(","for","multi-head",")","of","the","last","layer","of","the","subnetwork",",","i.e","the","layer","before","the","logits","layer",".","When","the","mixture","weight","type","is",":","class",":","`","MATRIX","`",",","the","AdaNet","algorithm","takes","care","of","computing","ensemble","mixture","weights","matrices","(","one","per","subnetwork",")","that","multiply","the","various","last","layers","of","the","ensemble","'s","subnetworks",",","and","regularize","them","using","their","subnetwork","'s","complexity",".","This","field","is","represented","by","*","h","*","in","the","AdaNet","paper",".","logits",":",":","class",":","`","tf.Tensor","`","logits","or","dict","of","string","to",":","class",":","`","tf.Tensor","`","logits","(","for","multi-head",")","for","training","the","subnetwork",".","These","logits","are","not","used","in","the","ensemble","'s","outputs","if","the","mixture","weight","type","is",":","class",":","`","MATRIX","`",",","instead","AdaNet","learns","its","own","logits","(","mixture","weights",")","from","the","subnetwork","'s","`","last_layers","`","with","complexity","regularization",".","The","logits","are","used","in","the","ensemble","only","when","the","mixture","weights","type","is",":","class",":","`","SCALAR","`","or",":","class",":","`","VECTOR","`",".","Even","though","the","logits","are","not","used","in","the","ensemble","in","some","cases",",","they","should","always","be","supplied","as","adanet","uses","the","logits","to","train","the","subnetworks",".","complexity",":","A","scalar",":","class",":","`","tf.Tensor","`","representing","the","complexity","of","the","subnetwork","'s","architecture",".","It","is","used","for","choosing","the","best","subnetwork","at","each","iteration",",","and","for","regularizing","the","weighted","outputs","of","more","complex","subnetworks",".","persisted_tensors",":","DEPRECATED",".","See","`","shared","`",".","Optional","nested","dictionary","of","string","to",":","class",":","`","tf.Tensor","`","to","persist","across","iterations",".","At","the","end","of","an","iteration",",","the",":","class",":","`","tf.Tensor","`","instances","will","be","available","to","subnetworks","in","the","next","iterations",",","whereas","others","that","are","not","part","of","the","`","Subnetwork","`","will","be","pruned",".","This","allows","later",":","class",":","`","adanet.subnetwork.Subnetwork","`","instances","to","dynamically","build","upon","arbitrary",":","class",":","`","tf.Tensors","`","from","previous",":","class",":","`","adanet.subnetwork.Subnetwork","`","instances",".","shared",":","Optional","Python","object","(","s",")",",","primitive","(","s",")",",","or","function","(","s",")","to","share","with","subnetworks","within","the","same","iteration","or","in","future","iterations",".","local_init_ops",":","Iterable","of",":","class",":","`","tf.Operation","`","objects","to","run","to","initialize","local","variables",".","Returns",":","A","validated",":","class",":","`","adanet.subnetwork.Subnetwork","`","object",".","Raises",":","ValueError",":","If","last_layer","is","None",".","ValueError",":","If","logits","is","None",".","ValueError",":","If","logits","is","a","dict","but","last_layer","is","not",".","ValueError",":","If","last_layer","is","a","dict","but","logits","is","not",".","ValueError",":","If","complexity","is","None",".","ValueError",":","If","persisted_tensors","is","present","but","not","a","dictionary",".","ValueError",":","If","persisted_tensors","contains","an","empty","nested","dictionary","."]
code: def __new__(
      cls,
      last_layer,
      logits,
      complexity,
      persisted_tensors=None,
      shared=None,
      local_init_ops=None,
  ):
      if last_layer is None:
          raise ValueError("last_layer not provided")
      if logits is None:
          raise ValueError("logits not provided")
      if isinstance(logits, dict) and not isinstance(last_layer, dict):
          raise ValueError(
              "if logits is a dict last_layer must also be a dict"
          )
      if isinstance(last_layer, dict) and not isinstance(logits, dict):
          raise ValueError(
              "if last_layer is a dict logits must also be a dict"
          )
      if complexity is None:
          raise ValueError("complexity not provided")
      if persisted_tensors is not None:
          if not isinstance(persisted_tensors, dict):
              raise ValueError("persisted_tensors must be a dict")
          _validate_nested_persisted_tensors(persisted_tensors)
      local_init_ops = tuple(local_init_ops) if local_init_ops else ()
      return super(Subnetwork, cls).__new__(
          cls,
          last_layer=last_layer,
          logits=logits,
          complexity=complexity,
          persisted_tensors=persisted_tensors,
          shared=shared,
          local_init_ops=local_init_ops,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import collections
  import six
label_desc: Use image node_id 1 for calling the Subnetwork obj's underlying member method code with example usage: obj.__new__(cls, last_layer, logits, complexity, persisted_tensors, shared, local_init_ops) and returns: super