parameters: (self, op_type, inputs, outputs=None, **kwargs)
docstring: A helper function to create an operator and add it to self.
docstring_summary: A helper function to create an operator and add it to self.
docstring_tokens: A helper function to create an operator and add it to self .
function: def _CreateAndAddToSelf(self, op_type, inputs, outputs=None, **kwargs):
          """A helper function to create an operator and add it to self.
          """
          inputs = _RectifyInputOutput(inputs)
          for input in inputs:
              if not self.BlobIsDefined(input):
                  assert input.Net() != self
                  self.AddExternalInput(input)
          if outputs is None:
              # If we do not specify an output, we will assume that this op
              # produces one output in this case.
              outputs = self.NextName(prefix=op_type)
          elif type(outputs) is int:
              # In this case, we will auto-fill the given number of outputs
              # with auto-generated names.
              outputs = [
                  self.NextName(prefix=op_type, output_id=i)
                  for i in range(outputs)]
          outputs = _RectifyInputOutput(outputs, net=self)
          op = CreateOperator(op_type, inputs, outputs, **kwargs)
          self._ExtendOps([op])
  
          workspace.operator_tracebacks[self.Name()][
              len(self._net.op) - 1] = _extract_stacktrace()
  
          if len(op.output) == 0:
              return
          elif len(op.output) == 1:
              return BlobReference(op.output[0], self)
          else:
              return tuple(BlobReference(o, self) for o in op.output)
function_tokens: def _CreateAndAddToSelf ( self , op_type , inputs , outputs = None , * * kwargs ) : inputs = _RectifyInputOutput ( inputs ) for input in inputs : if not self . BlobIsDefined ( input ) : assert input . Net ( ) != self self . AddExternalInput ( input ) if outputs is None : # If we do not specify an output, we will assume that this op # produces one output in this case. outputs = self . NextName ( prefix = op_type ) elif type ( outputs ) is int : # In this case, we will auto-fill the given number of outputs # with auto-generated names. outputs = [ self . NextName ( prefix = op_type , output_id = i ) for i in range ( outputs ) ] outputs = _RectifyInputOutput ( outputs , net = self ) op = CreateOperator ( op_type , inputs , outputs , * * kwargs ) self . _ExtendOps ( [ op ] ) workspace . operator_tracebacks [ self . Name ( ) ] [ len ( self . _net . op ) - 1 ] = _extract_stacktrace ( ) if len ( op . output ) == 0 : return elif len ( op . output ) == 1 : return BlobReference ( op . output [ 0 ] , self ) else : return tuple ( BlobReference ( o , self ) for o in op . output )