code: def _compute_conv2d_im2col(
      self,
      input_shape,
      kernel=(3, 3),
      stride=(1, 1),
      pad=(0, 0, 0, 0),
      dilation=(1, 1),
  ):
      H, W, C = input_shape
      kernel_h, kernel_w = kernel
      stride_h, stride_w = stride
      pad_t, pad_b, pad_l, pad_r = pad
      dilation_h, dilation_w = dilation
  
      out_h = (
          H + pad_t + pad_b - (dilation_h * (kernel_h - 1) + 1)
      ) // stride_h + 1
      out_w = (
          W + pad_l + pad_r - (dilation_w * (kernel_w - 1) + 1)
      ) // stride_w + 1
  
      input_img = np.arange(1, H * W * C + 1)
      im_matrix = np.zeros((kernel_h * kernel_w * C * out_h * out_w,))
  
      index = 0
      for i_oh in range(out_h):
          for i_ow in range(out_w):
              for i_kh in range(kernel_h):
                  input_row = (
                      -pad_t + i_kh * dilation_h + i_oh * stride_h
                  )
                  for i_kw in range(kernel_w):
                      for i_c in range(C):
                          if input_row < 0 or input_row >= H:
                              im_matrix[index] = 0
                          else:
                              input_col = (
                                  -pad_l
                                  + i_kw * dilation_w
                                  + i_ow * stride_w
                              )
                              if input_col >= 0 and input_col < W:
                                  im_matrix[index] = input_img[
                                      input_row * W * C
                                      + input_col * C
                                      + i_c
                                  ]
                              else:
                                  im_matrix[index] = 0
                          index += 1
  
      im_matrix = im_matrix.reshape(out_h * out_w, -1)
      return im_matrix
  
imports: import math
  import os
  import re
  from bisect import bisect_left
  from collections.abc import Iterable
  import numpy
  from hls4ml.backends.backend import Backend
  from hls4ml.model.attributes import ChoiceAttribute, ConfigurableAttribute, TypeAttribute
  from hls4ml.model.layers import GRU, LSTM, Activation, BatchNormalization, Conv1D, Conv2D, Dense, Dot, Embedding, GarNet, GarNetStack, GlobalPooling1D, GlobalPooling2D, Pooling1D, Pooling2D, SeparableConv1D, SeparableConv2D, SimpleRNN, Softmax
  from hls4ml.model.optimizer import model_optimizer
  from hls4ml.model.types import ExponentPrecisionType, FixedPrecisionType, IntegerPrecisionType, RoundingMode, SaturationMode, XnorPrecisionType
  from hls4ml.writer import get_writer
label_desc: Use image node_id 21 for calling the FPGABackend obj's underlying member method code with example usage: obj._compute_conv2d_im2col(input_shape, kernel, stride, pad, dilation) and returns: im_matrix