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

Fix different devices bug when moving model from GPU to CPU #5110

Merged
merged 6 commits into from
Oct 10, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Only apply if Detect() is last layer
Co-authored-by: Jebastin Nadar <njebastin10@gmail.com>
  • Loading branch information
glenn-jocher and jebastin-nadar authored Oct 10, 2021
commit 1030165b5e31d3ce9b91b1a10fbbfc7c654b7f3f
1 change: 1 addition & 0 deletions models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ def info(self, verbose=False, img_size=640): # print model information
def _apply(self, fn):
self = super()._apply(fn)
m = self.model[-1] # Detect()
glenn-jocher marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(m, Detect):
m.stride = fn(m.stride)
m.grid = list(map(fn, m.grid))
return self
Expand Down