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 test for WeightDecayMode.NONE #2255

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions fbgemm_gpu/test/split_table_batched_embeddings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3690,10 +3690,6 @@ def execute_backward_optimizers_( # noqa C901
weights_ref = bs[t].weight.cpu() - lr * (
dense_cpu_grad / denom + weight_decay * bs[t].weight.cpu()
)
elif weight_decay_mode == WeightDecayMode.L2:
# pyre-fixme[58]: `/` is not supported for operand types `float`
# and `Tensor`.
weights_ref = bs[t].weight.cpu() - lr * dense_cpu_grad / denom
elif weight_decay_mode == WeightDecayMode.COUNTER:
max_counter = cc.max_counter.item()
weights_ref = self._get_wts_from_counter_adagrad_using_counter(
Expand All @@ -3720,6 +3716,10 @@ def execute_backward_optimizers_( # noqa C901
lr,
weight_decay,
)
else: # WeightDecayMode.L2 or WeightDecayMode.NONE
# pyre-fixme[58]: `/` is not supported for operand types `float`
# and `Tensor`.
weights_ref = bs[t].weight.cpu() - lr * dense_cpu_grad / denom
else:
# pyre-fixme[58]: `/` is not supported for operand types `float`
# and `Tensor`.
Expand Down