correctly import torch.version by migeed-z · Pull Request #157584 · pytorch/pytorch · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

correctly import torch.version #157584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

migeed-z
Copy link
Contributor

@migeed-z migeed-z commented Jul 3, 2025

The structure is

torch/
  __init__.py
  version.py

When we import torch, only torch/__init__.py is executed by default.

The submodules like version.py are not automatically imported or attached to the torch module.

So without anything in __init__.py, torch.version may not be found. So in this PR, we make the import explicit.

Copy link

pytorch-bot bot commented Jul 3, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/157584

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit e2ccfb8 with merge base d56f11a (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link

linux-foundation-easycla bot commented Jul 3, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: migeed-z / name: Zeina Migeed (e2ccfb8)

@migeed-z
Copy link
Contributor Author

migeed-z commented Jul 3, 2025

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label Jul 3, 2025
@ndmitchell
Copy link

Note that the assumption that torch exposes version without an extra import is pretty pervasive. I count 108, such as:

torch/_dynamo/device_interface.py:262:12
torch/_dynamo/utils.py:1585:25
torch/_inductor/codegen/cuda/cuda_env.py:36:28
torch/_inductor/codegen/triton.py:2291:40
torch/_inductor/cpp_builder.py:1312:16
torch/_subclasses/fake_tensor.py:520:16
torch/cuda/__init__.py:222:8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.