From e943b2076fc13270e71db622a0f5c2f33f1288cb Mon Sep 17 00:00:00 2001 From: peterjc123 Date: Tue, 5 Dec 2023 15:20:35 +0800 Subject: [PATCH] [converter] support elem logic for aten::{max,min} (#270) --- tinynn/converter/operators/torch/aten.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tinynn/converter/operators/torch/aten.py b/tinynn/converter/operators/torch/aten.py index e4416c18..cbe38f08 100644 --- a/tinynn/converter/operators/torch/aten.py +++ b/tinynn/converter/operators/torch/aten.py @@ -3288,7 +3288,11 @@ def parse(self, node, attrs, args, graph_converter): super().parse(node, attrs, args, graph_converter) self.run(node) - self.handle_reduce(tfl.ReduceMinOperator, args, graph_converter, False) + + if 'other' in args: + self.elementwise_binary(tfl.MinimumOperator, graph_converter, True) + else: + self.handle_reduce(tfl.ReduceMinOperator, args, graph_converter, False) class ATenMaxOperator(ATenMaxSchema): @@ -3296,7 +3300,11 @@ def parse(self, node, attrs, args, graph_converter): super().parse(node, attrs, args, graph_converter) self.run(node) - self.handle_reduce(tfl.ReduceMaxOperator, args, graph_converter, False) + + if 'other' in args: + self.elementwise_binary(tfl.MaximumOperator, graph_converter, True) + else: + self.handle_reduce(tfl.ReduceMaxOperator, args, graph_converter, False) class ATenAminOperator(ATenAminSchema):