Skip to content

[BUG] unable to compile f3 in torch.compile tutorial #3551

@tttiago

Description

@tttiago

Add Link

https://docs.pytorch.org/tutorials/intermediate/torch_compile_tutorial.html

Describe the bug

When I run the cell

compile_f3 = torch.compile(f3)
print("compile 3:", test_fns(f3, compile_f3, (inp2,)))

in the tutorial, I get the warnings show in the tutorial, but also an error

InternalTorchDynamoError: AttributeError: 'str' object has no attribute 'IF_NEEDED'

from user code:
   File "/home/tiago/miniforge3/envs/pytorch/lib/python3.12/site-packages/scipy/fft/_realtransforms_backend.py", line 15, in torch_dynamo_resume_in__execute_at_12
    return xp.asarray(y)
  File "/home/tiago/miniforge3/envs/pytorch/lib/python3.12/site-packages/scipy/_lib/array_api_compat/numpy/_aliases.py", line 113, in asarray
    return np.array(obj, copy=copy, dtype=dtype, **kwargs)  # pyright: ignore

This also happened when I ran the tutorial in Google Colab.

Describe your environment

  • Plataform: Ubuntu 24.04.3
  • CUDA 12.9
  • pytorch 2.7.1

cc @williamwen42 @msaroufim @anijain2305

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtorch.compileTorch compile and other relevant tutorials

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions