parameters: (
        self,
        op_type,
        inputs,
        dtypes,  # pylint: disable=redefined-outer-name
        input_types=None,
        name=None,
        attrs=None,
        op_def=None,
        compute_shapes=True,
        compute_device=True)
return_statement: return ret
docstring: Creates an `Operation` in this graph.
  
      This is a low-level interface for creating an `Operation`. Most
      programs will not call this method directly, and instead use the
      Python op constructors, such as `tf.constant()`, which add ops to
      the default graph.
  
      Args:
        op_type: The `Operation` type to create. This corresponds to the
          `OpDef.name` field for the proto that defines the operation.
        inputs: A list of `Tensor` objects that will be inputs to the `Operation`.
        dtypes: A list of `DType` objects that will be the types of the tensors
          that the operation produces.
        input_types: (Optional.) A list of `DType`s that will be the types of
          the tensors that the operation consumes. By default, uses the base
          `DType` of each input in `inputs`. Operations that expect
          reference-typed inputs must specify `input_types` explicitly.
        name: (Optional.) A string name for the operation. If not specified, a
          name is generated based on `op_type`.
        attrs: (Optional.) A dictionary where the key is the attribute name (a
          string) and the value is the respective `attr` attribute of the
          `NodeDef` proto that will represent the operation (an `AttrValue`
          proto).
        op_def: (Optional.) The `OpDef` proto that describes the `op_type` that
          the operation will have.
        compute_shapes: (Optional.) If True, shape inference will be performed
          to compute the shapes of the outputs.
        compute_device: (Optional.) If True, device functions will be executed
          to compute the device property of the Operation.
  
      Raises:
        TypeError: if any of the inputs is not a `Tensor`.
        ValueError: if colocation conflicts with existing device assignment.
  
      Returns:
        An `Operation` object.
docstring_summary: Creates an `Operation` in this graph.
docstring_tokens: Creates an Operation in this graph .
function: def create_op(
        self,
        op_type,
        inputs,
        dtypes,  # pylint: disable=redefined-outer-name
        input_types=None,
        name=None,
        attrs=None,
        op_def=None,
        compute_shapes=True,
        compute_device=True):
      """Creates an `Operation` in this graph.
  
      This is a low-level interface for creating an `Operation`. Most
      programs will not call this method directly, and instead use the
      Python op constructors, such as `tf.constant()`, which add ops to
      the default graph.
  
      Args:
        op_type: The `Operation` type to create. This corresponds to the
          `OpDef.name` field for the proto that defines the operation.
        inputs: A list of `Tensor` objects that will be inputs to the `Operation`.
        dtypes: A list of `DType` objects that will be the types of the tensors
          that the operation produces.
        input_types: (Optional.) A list of `DType`s that will be the types of
          the tensors that the operation consumes. By default, uses the base
          `DType` of each input in `inputs`. Operations that expect
          reference-typed inputs must specify `input_types` explicitly.
        name: (Optional.) A string name for the operation. If not specified, a
          name is generated based on `op_type`.
        attrs: (Optional.) A dictionary where the key is the attribute name (a
          string) and the value is the respective `attr` attribute of the
          `NodeDef` proto that will represent the operation (an `AttrValue`
          proto).
        op_def: (Optional.) The `OpDef` proto that describes the `op_type` that
          the operation will have.
        compute_shapes: (Optional.) If True, shape inference will be performed
          to compute the shapes of the outputs.
        compute_device: (Optional.) If True, device functions will be executed
          to compute the device property of the Operation.
  
      Raises:
        TypeError: if any of the inputs is not a `Tensor`.
        ValueError: if colocation conflicts with existing device assignment.
  
      Returns:
        An `Operation` object.
  
      """
      self._check_not_finalized()
      for idx, a in enumerate(inputs):
        if not isinstance(a, Tensor):
          raise TypeError("Input #%d is not a tensor: %s" % (idx, a))
      if name is None:
        name = op_type
      # If a names ends with a '/' it is a "name scope" and we use it as-is,
      # after removing the trailing '/'.
      if name and name[-1] == "/":
        name = _name_from_scope_name(name)
      else:
        name = self.unique_name(name)
  
      node_def = _NodeDef(op_type, name, device=None, attrs=attrs)
  
      # Apply any additional attributes requested. Do not overwrite any existing
      # attributes.
      for key, value in self._attr_scope_map.items():
        if key not in node_def.attr:
          if callable(value):
            value = value(node_def)
            if not isinstance(value, (type(None), attr_value_pb2.AttrValue)):
              raise TypeError(
                  "Callable for scope map key '%s' must return either None or "
                  "an AttrValue protocol buffer; but it returned: %s" % (key,
                                                                         value))
          node_def.attr[key].CopyFrom(value)
  
      # Apply a kernel label if one has been specified for this op_type.
      try:
        kernel_label = self._op_to_kernel_label_map[op_type]
        node_def.attr["_kernel"].CopyFrom(
            attr_value_pb2.AttrValue(s=compat.as_bytes(kernel_label)))
      except KeyError:
        pass
  
      # Apply the overriding op_type for gradients if one has been
      # specified for this op_type.
      try:
        mapped_op_type = self._gradient_override_map[op_type]
        node_def.attr["_gradient_op_type"].CopyFrom(
            attr_value_pb2.AttrValue(s=compat.as_bytes(mapped_op_type)))
      except KeyError:
        pass
  
      control_inputs = self._control_dependencies_for_inputs(inputs)
      ret = Operation(
          node_def,
          self,
          inputs=inputs,
          output_types=dtypes,
          control_inputs=control_inputs,
          input_types=input_types,
          original_op=self._default_original_op,
          op_def=op_def)
      if compute_shapes:
        set_shapes_for_outputs(ret)
      self._add_op(ret)
      self._record_op_seen_by_control_dependencies(ret)
  
      if compute_device:
        self._apply_device_functions(ret)
  
      if self._colocation_stack:
        all_colocation_groups = []
        for colocation_op in self._colocation_stack:
          all_colocation_groups.extend(colocation_op.colocation_groups())
          if colocation_op.device:
            # Make this device match the device of the colocated op, to
            # provide consistency between the device and the colocation
            # property.
            if (ret.device and pydev.canonical_name(ret.device) !=
                pydev.canonical_name(colocation_op.device)):
              logging.warning("Tried to colocate %s with an op %s that had "
                              "a different device: %s vs %s. "
                              "Ignoring colocation property.", name,
                              colocation_op.name, ret.device,
                              colocation_op.device)
            else:
              ret._set_device(colocation_op.device)  # pylint: disable=protected-access
  
        all_colocation_groups = sorted(set(all_colocation_groups))
        ret.node_def.attr["_class"].CopyFrom(
            attr_value_pb2.AttrValue(list=attr_value_pb2.AttrValue.ListValue(
                s=all_colocation_groups)))
  
      # Sets "container" attribute if
      # (1) self._container is not None
      # (2) "is_stateful" is set in OpDef
      # (3) "container" attribute is in OpDef
      # (4) "container" attribute is None
      if (self._container and op_type in self._registered_ops and
          self._registered_ops[op_type].is_stateful and
          "container" in ret.node_def.attr and
          not ret.node_def.attr["container"].s):
        ret.node_def.attr["container"].CopyFrom(
            attr_value_pb2.AttrValue(s=compat.as_bytes(self._container)))
  
      return ret
function_tokens: def create_op ( self , op_type , inputs , dtypes , # pylint: disable=redefined-outer-name input_types = None , name = None , attrs = None , op_def = None , compute_shapes = True , compute_device = True ) : self . _check_not_finalized ( ) for idx , a in enumerate ( inputs ) : if not isinstance ( a , Tensor ) : raise TypeError ( "Input #%d is not a tensor: %s" % ( idx , a ) ) if name is None : name = op_type # If a names ends with a '/' it is a "name scope" and we use it as-is, # after removing the trailing '/'. if name and name [ - 1 ] == "/" : name = _name_from_scope_name ( name ) else : name = self . unique_name ( name ) node_def = _NodeDef ( op_type , name , device = None , attrs = attrs ) # Apply any additional attributes requested. Do not overwrite any existing # attributes. for key , value in self . _attr_scope_map . items ( ) : if key not in node_def . attr : if callable ( value ) : value = value ( node_def ) if not isinstance ( value , ( type ( None ) , attr_value_pb2 . AttrValue ) ) : raise TypeError ( "Callable for scope map key '%s' must return either None or " "an AttrValue protocol buffer; but it returned: %s" % ( key , value ) ) node_def . attr [ key ] . CopyFrom ( value ) # Apply a kernel label if one has been specified for this op_type. try : kernel_label = self . _op_to_kernel_label_map [ op_type ] node_def . attr [ "_kernel" ] . CopyFrom ( attr_value_pb2 . AttrValue ( s = compat . as_bytes ( kernel_label ) ) ) except KeyError : pass # Apply the overriding op_type for gradients if one has been # specified for this op_type. try : mapped_op_type = self . _gradient_override_map [ op_type ] node_def . attr [ "_gradient_op_type" ] . CopyFrom ( attr_value_pb2 . AttrValue ( s = compat . as_bytes ( mapped_op_type ) ) ) except KeyError : pass control_inputs = self . _control_dependencies_for_inputs ( inputs ) ret = Operation ( node_def , self , inputs = inputs , output_types = dtypes , control_inputs = control_inputs , input_types = input_types , original_op = self . _default_original_op , op_def = op_def ) if compute_shapes : set_shapes_for_outputs ( ret ) self . _add_op ( ret ) self . _record_op_seen_by_control_dependencies ( ret ) if compute_device : self . _apply_device_functions ( ret ) if self . _colocation_stack : all_colocation_groups = [ ] for colocation_op in self . _colocation_stack : all_colocation_groups . extend ( colocation_op . colocation_groups ( ) ) if colocation_op . device : # Make this device match the device of the colocated op, to # provide consistency between the device and the colocation # property. if ( ret . device and pydev . canonical_name ( ret . device ) != pydev . canonical_name ( colocation_op . device ) ) : logging . warning ( "Tried to colocate %s with an op %s that had " "a different device: %s vs %s. " "Ignoring colocation property." , name , colocation_op . name , ret . device , colocation_op . device ) else : ret . _set_device ( colocation_op . device ) # pylint: disable=protected-access all_colocation_groups = sorted ( set ( all_colocation_groups ) ) ret . node_def . attr [ "_class" ] . CopyFrom ( attr_value_pb2 . AttrValue ( list = attr_value_pb2 . AttrValue . ListValue ( s = all_colocation_groups ) ) ) # Sets "container" attribute if # (1) self._container is not None # (2) "is_stateful" is set in OpDef # (3) "container" attribute is in OpDef # (4) "container" attribute is None if ( self . _container and op_type in self . _registered_ops and self . _registered_ops [ op_type ] . is_stateful and "container" in ret . node_def . attr and not ret . node_def . attr [ "container" ] . s ) : ret . node_def . attr [ "container" ] . CopyFrom ( attr_value_pb2 . AttrValue ( s = compat . as_bytes ( self . _container ) ) ) return ret