class_docstr: Currently we only use it to infer caffe shape, we use tensorflow engine
  to infer tensorflow op shapes, since tensorflow has too many ops.
class_docstr_tok: ["Currently","we","only","use","it","to","infer","caffe","shape",",","we","use","tensorflow","engine","to","infer","tensorflow","op","shapes",",","since","tensorflow","has","too","many","ops","."]
code: def __init__(self, net, input_nodes):
      self._op_shape_inference = {
          MaceOp.Conv2D.name: self.infer_shape_conv_pool_shape,
          MaceOp.Deconv2D.name: self.infer_shape_deconv,
          MaceOp.DepthwiseConv2d.name: self.infer_shape_conv_pool_shape,
          MaceOp.DepthwiseDeconv2d.name: self.infer_shape_deconv,
          MaceOp.Eltwise.name: self.infer_shape_eltwise,
          MaceOp.BatchNorm.name: self.infer_shape_general,
          MaceOp.GroupNorm.name: self.infer_shape_general,
          MaceOp.AddN.name: self.infer_shape_general,
          MaceOp.Activation.name: self.infer_shape_general,
          MaceOp.Pooling.name: self.infer_shape_conv_pool_shape,
          MaceOp.Concat.name: self.infer_shape_concat,
          MaceOp.Split.name: self.infer_shape_slice,
          MaceOp.Softmax.name: self.infer_shape_general,
          MaceOp.FullyConnected.name: self.infer_shape_fully_connected,
          MaceOp.Crop.name: self.infer_shape_crop,
          MaceOp.BiasAdd.name: self.infer_shape_general,
          MaceOp.ChannelShuffle.name: self.infer_shape_channel_shuffle,
          MaceOp.Transpose.name: self.infer_shape_permute,
          MaceOp.PriorBox.name: self.infer_shape_prior_box,
          MaceOp.Reshape.name: self.infer_shape_reshape,
          MaceOp.NonlocalReshape.name: self.infer_shape_nonlocal_reshape,
          MaceOp.ResizeBilinear.name: self.infer_shape_resize_bilinear,
          MaceOp.LpNorm.name: self.infer_shape_general,
          MaceOp.MVNorm.name: self.infer_shape_general,
          MaceOp.ResizeNearestNeighbor.name: self.infer_shape_nearest_neighbor,
          MaceOp.ArgMax.name: self.infer_shape_argmax,
          MaceOp.MatMul.name: self.infer_shape_matmul,
          MaceOp.DetectionOutput.name: self.infer_shape_detection_output,
      }
  
      self._net = net
      self._output_shape_cache = {}
      for input_node in input_nodes:
          input_shape = input_node.shape[:]
          # transpose input from NCHW to NHWC
          Transformer.transpose_shape(input_shape, [0, 3, 1, 2])
          self._output_shape_cache[input_node.name] = input_shape
      for tensor in net.tensors:
          self._output_shape_cache[tensor.name] = list(tensor.dims)
  
imports: import math
  import numpy
  import six
  from transform.transformer import Transformer
  from transform.base_converter import DataFormat
  from transform.base_converter import MaceOp
  from transform.base_converter import MaceKeyword
  from transform.base_converter import ConverterUtil
  from utils.util import mace_check
label_desc: Use image node_id 1 to create a new ShapeInference object from inherited base classes: object with example: obj = ShapeInference(net, input_nodes)