Skip to content
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

FLOPS computation device bug fix #1447

Merged
merged 3 commits into from
Nov 19, 2020
Merged

Conversation

JunnYu
Copy link
Contributor

@JunnYu JunnYu commented Nov 19, 2020

fix Lyken17/pytorch-OpCounter#113 , inputs device should be same with model parameters' device

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved FLOPS calculation compatibility across different compute devices.

📊 Key Changes

  • Modified the FLOPS calculation to create the input tensor on the same device as the model's parameters.
  • Ensured the input size is correctly handled when provided as an integer rather than a list.

🎯 Purpose & Impact

  • 🏃‍♂️ Ensures consistent FLOPS calculation regardless of whether the model is on a CPU, GPU, or any other compute device, thus enhancing cross-platform compatibility.
  • 👌 The update prevents potential errors or discrepancies that may have arisen from assuming the input tensor's device, making performance profiling more reliable.
  • 💡 Users now have more accurate insights into the computational complexity of their models with different input sizes, leading to better optimization and hardware utilization.

fix issue#113 , inputs device should be same with model parameters' device
@JunnYu
Copy link
Contributor Author

JunnYu commented Nov 19, 2020

1605764478(1)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @JunnYu, thank you for submitting a PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • Verify your PR is up-to-date with origin/master. If your PR is behind origin/master update by running the following, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature  # <----- replace 'feature' with local branch name
git rebase upstream/master
git push -u origin -f
  • Verify all Continuous Integration (CI) checks are passing.
  • Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee

@glenn-jocher glenn-jocher linked an issue Nov 19, 2020 that may be closed by this pull request
@glenn-jocher glenn-jocher merged commit 05a955a into ultralytics:master Nov 19, 2020
@glenn-jocher glenn-jocher changed the title Update torch_utils.py FLOPS computation device bug fix Nov 19, 2020
@glenn-jocher
Copy link
Member

@JunnYu this PR is merged. Thank you for your contributions!

burglarhobbit pushed a commit to burglarhobbit/yolov5 that referenced this pull request Jan 1, 2021
* Update torch_utils.py

fix issue#113 , inputs device should be same with model parameters' device

* Update torch_utils.py

* Update torch_utils.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
* Update torch_utils.py

fix issue#113 , inputs device should be same with model parameters' device

* Update torch_utils.py

* Update torch_utils.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Update torch_utils.py

fix issue#113 , inputs device should be same with model parameters' device

* Update torch_utils.py

* Update torch_utils.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't run with GPU, but worked with CPU Google Colab Incompatibility with YOLOv5
2 participants