code: def _set_output_shape(self, source_node, IR_node):
      shape = graph_pb2.TensorShape()
  
      layer_name = source_node.name
  
      shape_pytorch = self.shape_dict[layer_name]
  
      new_dim = shape.dim.add()
  
      if not shape_pytorch:
          print(
              'Warning: Pytorch cannot inference outputshape of "{}" with operator "{}". Setting outputshape manually in json file is alternative .'.format(
                  source_node.name, source_node.type
              )
          )
          IR_node.attr["_output_shapes"].list.shape.extend([shape])
          return
  
      # (batch, C, H, W)  & NHWC
      if len(shape_pytorch) == 4:
          if shape_pytorch[0] == 1:
              new_dim.size = -1
          else:
              new_dim.size = shape_pytorch[0]
          for index in [2, 3, 1]:
              new_dim = shape.dim.add()
              dim = shape_pytorch[index]
              new_dim.size = dim if dim else -1
      elif len(shape_pytorch) == 2:
          if shape_pytorch[0] == 1:
              new_dim.size = -1
          else:
              new_dim.size = shape_pytorch[0]
          for _ in range(2):
              new_dim = shape.dim.add()
              new_dim.size = 1
          new_dim = shape.dim.add()
          dim = shape_pytorch[1]
          new_dim.size = dim if dim else -1
  
      IR_node.attr["_output_shapes"].list.shape.extend([shape])
  
imports: import os
  import numpy
  import mmdnn.conversion.common.IR.graph_pb2
  from mmdnn.conversion.common.IR.graph_pb2 import NodeDef, GraphDef, DataType
  from mmdnn.conversion.common.utils import *
  from mmdnn.conversion.common.DataStructure.parser import Parser
  from mmdnn.conversion.pytorch.pytorch_graph import PytorchGraph040
  from mmdnn.conversion.pytorch.pytorch_graph import PytorchGraph151
  import torch
  import torchvision
label_desc: Use image node_id 6 for calling the PytorchParser obj's underlying member method code with example usage: obj._set_output_shape(source_node, IR_node) without return types