code: def _infer_shape_from_initializer(self):
      for arg in self.initializer.arg:
          if arg.name == "shape":
              return list(arg.ints)
      with workspace.WorkspaceGuard("model_init_by_loading_params"):
          try:
              net = core.Net("shape_checker")
              net._net.op.extend([self.initializer])
              shape_blob = net.NextScopedBlob(self.parameter + "_shape")
              net.Shape([self.parameter], shape_blob)
              workspace.RunNetOnce(net)
              shape = workspace.FetchBlob(shape_blob).tolist()
              # ResetWorkspace to save memory
              workspace.ResetWorkspace()
              return shape
          except RuntimeError as exp:
              logger.warning(
                  "Cannot infer the shape of blob {} from operator {}: {}".format(
                      self.parameter, self.initializer.type, exp
                  )
              )
              workspace.ResetWorkspace()
              return None
  
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 6 for calling the LayerParameter obj's underlying member method code with example usage: obj._infer_shape_from_initializer() and returns: list, shape, None