Skip to content

Commit

Permalink
Bugfix: move regularization computation to the correct device (facebo…
Browse files Browse the repository at this point in the history
…okresearch#148)

Summary:
## Types of changes

- [ ] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Motivation and Context / Related issue

Bugfix for facebookresearch#147

## How Has This Been Tested (if it applies)

Repro of facebookresearch#147
## Checklist

- [x] The documentation is up-to-date with the changes I made.
- [x] I have read the **CONTRIBUTING** document and completed the CLA (see **CONTRIBUTING**).
- [x] All tests passed, and additional code has been covered with new tests.
Pull Request resolved: facebookresearch#148

Reviewed By: jiajunshen

Differential Revision: D22144079

Pulled By: adamlerer

fbshipit-source-id: da8b2056640fb0323b698961a6b9b986cc7a0518
  • Loading branch information
adamlerer authored and facebook-github-bot committed Jun 22, 2020
1 parent 197e9c4 commit 79e7fc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torchbiggraph/regularizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def forward_dynamic(
total = 0
operator_params = operator.get_operator_params_for_reg(rel_idxs)
if operator_params is not None:
total += torch.sum(operator_params ** 3)
total += torch.sum(operator_params ** 3).to(src_pos.device)
for x in (src_pos, dst_pos):
total += torch.sum(operator.prepare_embs_for_reg(x) ** 3)
total *= self.weight
Expand Down

0 comments on commit 79e7fc0

Please sign in to comment.