docstr: Adds layer trainig or initialization operators to the passed in net.
  init_net can be None and can be called independently from add_init_params
docstr_tok: ["Adds","layer","trainig","or","initialization","operators","to","the","passed","in","net",".","init_net","can","be","None","and","can","be","called","independently","from","add_init_params"]
code: def add_operators(
      self, net, init_net=None, context=InstantiationContext.TRAINING
  ):
      """
      Adds layer trainig or initialization operators to the passed in net.
      init_net can be None and can be called independently from add_init_params
      """
      # Namescope below should warranty that all intermediate blobs will be
      # assiciated with the layer that produces them
      with scope.NameScope(self.name):
          if context not in {
              InstantiationContext.PREDICTION,
              InstantiationContext.EVAL,
              InstantiationContext.ACCUMULATE_PRED,
          }:
              assert (
                  init_net
              ), "Only prediction and eval context don't need init_net"
          if init_net:
              self.add_init_params(init_net)
          if context == InstantiationContext.TRAINING:
              self.add_train_ops(net)
          elif context == InstantiationContext.EVAL:
              self.add_eval_ops(net)
          elif context == InstantiationContext.ACCUMULATE_PRED:
              self.add_ops_to_accumulate_pred(net)
          else:
              self.add_ops(net)
  
          if (
              context
              in {
                  InstantiationContext.TRAINING,
                  InstantiationContext.EVAL,
              }
              and self._export_params_for_metrics
          ):
              self.add_param_copy_operators(net)
  
imports: import logging
  from collections import namedtuple
  import numpy
  from caffe2.proto import caffe2_pb2
  from caffe2.python import core, schema, scope, utils, workspace
  from caffe2.python.layers.tags import TagContext
label_desc: Use image node_id 17 for calling the ModelLayer obj's underlying member method code with example usage: obj.add_operators(net, init_net, context) without return types