module onnxrt.ops_cpu.op_conv_helper_#

Short summary#

module mlprodict.onnxrt.ops_cpu.op_conv_helper_

Helpers for convolution functions, inspired from conv_transpose.cc in onnxruntime.

source on GitHub

Documentation#

Helpers for convolution functions, inspired from conv_transpose.cc in onnxruntime.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.col2im_NCHW_float(result: buffer, data_col: numpy.ndarray[numpy.float32], output_shape: numpy.ndarray[numpy.int64], kernel_shape: numpy.ndarray[numpy.int64], dilations: numpy.ndarray[numpy.int64], padding: numpy.ndarray[numpy.int64]) None#
Applies col2im on an image NCHW.

Parameter result must be an allocated matrix.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.col2im_infer_output_shape(input_shape: List[int], kernel_shape: List[int], strides: List[int], dilations: List[int], pads: List[int], auto_padding: str) tuple#
Computes the output shape of function

@see fn im2col_NCHW_float.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.im2col_1d_inplace_float(result: numpy.ndarray[numpy.float32], data: numpy.ndarray[numpy.float32], kernel_shape: numpy.ndarray[numpy.int64], fill_value: float) None#

Applies im2col_1d on a single vector. The function duplicates the one dimensional tensor so that the convolution can be done through a matrix multiplication. It returns a matrix Nxk where N is the tensor dimension and k the kernal shape.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.im2col_NCHW_float(image_id: int, group_id: int, group: int, result: buffer, data: numpy.ndarray[numpy.float32], output_shape: numpy.ndarray[numpy.int64], kernel_shape: numpy.ndarray[numpy.int64], dilations: numpy.ndarray[numpy.int64], padding: numpy.ndarray[numpy.int64]) None#
Applies im2col on an image NCHW.

Parameter result must be an allocated matrix. Size is defined by @see fn col2im_infer_output_shape.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.new_array(shape: List[int], dtype: dtype) numpy.ndarray[numpy.float32]#

Creates a new array of shape shape.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.tch_col2im_2d_float(result: buffer, data: numpy.ndarray[numpy.float32], output_shape: numpy.ndarray[numpy.int64], kernel_shape: numpy.ndarray[numpy.int64], dilations: numpy.ndarray[numpy.int64], pad: numpy.ndarray[numpy.int64]) None#
Applies col2im_2d on an image.

Parameter result must be an allocated matrix.

mlprodict.onnxrt.ops_cpu.op_conv_helper_.tch_im2col_2d_float(result: buffer, data: numpy.ndarray[numpy.float32], kernel_shape: numpy.ndarray[numpy.int64], dilations: numpy.ndarray[numpy.int64], pad: numpy.ndarray[numpy.int64], fill_value: float) None#
Applies im2col_2d on an image.

Parameter result must be an allocated matrix.