pytorch / pytorch/tutorials

reasoning_about_shapes.py failing with

Open
#3,326 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
9.3k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
4

Description

Add Link

reasoning_about_shapes.py

Describe the bug

faling with:

Unexpected failing examples:
2025-04-15T19:13:02.0149943Z /var/lib/workspace/recipes_source/recipes/reasoning_about_shapes.py failed leaving traceback:
2025-04-15T19:13:02.0150452Z Traceback (most recent call last):
2025-04-15T19:13:02.0150942Z   File "/var/lib/workspace/recipes_source/recipes/reasoning_about_shapes.py", line 88, in <module>
2025-04-15T19:13:02.0151433Z     out = net(inp)
2025-04-15T19:13:02.0151919Z   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
2025-04-15T19:13:02.0152533Z     return self._call_impl(*args, **kwargs)
2025-04-15T19:13:02.0153367Z   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1845, in _call_impl
2025-04-15T19:13:02.0153874Z     return inner()
2025-04-15T19:13:02.0154284Z   File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1793, in inner
2025-04-15T19:13:02.0154783Z     result = forward_call(*args, **kwargs)
2025-04-15T19:13:02.0156238Z   File "/var/lib/workspace/recipes_source/recipes/reasoning_about_shapes.py", line 62, in forward
2025-04-15T19:13:02.0156759Z     x = self.pool(F.relu(self.conv1(x)))
2025-04-15T19:13:02.0157233Z   File "/usr/local/lib/python3.10/dist-packages/torch/nn/functional.py", line 1704, in relu
2025-04-15T19:13:02.0157696Z     result = torch.relu(input)
2025-04-15T19:13:02.0158184Z   File "/usr/local/lib/python3.10/dist-packages/torch/_refs/nn/functional/__init__.py", line 147, in _fn
2025-04-15T19:13:02.0158723Z     return fn(a, *args, inplace=False, **kwargs)
2025-04-15T19:13:02.0159246Z   File "/usr/local/lib/python3.10/dist-packages/torch/_prims_common/wrappers.py", line 291, in _fn
2025-04-15T19:13:02.0159741Z     result = fn(*args, **kwargs)
2025-04-15T19:13:02.0160216Z   File "/usr/local/lib/python3.10/dist-packages/torch/_prims_common/wrappers.py", line 143, in _fn
2025-04-15T19:13:02.0160716Z     result = fn(**bound.arguments)
2025-04-15T19:13:02.0161404Z   File "/usr/local/lib/python3.10/dist-packages/torch/_refs/nn/functional/__init__.py", line 265, in relu
2025-04-15T19:13:02.0161944Z     return torch.where(torch.le(a, 0), 0, a)
2025-04-15T19:13:02.0162438Z   File "/usr/local/lib/python3.10/dist-packages/torch/_prims_common/wrappers.py", line 291, in _fn
2025-04-15T19:13:02.0162931Z     result = fn(*args, **kwargs)
2025-04-15T19:13:02.0163393Z   File "/usr/local/lib/python3.10/dist-packages/torch/_prims_common/wrappers.py", line 143, in _fn
2025-04-15T19:13:02.0163891Z     result = fn(**bound.arguments)
2025-04-15T19:13:02.0173241Z   File "/usr/local/lib/python3.10/dist-packages/torch/_refs/__init__.py", line 1980, in where
2025-04-15T19:13:02.0173753Z     pred, a, b = _maybe_broadcast(pred, a, b)
2025-04-15T19:13:02.0174285Z   File "/usr/local/lib/python3.10/dist-packages/torch/_refs/__init__.py", line 459, in _maybe_broadcast
2025-04-15T19:13:02.0175009Z     return tuple(__maybe_broadcast(x, common_shape) for x in args)
2025-04-15T19:13:02.0175586Z   File "/usr/local/lib/python3.10/dist-packages/torch/_refs/__init__.py", line 459, in <genexpr>
2025-04-15T19:13:02.0176153Z     return tuple(__maybe_broadcast(x, common_shape) for x in args)
2025-04-15T19:13:02.0176754Z   File "/usr/local/lib/python3.10/dist-packages/torch/_refs/__init__.py", line 451, in __maybe_broadcast
2025-04-15T19:13:02.0177273Z     return x.expand(common_shape)
2025-04-15T19:13:02.0177572Z ValueError: expected a tensor object
2025-04-15T19:13:02.0177773Z 

Diabled by https://github.com/pytorch/tutorials/pull/3325

Describe your environment
  • CI
  • PyTorch 2.6

cc: @mikaylagawarecki

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with recipes/reasoning_about_shapes.py, especially the forward call at line 62 and execution at line 88, then reproduce the failure under PyTorch 2.6. Review the disabling change in PyTorch tutorials pull request 3325 to understand the intended status. Done means the recipe no longer produces the reported CI traceback and its CI check passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.