Skip to main content

Python class

WeightNormConvTranspose1d

WeightNormConvTranspose1d

class max.nn.WeightNormConvTranspose1d(length, in_channels, out_channels, dtype, stride=1, padding=0, dilation=1, output_padding=0, device=None, has_bias=False, permute=False, name=None)

source

Bases: Module

A 1D transposed convolution operator over an input image composed of several input planes.

MAX implements weight normalization as described in Weight Normalization. Weight normalization reparameterizes weights in terms of a direction vector v and a magnitude scalar g. This can help improve optimization by decoupling the length and direction of weight vectors.

When called, WeightNormConvTranspose1d 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 = WeightNormConvTranspose1d(
    length=kernel_size,
    in_channels=in_channels,
    out_channels=out_channels,
    dtype=dtype,
    stride=stride,
    padding=padding,
    output_padding=output_padding,
    has_bias=False,
    device=DeviceRef.GPU(),
)

Initializes the WeightNormConvTranspose1d layer.

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 (int | tuple[int, int]) – Stride of the convolution. Default: 1.
  • padding (int | tuple[int, int, int, int]) – Padding added to input. Default: 0.
  • dilation (int | tuple[int, int]) – Spacing between kernel elements. Default: 1.
  • output_padding (int | 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.

conv

conv: ConvTranspose1d

source

The underlying ConvTranspose1d layer.

device

device: DeviceRef | None

source

The device where matrix operations are performed.

weight_g

weight_g: Weight

source

The magnitude parameter g for weight normalization.

weight_v

weight_v: Weight

source

The direction parameter v for weight normalization.