code: def scratch_xtensa_conv_2d(mace_op, mace_net):
      output_channels = mace_op.output_shape[0].dims[3]
      bias_bytes = output_channels * 4
  
      input_dims = NetUtil.get_input_dims(mace_op, mace_net, 0)
      input_height = input_dims[1]
      input_width = input_dims[2]
      input_channels = input_dims[3]
  
      output_dims = mace_op.output_shape[0].dims
      out_height = output_dims[1]
      out_width = output_dims[2]
  
      filter_dims = NetUtil.get_input_dims(mace_op, mace_net, 1)
      kernel_height = filter_dims[1]
      kernel_width = filter_dims[2]
  
      strides = NetUtil.get_arg(mace_op, "strides").ints
      x_stride = strides[0]
      y_stride = strides[1]
  
      padding = NetUtil.calc_padding(mace_op, mace_net)
      x_padding = padding[0]
      y_padding = padding[1]
  
      # xa_nn_conv2d_std_getsize
      mem_req = 0
      input_size = 0
      align_size = 0
  
      mem_req += 12 + ALIGNMENT - 1
      data_type = NetUtil.get_arg(mace_op, "T").i
      if data_type == mace_pb2.DT_FLOAT:
          input_size = 4
          align_size = ALIGNMENT >> 2
      else:
          mace_check(False, "Unsupported")
  
      y_b_pad = (
          kernel_height
          + (out_height - 1) * y_stride
          - (y_padding + input_height)
      )
      y_b_pad = max(0, y_b_pad)
      input_channels_pad = aligned_size(input_channels, align_size)
      cir_buf_size_bytes = (
          (y_padding + input_height + y_b_pad)
          * kernel_width
          * input_channels_pad
          * input_size
      )
  
      mem_req += cir_buf_size_bytes
      mem_req += BUS_WIDTH
  
      return int(mem_req * 4 + bias_bytes)
  
file_path: mace/tools/python/micro/micro_op_resolver_xtensa_rules.py
imports: from enum import Enum
  from micro.micro_op_resolver_rules import MicroOPSResolverRule
  from py_proto import mace_pb2
  from transform.base_converter import MaceKeyword
  from transform.base_converter import MaceOp
  from utils.config_parser import DataFormat
  from utils.config_parser import ModelKeys
  from utils.config_parser import Platform
  from utils.util import mace_check
  from utils.net_util import NetUtil
label_desc: Use image node_id 3 for calling a global function with example usage: scratch_xtensa_conv_2d(mace_op, mace_net) and returns: int