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

refactoring code with List Comprehension #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
9 changes: 3 additions & 6 deletions mmdet/core/fp16/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,9 @@ def new_func(*args, **kwargs):
# NOTE: default args are not taken into consideration
if args:
arg_names = args_info.args[:len(args)]
for i, arg_name in enumerate(arg_names):
if arg_name in args_to_cast:
new_args.append(
cast_tensor_type(args[i], torch.float, torch.half))
else:
new_args.append(args[i])
new_args = [cast_tensor_type(args[i], torch.float, torch.half)
if arg_name in args_to_cast else args[i]
for (i, arg_name) in enumerate(arg_names)]
# convert the kwargs that need to be processed
new_kwargs = {}
if kwargs:
Expand Down