class_docstr: Operator Converted for converting Caffe ops to Relay ops
class_docstr_tok: ["Operator","Converted","for","converting","Caffe","ops","to","Relay","ops"]
docstr: Convert Convolution layer
code: def convert_conv(self, op):
      """Convert Convolution layer"""
      params = self._parse_conv_params(op)
      weight_bias_blobs = self.init_layer_dict[op.name].blobs
      conv_params = op.convolution_param
      inputs = op.bottom
      # process weight and bias blobs
      weight, bias = None, None
      if len(weight_bias_blobs) > 1:
          weight = weight_bias_blobs[0]
          bias = weight_bias_blobs[1]
      else:
          weight = weight_bias_blobs[0]
      if weight:
          kh, kw = params["kernel_size"]
          weight_shape = [conv_params.num_output, -1, kh, kw]
          weight_value = np.asarray(weight.data, np.float32)
          weight_value = np.reshape(weight_value, weight_shape)
      else:
          raise Exception(
              f"No weight value of layer {op.name} in caffemodel"
          )
  
      weight_expr = self.exp_tab.new_const(
          weight_value, dtype="float32"
      )
      in_expr = self.exp_tab.get_expr(inputs[0])
      out = _op.nn.conv2d(data=in_expr, weight=weight_expr, **params)
      if bias:
          bias_value = np.asarray(bias.data, np.float32)
          bias_expr = self.exp_tab.new_const(
              bias_value, dtype="float32"
          )
          out = _op.nn.bias_add(out, bias_expr)
      return out
  
imports: import numpy
  import tvm
  from tvm.ir import IRModule
  from ...None import nd
  from ..None import analysis
  from ..None import expr
  from ..None import function
  from ..None import op
  from .common import ExprTable
  from .common import infer_shape
label_desc: Use image node_id 10 for calling the OperatorConverter obj's underlying member method code with example usage: obj.convert_conv(op) and returns: out