code: def compute_output_shapes(self, model):
      sorted_nodes = self.topologically_sorted()
      (tmp_handle, tmp_prototxt) = tempfile.mkstemp(suffix=".prototxt")
      with open(tmp_prototxt, "w") as f:
          f.write(text_format.MessageToString(model))
      self.prototxt = tmp_prototxt
      if has_pycaffe():
          caffe = get_caffe_resolver().caffe
          net = caffe.Net(tmp_prototxt, caffe.TEST)
          for key, value in net.blobs.items():
              try:
                  node = self.get_node(key)
                  dims = list(value.shape)
                  dims = dims + [1] * (4 - len(dims))
                  node.output_shape = TensorShape(*dims)
              except:
                  continue
          for node in sorted_nodes:
              if node.output_shape is None:
                  node.output_shape = TensorShape(
                      *NodeKind.compute_output_shape(node)
                  )
          os.close(tmp_handle)
      else:
          for node in sorted_nodes:
              node.output_shape = TensorShape(
                  *NodeKind.compute_output_shape(node)
              )
  
imports: from collections import namedtuple
  from functools import reduce
  from google.protobuf import text_format
  from copy import deepcopy
  import numbers
  import os
  import tempfile
  from mmdnn.conversion.caffe.mapper import get_handler_name
  from mmdnn.conversion.caffe.resolver import get_caffe_resolver, has_pycaffe
  from mmdnn.conversion.caffe.shape import *
  from mmdnn.conversion.caffe.errors import print_stderr, ConversionError
label_desc: Use image node_id 7 for calling the CaffeGraph obj's underlying member method code with example usage: obj.compute_output_shapes(model) without return types