Python class
ConvTranspose1d
ConvTranspose1d
class max.nn.ConvTranspose1d(length, in_channels, out_channels, dtype, stride=1, padding=0, dilation=1, output_padding=0, device=None, has_bias=False, permute=False, name=None)
Bases: Module
A 1D transposed convolution operator over an input image composed of several input planes.
When called, ConvTranspose1d accepts a TensorValue
of shape (batch, length, in_channels) and returns a
TensorValue of shape (batch, new_length, out_channels). If permute=True, the input and output follow PyTorch
channel-first layout: (batch, in_channels, length) and (batch, out_channels, new_length).
conv = nn.ConvTranspose1d(
in_channels,
out_channels,
kernel_size,
stride,
padding,
output_padding,
has_bias=False,
name="conv3d_weight",
device=DeviceRef.GPU(),
)Initializes the ConvTranspose1d layer with weights and optional bias.
-
Parameters:
-
- length (int) – The length of the convolution kernel.
- in_channels (int) – Number of channels in the input image.
- out_channels (int) – Number of channels produced by the convolution.
- dtype (DType) – The data type for weights and bias.
- stride (tuple[int, int]) – Stride of the convolution. Default: 1.
- padding (tuple[int, int, int, int]) – Padding added to input. Default: 0.
- dilation (tuple[int, int]) – Spacing between kernel elements. Default: 1.
- output_padding (tuple[int, int]) – Additional size added to output shape. Default: 0.
- device (DeviceRef | None) – The target device for computation.
- has_bias (bool) – When True, adds a bias vector. Default: False.
- permute (bool) – Whether to permute weights between PyTorch and MAX format.
- name (str | None) – Base name for weights.
bias
The optional bias vector stored on CPU with shape (out_channels,).
Model init moves the bias to device if present.
device
The device where matrix operations are performed.
dilation
Not implemented yet. Assuming dilation = 1 for now.
output_padding
0
-
Type:
-
Additional size added to one side of the output shape. Default
padding
Controls the amount of padding applied before and after the input for depth, height, and width dimensions.
permute
permute: bool
bool controls whether self.weight is permuted from PyTorch order to max order. PyTorch order is: (in_channels, out_channels, kernel_length) Max API order: (kernel_length, out_channels, in_channels).
stride
Controls the stride for the cross-correlation.
weight
weight: Weight
The weight matrix stored on CPU with shape (kernel_length, out_channels, in_channels).
Model init moves the weight to device.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!