add acc_ops.max, acc_ops.maximum, consolidate acc_ops.min and acc_ops.minimum
authorEmad El-Haraty <elharaty@fb.com>
Tue, 14 Sep 2021 00:59:11 +0000 (17:59 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 14 Sep 2021 01:04:33 +0000 (18:04 -0700)
commitfd09e564d67796bfc9b866e6101123840a33ed9a
tree4c8df8b64f2c7ede5e4e3096068206479ac535b0
parent3855c246395303c2cde38c832a21cca577851b39
add acc_ops.max, acc_ops.maximum, consolidate acc_ops.min and acc_ops.minimum

Summary:
This diff adds `acc_ops.max` and `acc_ops.maximum` support.
It further consolidates the logic for `acc_ops.min` and `acc_ops.minimum` to match the logic for max.

torch.max has three behaviors:
```1. max(input)
2. max(input, dim, keepdim=False, *, out=None)
3. max(input, other, *, out=None)
```

Likewise, `torch.min` has three identical behaviors.

I've chosen to implement each as an acc_op, then map to the appropriate one.

the third max function is effectively `torch.maximum`, so I've implemented it as that.

Reviewed By: yinghai, jfix71, 842974287

Differential Revision: D30551464

fbshipit-source-id: 0a2eec10e5185cbf7d9984eec3fd399b23528b2a
torch/fx/experimental/fx2trt/converters/acc_ops_converters.py
torch/fx/experimental/fx_acc/acc_ops.py