-
Notifications
You must be signed in to change notification settings - Fork 373
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
Add reduce_min and reduce_max #942
Conversation
This pull request was exported from Phabricator. Differential Revision: D49978036 |
Summary: TBA Differential Revision: D49978036
8945f2b
to
ce3f076
Compare
This pull request was exported from Phabricator. Differential Revision: D49978036 |
ce3f076
to
840a9aa
Compare
Summary: TBA Differential Revision: D49978036
This pull request was exported from Phabricator. Differential Revision: D49978036 |
Summary: My understanding is that the max / min reduction are usually not used in the trained PT models due to their non-differentiability. Probably, that's the reason why we don't have them reflected as AIT ops. However, they may be useful in inference for a manually composed AIT model (or PT model translated by fx2ait) which was solicited in the issue [facebookincubator#941](facebookincubator#941). In this diff, we're adding the new `reduce_max` and `reduce_min` ops to AIT. The new ops are using the existing common back-end implementation used by `reduce_sum` with a small extension: the default (initial) accumulator value of 0 is not suitable for the min / max reductions, it is now made configurable in the codegen; `lowest()` and `max()` numeric limits for the ElementCompute are set by the `reduce_max` / `reduce_min` ops' codegen, respectively. fx2ait wiring of the new ops to the `torch.amax` and `torch.amin` has also been added. Differential Revision: D49978036
840a9aa
to
793bc04
Compare
This pull request was exported from Phabricator. Differential Revision: D49978036 |
Summary: My understanding is that the max / min reduction are usually not used in the trained PT models due to their non-differentiability. Probably, that's the reason why we don't have them reflected as AIT ops. However, they may be useful in inference for a manually composed AIT model (or PT model translated by fx2ait) which was solicited in the issue [facebookincubator#941](facebookincubator#941). In this diff, we're adding the new `reduce_max` and `reduce_min` ops to AIT. The new ops are using the existing common back-end implementation used by `reduce_sum` with a small extension: the default (initial) accumulator value of 0 is not suitable for the min / max reductions, it is now made configurable in the codegen; `lowest()` and `max()` numeric limits for the ElementCompute are set by the `reduce_max` / `reduce_min` ops' codegen, respectively. fx2ait wiring of the new ops to the `torch.amax` and `torch.amin` has also been added. Differential Revision: D49978036
793bc04
to
fc62ca0
Compare
This pull request was exported from Phabricator. Differential Revision: D49978036 |
This pull request has been merged in 0a67de1. |
My understanding is that the max / min reduction are usually not used in the trained PT models due to their non-differentiability. Probably, that's the reason why we don't have them reflected as AIT ops. However, they may be useful in inference for a manually composed AIT model (or PT model translated by fx2ait) which was solicited in #941.
In this diff, we're adding the new
reduce_max
andreduce_min
ops to AIT. The new ops are using the existing common back-end implementation used byreduce_sum
with a small extension: the default (initial) accumulator value of 0 is not suitable for the min / max reductions, it is now made configurable in the codegen;lowest()
andmax()
numeric limits for the ElementCompute are set by thereduce_max
/reduce_min
ops' codegen, respectively.fx2ait wiring of the new ops to the
torch.amax
andtorch.amin
has also been added.Differential Revision: D49978036