ttnn.conv1d
- ttnn.conv1d(input_tensor: ttnn.Tensor, weight_tensor: ttnn.Tensor, device: ttnn.MeshDevice, in_channels: int, out_channels: int, batch_size: int, input_length: int, kernel_size: int, stride: int, padding: int or tuple[int, int], dilation: int, groups: int, *, bias_tensor: ttnn.Tensor | None, dtype: ttnn.DataType | None, conv_config: ttnn.Conv2dConfig | None, compute_config: ttnn.DeviceComputeKernelConfig | None, memory_config: ttnn.MemoryConfig | None, return_output_dim: bool | None, return_weights_and_bias: bool | None) The output tensor, output length, and the preprocessed weights and bias.
-
Applies a 1D convolution over an input signal composed of several input planes. Implemented as a 2D Convolution of input height 1 and input width as input_length.
- 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].
device (ttnn.MeshDevice) – The device to use.
in_channels (int) – Number of input channels.
out_channels (int) – Number of output channels.
batch_size (int) – Batch size.
input_length (int) – Length of the input signal.
kernel_size (int) – Size of the convolving kernel.
stride (int) – Stride of the cross-correlation.
padding (int or tuple[int, int]) – Zero-padding added to both sides of the input. pad_length or [pad_left, pad_right].
dilation (int) – Spacing between kernel elements.
groups (int) – Number of blocked connections from input channels to output channels.
- Keyword Arguments:
-
bias_tensor (ttnn.Tensor, optional) – Optional bias tensor. Default: None
dtype (ttnn.DataType, optional) – The data type of the input tensor. Default: None (will use the same dtype as input_tensor).
conv_config (ttnn.Conv2dConfig, optional) – Configuration for convolution. Default: None
compute_config (ttnn.DeviceComputeKernelConfig, optional) – Configuration for compute kernel. Default: None
memory_config (ttnn.MemoryConfig, optional) – Output Tensor’s Memory Configuration. Default: None
return_output_dim (bool, optional) – If true, the op also returns the length of the output tensor. Default: False
return_weights_and_bias (bool, optional) – If true, the op also returns the preprocessed weight and bias on device. Default: False
- Returns:
-
The output tensor, output length, and the preprocessed weights and bias.
ttnn.Tensor: The output tensor, when return_output_dim = False and return_weights_and_bias = False
tuple[ttnn.Tensor, int]: The output tensor, and its length, if return_output_dim = True
tuple[ttnn.Tensor, tuple[ttnn.Tensor, ttnn.Tensor]]: The output tensor, and its weights and biases, if return_weights_and_bias = True
tuple[ttnn.Tensor, int, tuple[ttnn.Tensor, ttnn.Tensor]]: The output tensor, its length, and its weights and biases, if return_output_dim = True and return_weights_and_bias = True