code: def check_if_need_transpose(self, IR_node):
      parent = self.IR_graph.get_parent(IR_node.name, [0])
      while (
          parent.type == "Flatten"
          or parent.type == "Dropout"
          or parent.type == "Reshape"
      ):
          parent = self.IR_graph.get_parent(parent.name, [0])
      dim = len(parent.layer.attr["_output_shapes"].list.shape[0].dim)
      if dim > 2:
          original_dims = self.weights_dict[IR_node.name][
              "weights"
          ].shape
          dims = [
              i.size
              for i in parent.layer.attr["_output_shapes"]
              .list.shape[0]
              .dim[1:]
          ] + [-1]
          self.weights_dict[IR_node.name]["weights"] = np.reshape(
              self.weights_dict[IR_node.name]["weights"], dims
          )
          self.weights_dict[IR_node.name]["weights"] = np.transpose(
              self.weights_dict[IR_node.name]["weights"],
              [dim - 2] + list(range(0, dim - 2)) + [dim - 1],
          )
          self.weights_dict[IR_node.name]["weights"] = np.reshape(
              self.weights_dict[IR_node.name]["weights"], original_dims
          )
  
imports: from __future__ import division
  import os
  import sys
  import math
  import numpy
  import caffe
  from caffe import layers
  from caffe import params
  from mmdnn.conversion.common.IR.IR_graph import IRGraph, IRGraphNode
  import mmdnn.conversion.common.IR.graph_pb2
  from mmdnn.conversion.common.IR.graph_pb2 import NodeDef, GraphDef, DataType
  from mmdnn.conversion.common.DataStructure.emitter import Emitter
  from mmdnn.conversion.common.utils import *
label_desc: Use image node_id 8 for calling the CaffeEmitter obj's underlying member method code with example usage: obj.check_if_need_transpose(IR_node) without return types