code: def shape_reshape(node):
      last_shape = node.get_only_parent()[0].output_shape
      shapes = []
      for idx, shape in enumerate(node.layer.reshape_param.shape.dim):
          shapes.append(shape if shape != 0 else last_shape[idx])
  
      if len(shapes) == 1 and shapes[0] == -1:
          total_dim = 1
          for i in last_shape:
              total_dim *= i
          return TensorShape(1, 1, 1, total_dim)  # return NHWC format
  
      elif len(shapes) == 4:
          return TensorShape(shapes[0], shapes[1], shapes[2], shapes[3])
  
      else:
          raise NotImplementedError
  
file_path: MMdnn/mmdnn/conversion/caffe/shape.py
imports: from collections import namedtuple
  import math
label_desc: Use image node_id 8 for calling a global function with example usage: shape_reshape(node) and returns: TensorShape, TensorShape