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

remove overly restrictive checks for cudagraph (#80881) #81858

Merged
merged 1 commit into from
Jul 21, 2022
Merged
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
5 changes: 0 additions & 5 deletions torch/optim/adamw.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ def _single_tensor_adamw(params: List[Tensor],

if capturable:
assert param.is_cuda and step_t.is_cuda, "If capturable=True, params and state_steps must be CUDA tensors."
else:
assert not step_t.is_cuda, "If capturable=False, state_steps should not be CUDA tensors."

# update step
step_t += 1
Expand Down Expand Up @@ -334,9 +332,6 @@ def _multi_tensor_adamw(params: List[Tensor],
if capturable:
assert all(p.is_cuda and step.is_cuda for p, step in zip(params, state_steps)), \
"If capturable=True, params and state_steps must be CUDA tensors."
else:
assert all(not step.is_cuda for step in state_steps), \
"If capturable=False, state_steps should not be CUDA tensors."

if maximize:
grads = torch._foreach_neg(tuple(grads)) # type: ignore[assignment]
Expand Down