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!