This repository was archived by the owner on May 13, 2025. It is now read-only.
Open
Conversation
gmuraru
commented
Dec 12, 2020
| tensor = tensor.float() | ||
| if reference.dtype == torch.long: | ||
| reference = reference.float() | ||
| test_passed = torch.allclose(tensor, reference, rtol=1/2 ** 15) |
Contributor
Author
There was a problem hiding this comment.
Q: Does this look strange? (to use rtol with 1/2 ** 15)
I think this might also be changed to 1e-4<-- this is the biggest power of 10 that we could use to "catch" the precision given by 2**16 (< 10^5)
knottb
reviewed
Dec 18, 2020
| if self._scale > 1: | ||
| correction = (tensor < 0).long() | ||
| dividend = tensor / self._scale - correction | ||
| dividend = tensor // self._scale - correction |
Contributor
There was a problem hiding this comment.
Thanks for noticing this. The definitions of truediv has been changed recently in PyTorch for the torch.long dtype. The previous behavior was identical to floordiv.
knottb
approved these changes
Dec 18, 2020
knottb
pushed a commit
to gmuraru/CrypTen
that referenced
this pull request
Dec 18, 2020
Summary: Pull Request resolved: fairinternal/CrypTen#203 - Modified crypten.load to allow the input `f` to be None. - Added assert to ensure exactly one of `f` or `preloaded` is None - Updated unit tests to ensure preloaded loads correctly. Reviewed By: knottb Differential Revision: D21212000 fbshipit-source-id: 82042e208a3a95328ec5472dba9ce964d8033075
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
@knottb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Use
true_divwhen decoding a value - this would give "bad" values when decoding float encoded numbers.Ex:
fp.encode(4.6)-->301465-->fp.decode(301465)-->4Motivation and Context / Related issue
Correct decoding of float encoded values
How Has This Been Tested (if it applies)
Checklist