code: def _GetBlobDimMap(net, net_params, dummy_input):
      dim_map = {}
      ws = workspace.C.Workspace()
      for param in net_params.protos:
          ws.create_blob(param.name).feed(
              utils.Caffe2TensorToNumpyArray(param)
          )
      external_input = net.op[0].input[0]
      ws.create_blob(external_input).feed(dummy_input)
      # Get dimensions with legacy pad
      for i in range(len(net.op)):
          op_def = net.op[i]
          ws._run_operator(op_def.SerializeToString())
          for output in op_def.output:
              blob = ws.fetch_blob(output)
              dim_map[output] = blob.shape
      return dim_map
  
imports: import argparse
  import copy
  import logging
  import re
  import numpy
  from caffe2.proto import caffe2_pb2, caffe2_legacy_pb2
  from caffe.proto import caffe_pb2
  from caffe2.python import core, utils, workspace
  from google.protobuf import text_format
label_desc: Use image node_id 7 for calling a global function with example usage: _GetBlobDimMap(net, net_params, dummy_input) and returns: dim_map