class_docstr: Model helper for building models on top of layers abstractions.
  
  Each layer is the abstraction that is higher level than Operator. Layer
  is responsible for ownership of it's own parameters and can easily be
  instantiated in multiple nets possible with different sets of ops.
  As an example: one can easily instantiate predict and train nets from
  the same set of layers, where predict net will have subset of the
  operators from train net.
class_docstr_tok: ["Model","helper","for","building","models","on","top","of","layers","abstractions",".","Each","layer","is","the","abstraction","that","is","higher","level","than","Operator",".","Layer","is","responsible","for","ownership","of","it","'s","own","parameters","and","can","easily","be","instantiated","in","multiple","nets","possible","with","different","sets","of","ops",".","As","an","example",":","one","can","easily","instantiate","predict","and","train","nets","from","the","same","set","of","layers",",","where","predict","net","will","have","subset","of","the","operators","from","train","net","."]
code: def add_loss(self, loss, name="unnamed"):
      assert loss is not None, "Added loss should not be None"
      assert isinstance(loss, schema.Scalar) or isinstance(
          loss, schema.Struct
      ), "Added loss should be a scalar or a struct"
      if self._loss is None:
          self._loss = schema.Struct((name, loss))
      else:
          # loss could've been set through model.loss directly which could be
          # a scalar
          if isinstance(self._loss, schema.Scalar):
              self._loss = schema.Struct(("unnamed", self._loss))
  
          prefix_base = name + "_auto_"
          index = 0
          prefix = name
          while prefix in self._loss:
              prefix = prefix_base + str(index)
              index += 1
          loss_struct = schema.Struct((prefix, loss))
          self._loss = self._loss + loss_struct
  
imports: from caffe2.python import core, model_helper, schema, scope, utils, muji
  from caffe2.python.modeling.parameter_info import ParameterInfo
  from caffe2.python.modeling.parameter_sharing import parameter_sharing_context
  from caffe2.python.modeling.net_modifier import NetModifier
  from caffe2.python.optimizer import get_param_device, Optimizer
  from caffe2.python.regularizer import Regularizer, RegularizationBy
  from caffe2.python.layers import layers
  import logging
  import numpy
  import copy
label_desc: Use image node_id 41 for calling the LayerModelHelper obj's underlying member method code with example usage: obj.add_loss(loss, name) without return types