-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant] Add saturate_to_fp16 op for FP16 quant support #42147
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
Conversation
Summary: Op to check the range of a tensor and clamp the values to fp16 range This operator will be inserted into the graph in subsequent diffs. Test Plan: python test/test_quantization.py TestQuantizedTensor.test_fp16_saturate_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Op to check the range of a tensor and clamp the values to fp16 range This operator will be inserted into the graph in subsequent diffs. Test Plan: python test/test_quantization.py TestQuantizedTensor.test_fp16_saturate_op Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 25a5314 Pull Request resolved: #42147
💊 CI failures summary and remediationsAs of commit 2535659 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 8 times. |
| } | ||
|
|
||
| template <typename T> | ||
| bool CheckAndSaturate(T max_val, T* element) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: I realize this is just moving code around, but this API seems to require careful reading to understand it correctly. Might be worth a refactor in the future to make it a void return type, and have the status be a var passed by reference.
Summary: Op to check the range of a tensor and clamp the values to fp16 range This operator will be inserted into the graph in subsequent diffs. Test Plan: python test/test_quantization.py TestQuantizedTensor.test_fp16_saturate_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Op to check the range of a tensor and clamp the values to fp16 range This operator will be inserted into the graph in subsequent diffs. Test Plan: python test/test_quantization.py TestQuantizedTensor.test_fp16_saturate_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Op to check the range of a tensor and clamp the values to fp16 range This operator will be inserted into the graph in subsequent diffs. Test Plan: python test/test_quantization.py TestQuantizedTensor.test_fp16_saturate_op Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D22849221](https://our.internmc.facebook.com/intern/diff/D22849221) [ghstack-poisoned]
|
This pull request has been merged in a9eebaf. |
Stack from ghstack:
Summary:
Op to check the range of a tensor and clamp the values to fp16 range
This operator will be inserted into the graph in subsequent diffs.
Test Plan:
python test/test_quantization.py TestQuantizedTensor.test_fp16_saturate_op
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D22849221