[PT FE]: support aten::minimum aten::maximum (#19996)
This commit is contained in:
1 parent
f1b8abe55a
commit
fde054e4a6
3 files changed
+110
No files matched your search
@@ -80,6 +80,38 @@ OutputVector translate_min(const NodeContext& context) {
|
||||
return {values, indicies};
|
||||
};
|
||||
|
||||
OutputVector translate_maximum(const NodeContext& context) {
|
||||
// aten::maximum(Tensor self, Tensor other) -> Tensor
|
||||
|
||||
// aten::maximum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
||||
|
||||
num_inputs_check(context, 2, 3);
|
||||
auto x = context.get_input(0);
|
||||
auto y = context.get_input(1);
|
||||
align_eltwise_input_types(context, x, y, true);
|
||||
auto res = context.mark_node(std::make_shared<v1::Maximum>(x, y));
|
||||
if (!context.input_is_none(2)) {
|
||||
context.mutate_input(2, res);
|
||||
}
|
||||
return {res};
|
||||
}
|
||||
|
||||
OutputVector translate_minimum(const NodeContext& context) {
|
||||
// aten::minimum(Tensor self, Tensor other) -> Tensor
|
||||
|
||||
// aten::minimum.out(Tensor self, Tensor other, *, Tensor(a!) out) -> Tensor(a!)
|
||||
|
||||
num_inputs_check(context, 2, 3);
|
||||
auto x = context.get_input(0);
|
||||
auto y = context.get_input(1);
|
||||
align_eltwise_input_types(context, x, y, true);
|
||||
auto res = context.mark_node(std::make_shared<v1::Minimum>(x, y));
|
||||
if (!context.input_is_none(2)) {
|
||||
context.mutate_input(2, res);
|
||||
}
|
||||
return {res};
|
||||
}
|
||||
|
||||
} // namespace op
|
||||
} // namespace pytorch
|
||||
} // namespace frontend
|
||||
|
||||
@@ -96,10 +96,12 @@ OP_CONVERTER(translate_loop);
|
||||
OP_CONVERTER(translate_masked_fill);
|
||||
OP_CONVERTER(translate_masked_scatter);
|
||||
OP_CONVERTER(translate_max);
|
||||
OP_CONVERTER(translate_maximum);
|
||||
OP_CONVERTER(translate_max_poolnd);
|
||||
OP_CONVERTER(translate_mean);
|
||||
OP_CONVERTER(translate_meshgrid);
|
||||
OP_CONVERTER(translate_min);
|
||||
OP_CONVERTER(translate_minimum);
|
||||
OP_CONVERTER(translate_narrow);
|
||||
OP_CONVERTER(translate_native_multi_head_attention);
|
||||
OP_CONVERTER(translate_neg);
|
||||
@@ -351,12 +353,14 @@ const std::map<std::string, CreatorFunction> get_supported_ops_ts() {
|
||||
{"aten::masked_scatter_", op::inplace_op<op::translate_masked_scatter>},
|
||||
{"aten::matmul", op::translate_1to1_match_2_inputs<opset10::MatMul>},
|
||||
{"aten::max", op::translate_max},
|
||||
{"aten::maximum", op::translate_maximum},
|
||||
{"aten::max_pool1d", op::quantizable_op<op::translate_max_poolnd>},
|
||||
{"aten::max_pool2d", op::quantizable_op<op::translate_max_poolnd>},
|
||||
{"aten::max_pool3d", op::quantizable_op<op::translate_max_poolnd>},
|
||||
{"aten::mean", op::quantizable_op<op::translate_mean>},
|
||||
{"aten::meshgrid", op::translate_meshgrid},
|
||||
{"aten::min", op::translate_min},
|
||||
{"aten::minimum", op::translate_minimum},
|
||||
{"aten::mm", op::translate_1to1_match_2_inputs<opset10::MatMul>},
|
||||
{"aten::mul", op::translate_1to1_match_2_inputs_align_types<opset10::Multiply>},
|
||||
{"aten::mul_", op::inplace_op<op::translate_1to1_match_2_inputs_align_types<opset10::Multiply>>},
|
||||
|
||||
Reference in new issue
Block a user