executorch icon indicating copy to clipboard operation
executorch copied to clipboard

Why is `torch.min` not ATen canonical?

Open kinghchan opened this issue 9 months ago • 1 comments

Hi team,

In the code below (found in exir/verification/verifier.py:81)

    def check_valid_op(self, op):
        if isinstance(op, OpOverload):
            # TODO These special ops should be removable easily.
            if op.namespace in (
                "quantized_decomposed",
                "boltnn_nimble",
                "nimble",
                "quantized",
            ) or op in (
                torch.ops.aten.mkldnn_rnn_layer.default,
                torch.ops.aten._upsample_bilinear2d_aa.default,
                torch.ops.aten.quantize_per_tensor.default,
                torch.ops.aten.dequantize.self,
                torch.ops.aten.max.default,
                torch.ops.aten.full_like.default,  # TODO(T183507359)`

Why is torch.ops.aten.max.default ATen Canonical, but torch.ops.aten.min.default isn't?

This is executorch==0.2.0.

Thank you.

kinghchan avatar May 06 '24 08:05 kinghchan

cc @manuelcandales @SS-JIA

iseeyuan avatar May 06 '24 20:05 iseeyuan

Thanks for catching this. I have added torch.ops.aten.min.default to that list. Notice that min/max are not considered Core ATen ops. They should be decomposed into amin/amax and argmin/argmax. Checkout this post for more details on the Core ATen Opset: https://dev-discuss.pytorch.org/t/defining-the-core-aten-opset/1464#operators-for-which-decompositions-will-be-added-to-the-core-aten-decomposition-table-6

manuelcandales avatar May 07 '24 19:05 manuelcandales

Thanks @manuelcandales!

kinghchan avatar May 14 '24 06:05 kinghchan