code: def conv2d(x, y, strides=[1, 1], padding="SAME", data_format="NCHW"):
      """
      Generic convolution implementation with im2col over AbstractTensors.
      """
  
      with tf.name_scope("conv2d"):
          if data_format == "NCHW":
              x = x.transpose([0, 2, 3, 1])
  
          h_filter, w_filter, in_filters, out_filters = map(
              int, y.shape
          )
          n_x, h_x, w_x, c_x = map(int, x.shape)
  
          h_out, w_out = out_size(
              [h_x, w_x], [h_filter, w_filter], strides, padding
          )
  
          x_col = im2col(
              x,
              h_filter,
              w_filter,
              strides=strides,
              padding=padding,
              data_format="NHWC",
          )
          w_col = y.transpose([3, 0, 1, 2]).reshape(
              [int(out_filters), -1]
          )
          out = w_col.matmul(x_col)
  
          out = out.reshape([out_filters, h_out, w_out, n_x])
  
          if data_format == "NCHW":
              out = out.transpose([3, 0, 1, 2])
          else:
              out = out.transpose([3, 1, 2, 0])
  
          return out
  
file_path: tf-encrypted/tf_encrypted/tensor/shared.py
imports: import math
  from typing import Optional
  import tensorflow
label_desc: Use image node_id 8 for calling a global function with example usage: conv2d(x, y, strides, padding, data_format) and returns: out