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 _validate_param_optim(self, param_name, optim):
      # there are three possible values for optim:
      # 1) None (which will use self._default_optimizer after this layer is instantiated)
      # 2) self.NoOptim
      # 3) an instance of Optimizer class such as AdagradOptimizer
  
      # this implies this parameter is not shared with any other parameter so far
      if param_name not in self.param_to_optim:
          return
  
      logger.info(
          "{} shares the same parameter with another parameter. "
          "Validating if the same optimizer has been specified for them.".format(
              param_name,
          )
      )
  
      ref_optim = self.param_to_optim[param_name]
  
      if optim is None:
          assert ref_optim == self._default_optimizer, (
              "Optim for {} is None which will fall back to use default_optimizer. "
              "However, the optimizer that has been specified for this shared parameter "
              "is {} which is different from default_optimizer {}. "
              "Please check the optimizers specified for parameters shared "
              "with {} and the default_optimizer to ensure the consistency.".format(
                  param_name,
                  ref_optim,
                  self._default_optimizer,
                  param_name,
              )
          )
      elif optim == self.NoOptim:
          assert ref_optim == self.NoOptim, (
              "Optim for {} is NoOptim. However, the optimizer for the parameters "
              "shared with {} is {} which is different from NoOptim. "
              "Please check the optimizer specified for other parameters in the "
              "shared group to ensure consistency.".format(
                  param_name, param_name, ref_optim
              )
          )
      elif isinstance(optim, Optimizer):
          assert isinstance(ref_optim, Optimizer), (
              "Optim for {} is an instance of Optimizer. However, the optimizer "
              "for the parameters shared with {} is {} which is not an instance "
              "of Optimizer. Please check the optimizer specified for other "
              " parameters in the shared group to ensure consistency.".format(
                  param_name, param_name, ref_optim, optim
              )
          )
  
          assert (
              type(optim) is type(ref_optim)
              and optim.attributes == ref_optim.attributes
          ), (
              "Optim for {} is an instance of Optimizer. However, the optimizer "
              "for the parameters shared with {} is {}. "
              "This optimizer either doesn't have the same type as the current optimizer: "
              "{} vs {}, or its attributes such as learning rate are different from "
              "that of current optimizer which is {} vs {}. "
              "Please check the optimizer specified for other parameters in the "
              "shared group to ensure consistency.".format(
                  param_name,
                  param_name,
                  ref_optim,
                  type(optim),
                  type(ref_optim),
                  optim.attributes,
                  ref_optim.attributes,
              )
          )
      else:
          raise ValueError(
              "optim should be either None, NoOptim, or an instance of Optimizer, Got {} ".format(
                  optim
              )
          )
  
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 14 for calling the LayerModelHelper obj's underlying member method code with example usage: obj._validate_param_optim(param_name, optim) without return types