parameters: (self,
                            features,
                            mode,
                            labels=None,
                            train_op_fn=None,
                            logits=None,
                            logits_input=None,
                            scope=None)
docstring: See `_Head.create_model_fn_ops`.
  
      Args:
        features: Input `dict` of `Tensor` objects.
        mode: Estimator's `ModeKeys`.
        labels: Labels `Tensor`, or `dict` of same.
        train_op_fn: Function that takes a scalar loss and returns an op to
            optimize with the loss.
        logits: Concatenated logits for all heads or a dict of head name to logits
            tensor. If concatenated logits, it should have (batchsize, x) shape
            where x is the sum of `logits_dimension` of all the heads,
            i.e., same as `logits_dimension` of this class. create_model_fn_ops
            will split the logits tensor and pass logits of proper size to each
            head. This is useful if we want to be agnostic about whether you
            creating a single versus multihead. logits can also be a dict for
            convenience where you are creating the head specific logits explicitly
            and don't want to concatenate them yourself.
        logits_input: tensor to build logits from.
        scope: Optional scope for variable_scope. If provided, will be passed to
          all heads. Most users will want to set this to `None`, so each head
          constructs a separate variable_scope according to its `head_name`.
  
      Returns:
        `ModelFnOps`.
  
      Raises:
        ValueError: if `mode` is not recognized, or neither or both of `logits`
            and `logits_input` is provided.
docstring_summary: See `_Head.create_model_fn_ops`.
docstring_tokens: See _Head . create_model_fn_ops .
function: def create_model_fn_ops(self,
                            features,
                            mode,
                            labels=None,
                            train_op_fn=None,
                            logits=None,
                            logits_input=None,
                            scope=None):
      """See `_Head.create_model_fn_ops`.
  
      Args:
        features: Input `dict` of `Tensor` objects.
        mode: Estimator's `ModeKeys`.
        labels: Labels `Tensor`, or `dict` of same.
        train_op_fn: Function that takes a scalar loss and returns an op to
            optimize with the loss.
        logits: Concatenated logits for all heads or a dict of head name to logits
            tensor. If concatenated logits, it should have (batchsize, x) shape
            where x is the sum of `logits_dimension` of all the heads,
            i.e., same as `logits_dimension` of this class. create_model_fn_ops
            will split the logits tensor and pass logits of proper size to each
            head. This is useful if we want to be agnostic about whether you
            creating a single versus multihead. logits can also be a dict for
            convenience where you are creating the head specific logits explicitly
            and don't want to concatenate them yourself.
        logits_input: tensor to build logits from.
        scope: Optional scope for variable_scope. If provided, will be passed to
          all heads. Most users will want to set this to `None`, so each head
          constructs a separate variable_scope according to its `head_name`.
  
      Returns:
        `ModelFnOps`.
  
      Raises:
        ValueError: if `mode` is not recognized, or neither or both of `logits`
            and `logits_input` is provided.
      """
      _check_mode_valid(mode)
      all_model_fn_ops = []
      if logits is None:
        # Use logits_input.
        for head in self._heads:
          all_model_fn_ops.append(
              head.create_model_fn_ops(
                  features=features,
                  mode=mode,
                  labels=labels,
                  train_op_fn=no_op_train_fn,
                  logits_input=logits_input,
                  scope=scope))
      else:
        head_logits_pairs = []
        if isinstance(logits, dict):
          head_logits_pairs = []
          for head in self._heads:
            if isinstance(head, _LossOnlyHead):
              head_logits_pairs.append((head, None))
            else:
              head_logits_pairs.append((head, logits[head.head_name]))
        else:
          # Split logits for each head.
          head_logits_pairs = zip(self._heads, self._split_logits(logits))
  
        for head, head_logits in head_logits_pairs:
          all_model_fn_ops.append(
              head.create_model_fn_ops(
                  features=features,
                  mode=mode,
                  labels=labels,
                  train_op_fn=no_op_train_fn,
                  logits=head_logits,
                  scope=scope))
  
      if mode == model_fn.ModeKeys.TRAIN:
        if train_op_fn is None:
          raise ValueError("train_op_fn can not be None in TRAIN mode.")
        return self._merge_train(all_model_fn_ops, train_op_fn)
      if mode == model_fn.ModeKeys.INFER:
        return self._merge_infer(all_model_fn_ops)
      if mode == model_fn.ModeKeys.EVAL:
        return self._merge_eval(all_model_fn_ops)
      raise ValueError("mode=%s unrecognized" % str(mode))
function_tokens: def create_model_fn_ops ( self , features , mode , labels = None , train_op_fn = None , logits = None , logits_input = None , scope = None ) : _check_mode_valid ( mode ) all_model_fn_ops = [ ] if logits is None : # Use logits_input. for head in self . _heads : all_model_fn_ops . append ( head . create_model_fn_ops ( features = features , mode = mode , labels = labels , train_op_fn = no_op_train_fn , logits_input = logits_input , scope = scope ) ) else : head_logits_pairs = [ ] if isinstance ( logits , dict ) : head_logits_pairs = [ ] for head in self . _heads : if isinstance ( head , _LossOnlyHead ) : head_logits_pairs . append ( ( head , None ) ) else : head_logits_pairs . append ( ( head , logits [ head . head_name ] ) ) else : # Split logits for each head. head_logits_pairs = zip ( self . _heads , self . _split_logits ( logits ) ) for head , head_logits in head_logits_pairs : all_model_fn_ops . append ( head . create_model_fn_ops ( features = features , mode = mode , labels = labels , train_op_fn = no_op_train_fn , logits = head_logits , scope = scope ) ) if mode == model_fn . ModeKeys . TRAIN : if train_op_fn is None : raise ValueError ( "train_op_fn can not be None in TRAIN mode." ) return self . _merge_train ( all_model_fn_ops , train_op_fn ) if mode == model_fn . ModeKeys . INFER : return self . _merge_infer ( all_model_fn_ops ) if mode == model_fn . ModeKeys . EVAL : return self . _merge_eval ( all_model_fn_ops ) raise ValueError ( "mode=%s unrecognized" % str ( mode ) )