Description
When initializing Model, the groups parameter is silently ignored and falls back to its default value of 1 in KernelBench/level1/73_conv_transposed_3D_asymmetric_input_square_kernel__strided_padded__grouped.py
This happens because output_padding is included in the class __init__ signature but is missing from the get_init_inputs() list. When the arguments are unpacked positionally, the groups value is accidentally assigned to output_padding. Additionally, output_padding is completely missing from the inner nn.ConvTranspose3d instantiation.
Expected behavior
The groups argument should be correctly passed down to the nn.ConvTranspose3d layer, and output_padding should be properly handled.
Actual behavior
get_init_inputs() returns a list of 6 items, missing output_padding.
- The 6th item (
groups=4) is passed to the 6th parameter in __init__ (output_padding).
groups in __init__ receives nothing and defaults to 1.
output_padding is never passed to nn.ConvTranspose3d.
Steps to reproduce
import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, in_channels: int, out_channels: int, kernel_size: int, stride: int = 1, padding: int = 0, output_padding: int = 0, groups: int = 1, bias: bool = False):
super(Model, self).__init__()
# BUG: output_padding is missing here
self.conv_transpose3d = nn.ConvTranspose3d(in_channels, out_channels, kernel_size=(kernel_size, kernel_size, kernel_size), stride=stride, padding=padding, output_padding=output_padding, groups=groups, bias=bias)
def forward(self, x: torch.Tensor) -> torch.Tensor:
return self.conv_transpose3d(x)
# Test code
batch_size = 4
in_channels = 32
out_channels = 32
kernel_size = 3
depth = 32
height = 64
width = 128
stride = 2
padding = 1
groups = 4
def get_init_inputs():
# BUG: output_padding is missing from this positional list
return [in_channels, out_channels, kernel_size, stride, padding, groups]
# If we run: model = Model(*get_init_inputs())
# output_padding becomes 4, and groups defaults to 1.
### Proposed Fix
Update the test code to include output_padding and add output_padding to the nn.ConvTranspose3d call to resolve this.
Description
When initializing
Model, thegroupsparameter is silently ignored and falls back to its default value of1in KernelBench/level1/73_conv_transposed_3D_asymmetric_input_square_kernel__strided_padded__grouped.pyThis happens because
output_paddingis included in the class__init__signature but is missing from theget_init_inputs()list. When the arguments are unpacked positionally, thegroupsvalue is accidentally assigned tooutput_padding. Additionally,output_paddingis completely missing from the innernn.ConvTranspose3dinstantiation.Expected behavior
The
groupsargument should be correctly passed down to thenn.ConvTranspose3dlayer, andoutput_paddingshould be properly handled.Actual behavior
get_init_inputs()returns a list of 6 items, missingoutput_padding.groups=4) is passed to the 6th parameter in__init__(output_padding).groupsin__init__receives nothing and defaults to1.output_paddingis never passed tonn.ConvTranspose3d.Steps to reproduce