error
71_conv_transposed_2D__asymmetric_input__square_kernel.py
started
2026-05-02T23:20:25Z
reference PyTorch source (the prompt the agent sees)
import torch
import torch.nn as nn
class Model(nn.Module):
"""
Performs a transposed 2D convolution with asymmetric input and a square kernel.
Args:
in_channels (int): Number of channels in the input tensor.
out_channels (int): Number of channels produced by the convolution.
kernel_size (int): Size of the square convolution kernel.
stride (int, optional): Stride of the convolution. Defaults to 1.
padding (int, optional): Padding applied to the input. Defaults to 0.
output_padding (int, optional): Additional size added to one side of the output shape. Defaults to 0.
groups (int, optional): Number of blocked connections from input channels to output channels. Defaults to 1.
bias (bool, optional): If `True`, adds a learnable bias to the output. Defaults to `False`.
"""
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__()
self.conv_transpose2d = nn.ConvTranspose2d(in_channels, out_channels, kernel_size, stride=stride, padding=padding, output_padding=output_padding, groups=groups, bias=bias)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
Performs the transposed 2D convolution.
Args:
x (torch.Tensor): Input tensor of shape (batch_size, in_channels, height_in, width_in).
Returns:
torch.Tensor: Output tensor of shape (batch_size, out_channels, height_out, width_out).
"""
return self.conv_transpose2d(x)
# Test code
batch_size = 8
in_channels = 32
out_channels = 32
kernel_size = 3
# large asymmetric input
height_in = 512
width_in = 1024
def get_inputs():
x = torch.rand(batch_size, in_channels, height_in, width_in)
return [x]
def get_init_inputs():
return [in_channels, out_channels, kernel_size] # Provide in_channels, out_channels, kernel_size for initializationturn 07200.0s turn · 7200.0s LLM · 0.0s tools
feedbackLLM call failed: _WorkItemTimeout: work item exceeded soft timeout budget