ttnn.conv2d
- ttnn.conv2d = Operation(python_fully_qualified_name='ttnn.conv2d', function=<ttnn._ttnn.operations.conv.conv2d_t object>, preprocess_golden_function_inputs=<function default_preprocess_golden_function_inputs>, golden_function=<function _golden_function>, postprocess_golden_function_outputs=<function default_postprocess_golden_function_outputs>, is_cpp_operation=True, is_experimental=False)
-
Applies a 2D convolution over an input signal composed of several input planes.
For more information, refer to this tech report.
- Parameters:
-
input_tensor (ttnn.Tensor) – The input tensor. This must be in the format [N, H, W, C]. It can be on host or device.
weight_tensor (ttnn.Tensor) – The weight tensor. The weights can be passed in the same format as PyTorch, [out_channels, in_channels, kernel_height, kernel_width]. The op w
bias_tensor (ttnn.Tensor, None) – Optional bias tensor. Default: None
device (ttnn.IDevice) – The device to use.
in_channels (int) – Number of input channels.
out_channels (int) – Number of output channels.
batch_size (int) – Batch size.
input_height (int) – Height of the input tensor.
input_width (int) – Width of the input tensor.
kernel_size (tuple[int, int]) – Size of the convolving kernel.
stride (tuple[int, int]) – Stride of the cross-correlation.
padding (tuple[int, int] or tuple[int, int, int, int])) – Zero-padding added to both sides of the input. [pad_height, pad_width] or [pad_top, pad_bottom, pad_left, pad_right].
dilation (tuple[int, int]) – Spacing between kernel elements.
groups (int) – Number of blocked connections from input channels to output channels.
conv_config (ttnn.Conv2dConfig, None) – Configuration for convolution. Default: None
compute_config (ttnn.DeviceComputeKernelConfig, None) – Configuration for compute kernel. Default: None
memory_config (ttnn.MemoryConfig, None) – Output Tensor’s Memory Configuration. Default: None
return_output_dim (bool) – If true, the op also returns the height and width of the output tensor in [N, H, W, C] format,
return_weights_and_bias (bool) – If true, the op also returns the preprocessed weight and bias on device .
- Returns:
-
The output tensor, output height and width, and the preprocessed weights and bias.
- Return type:
-
[ttnn.Tensor]: The output tensor, when return_output_dim = False and return_weights_and_bias = False
- Return type:
-
[ttnn.Tensor, Tuple[int, int]]: The output tensor, and it’s height and width, if return_output_dim = True
- Return type:
-
[ttnn.Tensor, Tuple[ttnn.Tensor, ttnn.Tensor]]: The output tensor, and it’s height and width, if return_weights_and_bias = True
- Return type:
-
[ttnn.Tensor, Tuple[int, int], Tuple[ttnn.Tensor, ttnn.Tensor]]: The output tensor, and it’s height and width, if return_output_dim = True and return_weights_and_bias = True