pytorch - ✅(Solved) Fix conv_transpose3d meta execution produces output for invalid bias shape instead of matching eager validation [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#178128Fetched 2026-04-08 01:16:30
View on GitHub
Comments
1
Participants
2
Timeline
34
Reactions
0
Author
Timeline (top)
mentioned ×11subscribed ×11labeled ×8commented ×1

torch.nn.functional.conv_transpose3d behaves inconsistently between eager/meta execution. With the same inputs, eager mode rejects the call because the bias has the wrong size, but meta execution still returns a tensor shape.

Error Message

import torch import numpy as np import torch import torch.nn.functional as F

def call_func(inputs, stride=1, padding=0, output_padding=0, groups=1, dilation=1): if len(inputs) == 2: input_tensor, weight = inputs bias = None elif len(inputs) == 3: input_tensor, weight, bias = inputs else: raise ValueError("inputs list must contain 2 (input, weight) or 3 (input, weight, bias) tensors")

return F.conv_transpose3d(
    input_tensor, 
    weight, 
    bias=bias, 
    stride=stride, 
    padding=padding, 
    output_padding=output_padding, 
    groups=groups, 
    dilation=dilation
)

Create test inputs

input_tensor = torch.randn(20, 16, 50, 10, 20) weight = torch.randn(16, 33, 3, 3, 3) bias = torch.randn(33) inputs = [input_tensor, weight, bias]

Test parameters

stride = 1 padding = 1 output_padding = 1 groups = 2 dilation = 2

print("Testing torch.conv_transpose3d defect reproduction...")

Test 1: Dynamic output shape (direct call)

print("\n1. Dynamic output shape (direct call):") try: dynamic_result = call_func(inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation) print(f"Dynamic shape: {dynamic_result.shape}") except Exception as e: print(f"Dynamic error: {e}")

Test 2: Static output shape (torch.compile with dynamic=True)

print("\n2. Static output shape (torch.compile with dynamic=True):") try: compiled_func = torch.compile(call_func, dynamic=True) static_result = compiled_func(inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation) print(f"Static shape: {static_result.shape}") except Exception as e: print(f"Static error: {e}")

Test 3: Meta output shape (device='meta')

print("\n3. Meta output shape (device='meta'):") try: meta_input_tensor = torch.randn(20, 16, 50, 10, 20, device='meta') meta_weight = torch.randn(16, 33, 3, 3, 3, device='meta') meta_bias = torch.randn(33, device='meta') meta_inputs = [meta_input_tensor, meta_weight, meta_bias]

meta_result = call_func(meta_inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
print(f"Meta shape: {meta_result.shape}")

except Exception as e: print(f"Meta error: {e}")

print("\nDefect reproduction complete. The three approaches show inconsistent behavior.")

Root Cause

Summary

torch.nn.functional.conv_transpose3d behaves inconsistently between eager/meta execution. With the same inputs, eager mode rejects the call because the bias has the wrong size, but meta execution still returns a tensor shape.

Fix Action

Fix / Workaround

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) CPU @ 2.20GHz CPU family: 6 Model: 79 Thread(s) per core: 2 Core(s) per socket: 1 Socket(s): 1 Stepping: 0 BogoMIPS: 4399.99 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat md_clear arch_capabilities Hypervisor vendor: KVM Virtualization type: full L1d cache: 32 KiB (1 instance) L1i cache: 32 KiB (1 instance) L2 cache: 256 KiB (1 instance) L3 cache: 55 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0,1 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: Vulnerable Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Mitigation; PTE Inversion Vulnerability Mds: Vulnerable; SMT Host state unknown Vulnerability Meltdown: Vulnerable Vulnerability Mmio stale data: Vulnerable Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Vulnerable Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Vulnerable Vulnerability Spectre v1: Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers Vulnerability Spectre v2: Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BHI: Vulnerable Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Vulnerable Vulnerability Vmscape: Not affected

PR fix notes

PR #178572: [Bugfix] Add output_padding and bias validation for convolution meta path

Description (problem / solution / changelog)

Issue

Fixes #178125, #178127, #178128

Summary

The meta device path for convolution (calc_conv_nd_return_shape and meta_conv in _meta_registrations.py) was missing two classes of validation checks that exist in the C++ backend (Convolution.cpp, NaiveConvolutionTranspose{2d,3d}.cpp):

  1. output_padding validationoutput_padding[i] must be smaller than either stride[i] or dilation[i]. Without this, conv_transpose{1,2,3}d on meta tensors silently accepted invalid output_padding values and returned incorrect shapes.

  2. bias shape validationbias must be 1-dimensional with the correct number of elements (weight.shape[1] * groups for transposed, weight.shape[0] for non-transposed). Without this, conv_transpose3d and conv2d on meta tensors accepted mismatched bias shapes without error.

Changes

  • torch/_meta_registrations.py (+32 lines):
    • Added output_padding vs stride/dilation check in calc_conv_nd_return_shape
    • Added bias shape check in meta_conv
  • test/nn/test_convolution.py (+113 lines):
    • test_conv_transpose_meta_invalid_output_padding: tests invalid output_padding for conv_transpose{1,2,3}d on meta + valid case
    • test_conv_meta_invalid_bias: tests invalid bias for conv_transpose{3,1}d and conv2d on meta + valid case

Checklist

  • Added tests
  • Matches C++ backend validation logic
  • No BC-breaking changes (only adds missing error checks for invalid inputs)

End-to-end run logs

Test script exercises all 3 bug repros plus valid cases, comparing meta device behavior against CPU (ground truth).

<details> <summary>BEFORE (unpatched — bugs present)</summary>
PyTorch version: 2.12.0a0+git18464b7

======================================================================
Test: #178125 conv_transpose1d: output_padding=2, stride=2, dilation=1 on META
======================================================================
  Result shape: torch.Size([20, 66, 105])
  Status: NO ERROR (returned successfully)

======================================================================
Test: #178125 conv_transpose1d: output_padding=2, stride=2, dilation=1 on CPU
======================================================================
  RuntimeError: output padding must be smaller than either stride or dilation, but got output_padding_height: 0 output_padding_width: 2 stride_height: 1 stride_width: 2 dilation_height: 1 dilation_width: 1
  Status: ERROR RAISED

======================================================================
Test: #178127 conv_transpose2d: output_padding=2, stride=2, dilation=2 on META
======================================================================
  Result shape: torch.Size([1, 8, 13, 15])
  Status: NO ERROR (returned successfully)

======================================================================
Test: #178127 conv_transpose2d: output_padding=2, stride=2, dilation=2 on CPU
======================================================================
  RuntimeError: output padding must be smaller than either stride or dilation, but got output_padding_height: 2 output_padding_width: 2 stride_height: 2 stride_width: 2 dilation_height: 2 dilation_width: 2
  Status: ERROR RAISED

======================================================================
Test: #178128 conv_transpose3d: bias=33 but expected=66 (groups=2) on META
======================================================================
  Result shape: torch.Size([20, 66, 50, 10, 20])
  Status: NO ERROR (returned successfully)

======================================================================
Test: #178128 conv_transpose3d: bias=33 but expected=66 (groups=2) on CPU
======================================================================
  RuntimeError: Given transposed=1, weight of size [16, 33, 3, 3, 3], expected bias to be 1-dimensional with 66 elements, but got bias of size [33] instead
  Status: ERROR RAISED

======================================================================
Test: conv2d: bias=3 but expected=4 on META
======================================================================
  Result shape: torch.Size([1, 4, 6, 6])
  Status: NO ERROR (returned successfully)

======================================================================
Test: conv2d: bias=3 but expected=4 on CPU
======================================================================
  RuntimeError: Given weight of size [4, 3, 3, 3], expected bias to be 1-dimensional with 4 elements, but got bias of size [3] instead
  Status: ERROR RAISED

======================================================================
Test: VALID: conv_transpose1d output_padding=1 < stride=2 on META
======================================================================
  Result shape: torch.Size([20, 66, 104])
  Status: NO ERROR (returned successfully)

======================================================================
Test: VALID: conv_transpose3d correct bias=66 on META
======================================================================
  Result shape: torch.Size([20, 66, 50, 10, 20])
  Status: NO ERROR (returned successfully)

======================================================================
All tests completed.
======================================================================

Key issues in BEFORE:

  • #178125: conv_transpose1d with output_padding=2, stride=2, dilation=1 silently returns shape [20, 66, 105] on meta instead of raising an error (CPU correctly raises RuntimeError)
  • #178127: conv_transpose2d with output_padding=2, stride=2, dilation=2 silently returns shape [1, 8, 13, 15] on meta instead of raising an error (CPU correctly raises RuntimeError)
  • #178128: conv_transpose3d with bias=33 (expected 66 for groups=2) silently returns shape [20, 66, 50, 10, 20] on meta instead of raising an error (CPU correctly raises RuntimeError)
  • conv2d with bias=3 (expected 4) also silently succeeds on meta
</details> <details> <summary>AFTER (patched — bugs fixed)</summary>
PyTorch version: 2.12.0a0+git18464b7

======================================================================
Test: #178125 conv_transpose1d: output_padding=2, stride=2, dilation=1 on META
======================================================================
  RuntimeError: output padding must be smaller than either stride or dilation, but got output_padding[0]=2, stride[0]=2, dilation[0]=1
  Status: ERROR RAISED

======================================================================
Test: #178125 conv_transpose1d: output_padding=2, stride=2, dilation=1 on CPU
======================================================================
  RuntimeError: output padding must be smaller than either stride or dilation, but got output_padding_height: 0 output_padding_width: 2 stride_height: 1 stride_width: 2 dilation_height: 1 dilation_width: 1
  Status: ERROR RAISED

======================================================================
Test: #178127 conv_transpose2d: output_padding=2, stride=2, dilation=2 on META
======================================================================
  RuntimeError: output padding must be smaller than either stride or dilation, but got output_padding[0]=2, stride[0]=2, dilation[0]=2
  Status: ERROR RAISED

======================================================================
Test: #178127 conv_transpose2d: output_padding=2, stride=2, dilation=2 on CPU
======================================================================
  RuntimeError: output padding must be smaller than either stride or dilation, but got output_padding_height: 2 output_padding_width: 2 stride_height: 2 stride_width: 2 dilation_height: 2 dilation_width: 2
  Status: ERROR RAISED

======================================================================
Test: #178128 conv_transpose3d: bias=33 but expected=66 (groups=2) on META
======================================================================
  RuntimeError: Given transposed=True, weight of size [16, 33, 3, 3, 3], expected bias to be 1-dimensional with 66 elements, but got bias of size [33] instead
  Status: ERROR RAISED

======================================================================
Test: #178128 conv_transpose3d: bias=33 but expected=66 (groups=2) on CPU
======================================================================
  RuntimeError: Given transposed=1, weight of size [16, 33, 3, 3, 3], expected bias to be 1-dimensional with 66 elements, but got bias of size [33] instead
  Status: ERROR RAISED

======================================================================
Test: conv2d: bias=3 but expected=4 on META
======================================================================
  RuntimeError: Given weight of size [4, 3, 3, 3], expected bias to be 1-dimensional with 4 elements, but got bias of size [3] instead
  Status: ERROR RAISED

======================================================================
Test: conv2d: bias=3 but expected=4 on CPU
======================================================================
  RuntimeError: Given weight of size [4, 3, 3, 3], expected bias to be 1-dimensional with 4 elements, but got bias of size [3] instead
  Status: ERROR RAISED

======================================================================
Test: VALID: conv_transpose1d output_padding=1 < stride=2 on META
======================================================================
  Result shape: torch.Size([20, 66, 104])
  Status: NO ERROR (returned successfully)

======================================================================
Test: VALID: conv_transpose3d correct bias=66 on META
======================================================================
  Result shape: torch.Size([20, 66, 50, 10, 20])
  Status: NO ERROR (returned successfully)

======================================================================
All tests completed.
======================================================================

All issues fixed in AFTER:

  • #178125: Now correctly raises "output padding must be smaller than either stride or dilation" — matches CPU behavior
  • #178127: Now correctly raises "output padding must be smaller than either stride or dilation" — matches CPU behavior
  • #178128: Now correctly raises "expected bias to be 1-dimensional with 66 elements" — matches CPU behavior
  • conv2d now correctly raises "expected bias to be 1-dimensional with 4 elements" — matches CPU behavior
  • Valid cases continue to work correctly (no regression)
</details> <details> <summary>pytest results (2 new tests)</summary>
test/nn/test_convolution.py::TestConvolutionNN::test_conv_meta_invalid_bias PASSED
test/nn/test_convolution.py::TestConvolutionNN::test_conv_transpose_meta_invalid_output_padding PASSED
2 passed, 1179 deselected in 0.62s
</details>

Authored with the assistance of Claude (AI).

Changed files

  • test/nn/test_convolution.py (modified, +113/-0)
  • torch/_meta_registrations.py (modified, +32/-0)

Code Example

import torch
import numpy as np
import torch
import torch.nn.functional as F

def call_func(inputs, stride=1, padding=0, output_padding=0, groups=1, dilation=1):
    if len(inputs) == 2:
        input_tensor, weight = inputs
        bias = None
    elif len(inputs) == 3:
        input_tensor, weight, bias = inputs
    else:
        raise ValueError("inputs list must contain 2 (input, weight) or 3 (input, weight, bias) tensors")
    
    return F.conv_transpose3d(
        input_tensor, 
        weight, 
        bias=bias, 
        stride=stride, 
        padding=padding, 
        output_padding=output_padding, 
        groups=groups, 
        dilation=dilation
    )

# Create test inputs
input_tensor = torch.randn(20, 16, 50, 10, 20)
weight = torch.randn(16, 33, 3, 3, 3)
bias = torch.randn(33)
inputs = [input_tensor, weight, bias]

# Test parameters
stride = 1
padding = 1
output_padding = 1
groups = 2
dilation = 2

print("Testing torch.conv_transpose3d defect reproduction...")

# Test 1: Dynamic output shape (direct call)
print("\n1. Dynamic output shape (direct call):")
try:
    dynamic_result = call_func(inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
    print(f"Dynamic shape: {dynamic_result.shape}")
except Exception as e:
    print(f"Dynamic error: {e}")

# Test 2: Static output shape (torch.compile with dynamic=True)
print("\n2. Static output shape (torch.compile with dynamic=True):")
try:
    compiled_func = torch.compile(call_func, dynamic=True)
    static_result = compiled_func(inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
    print(f"Static shape: {static_result.shape}")
except Exception as e:
    print(f"Static error: {e}")

# Test 3: Meta output shape (device='meta')
print("\n3. Meta output shape (device='meta'):")
try:
    meta_input_tensor = torch.randn(20, 16, 50, 10, 20, device='meta')
    meta_weight = torch.randn(16, 33, 3, 3, 3, device='meta')
    meta_bias = torch.randn(33, device='meta')
    meta_inputs = [meta_input_tensor, meta_weight, meta_bias]
    
    meta_result = call_func(meta_inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
    print(f"Meta shape: {meta_result.shape}")
except Exception as e:
    print(f"Meta error: {e}")

print("\nDefect reproduction complete. The three approaches show inconsistent behavior.")
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

Summary

torch.nn.functional.conv_transpose3d behaves inconsistently between eager/meta execution. With the same inputs, eager mode rejects the call because the bias has the wrong size, but meta execution still returns a tensor shape.

Repro

import torch
import numpy as np
import torch
import torch.nn.functional as F

def call_func(inputs, stride=1, padding=0, output_padding=0, groups=1, dilation=1):
    if len(inputs) == 2:
        input_tensor, weight = inputs
        bias = None
    elif len(inputs) == 3:
        input_tensor, weight, bias = inputs
    else:
        raise ValueError("inputs list must contain 2 (input, weight) or 3 (input, weight, bias) tensors")
    
    return F.conv_transpose3d(
        input_tensor, 
        weight, 
        bias=bias, 
        stride=stride, 
        padding=padding, 
        output_padding=output_padding, 
        groups=groups, 
        dilation=dilation
    )

# Create test inputs
input_tensor = torch.randn(20, 16, 50, 10, 20)
weight = torch.randn(16, 33, 3, 3, 3)
bias = torch.randn(33)
inputs = [input_tensor, weight, bias]

# Test parameters
stride = 1
padding = 1
output_padding = 1
groups = 2
dilation = 2

print("Testing torch.conv_transpose3d defect reproduction...")

# Test 1: Dynamic output shape (direct call)
print("\n1. Dynamic output shape (direct call):")
try:
    dynamic_result = call_func(inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
    print(f"Dynamic shape: {dynamic_result.shape}")
except Exception as e:
    print(f"Dynamic error: {e}")

# Test 2: Static output shape (torch.compile with dynamic=True)
print("\n2. Static output shape (torch.compile with dynamic=True):")
try:
    compiled_func = torch.compile(call_func, dynamic=True)
    static_result = compiled_func(inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
    print(f"Static shape: {static_result.shape}")
except Exception as e:
    print(f"Static error: {e}")

# Test 3: Meta output shape (device='meta')
print("\n3. Meta output shape (device='meta'):")
try:
    meta_input_tensor = torch.randn(20, 16, 50, 10, 20, device='meta')
    meta_weight = torch.randn(16, 33, 3, 3, 3, device='meta')
    meta_bias = torch.randn(33, device='meta')
    meta_inputs = [meta_input_tensor, meta_weight, meta_bias]
    
    meta_result = call_func(meta_inputs, stride=stride, padding=padding, output_padding=output_padding, groups=groups, dilation=dilation)
    print(f"Meta shape: {meta_result.shape}")
except Exception as e:
    print(f"Meta error: {e}")

print("\nDefect reproduction complete. The three approaches show inconsistent behavior.")

Expected

Meta execution should validate arguments consistently with eager mode and raise the same shape error for the invalid bias/groups configuration.

Actual

  1. Dynamic output shape (direct call): Dynamic error: Given transposed=1, weight of size [16, 33, 3, 3, 3], expected bias to be 1-dimensional with 66 elements, but got bias of size [33] instead

  2. Static output shape (torch.compile with dynamic=True): Static error: AcceleratorError: CUDA error: device doesn't have valid Grid license Search for cudaErrorDeviceNotLicensed' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information. CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1 Compile with TORCH_USE_CUDA_DSA` to enable device-side assertions.

  3. Meta output shape (device='meta'): Meta shape: torch.Size([20, 66, 53, 13, 23])

Versions

Collecting environment information... PyTorch version: 2.10.0+cpu Is debug build: False CUDA used to build PyTorch: None ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04.2) 11.4.0 Clang version: Could not collect CMake version: version 3.31.10 Libc version: glibc-2.35

Python version: 3.12.12 (main, Oct 10 2025, 08:52:57) [GCC 11.4.0] (64-bit runtime) Python platform: Linux-6.6.113+-x86_64-with-glibc2.35 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA Is XPU available: False HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True Caching allocator config: N/A

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Vendor ID: GenuineIntel Model name: Intel(R) Xeon(R) CPU @ 2.20GHz CPU family: 6 Model: 79 Thread(s) per core: 2 Core(s) per socket: 1 Socket(s): 1 Stepping: 0 BogoMIPS: 4399.99 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt arat md_clear arch_capabilities Hypervisor vendor: KVM Virtualization type: full L1d cache: 32 KiB (1 instance) L1i cache: 32 KiB (1 instance) L2 cache: 256 KiB (1 instance) L3 cache: 55 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0,1 Vulnerability Gather data sampling: Not affected Vulnerability Indirect target selection: Vulnerable Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Mitigation; PTE Inversion Vulnerability Mds: Vulnerable; SMT Host state unknown Vulnerability Meltdown: Vulnerable Vulnerability Mmio stale data: Vulnerable Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Vulnerable Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Vulnerable Vulnerability Spectre v1: Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers Vulnerability Spectre v2: Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BHI: Vulnerable Vulnerability Srbds: Not affected Vulnerability Tsa: Not affected Vulnerability Tsx async abort: Vulnerable Vulnerability Vmscape: Not affected

Versions of relevant libraries: [pip3] intel-cmplr-lib-ur==2025.3.2 [pip3] intel-openmp==2025.3.2 [pip3] mkl==2025.3.1 [pip3] numpy==2.0.2 [pip3] nvidia-nccl-cu12==2.29.7 [pip3] onemkl-license==2025.3.1 [pip3] optree==0.19.0 [pip3] tbb==2022.3.1 [pip3] tcmlib==1.4.1 [pip3] torch==2.10.0+cpu [pip3] torchao==0.10.0 [pip3] torchaudio==2.10.0+cpu [pip3] torchcodec==0.10.0 [pip3] torchdata==0.11.0 [pip3] torchsummary==1.5.1 [pip3] torchtune==0.6.1 [pip3] torchvision==0.25.0+cpu [pip3] umf==1.0.3 [conda] Could not collect

cc @malfet @ezyang @eellison @bdhirsh @bobrenjc93 @aorenste

extent analysis

Fix Plan

To fix the inconsistent behavior between eager and meta execution, we need to ensure that the bias size is valid for the given configuration.

  • Check the bias size: The bias size should be equal to the number of output channels. In this case, the number of output channels is 66 (calculated as groups * (weight.size(1) // groups)).
  • Update the bias initialization: Initialize the bias with the correct size.

Code Changes

# Create test inputs
input_tensor = torch.randn(20, 16, 50, 10, 20)
weight = torch.randn(16, 33, 3, 3, 3)
# Calculate the correct bias size
bias_size = 2 * weight.size(1) // 2  # Since groups is 2
bias = torch.randn(bias_size)
inputs = [input_tensor, weight, bias]

Verification

Run the test code with the updated bias size to verify that the error is resolved and the output shapes are consistent across eager and meta execution.

Extra Tips

  • Always validate the input sizes and configurations before calling PyTorch functions.
  • Be aware of the differences in behavior between eager and meta execution, and test your code thoroughly in both modes.
  • Refer to the PyTorch documentation for the specific function you are using to ensure you are using it correctly. In this case, the torch.nn.functional.conv_transpose3d function has specific requirements for the input sizes and configurations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - ✅(Solved) Fix conv_transpose3d meta execution produces output for invalid bias shape instead of matching eager validation [1 pull requests, 1 comments, 2 participants]