Skip to content
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

[PT] Fix aten::add decomposition for i4 weights #29525

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/frontends/pytorch/src/op/add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ OutputVector translate_add_common(const NodeContext& context, bool inplace) {

if (alpha.get_node_shared_ptr()) {
auto converted_alpha = ComplexTypeMark::convert_like(context, alpha, rhs);
rhs = ComplexTypeMark::mul(context, rhs, converted_alpha);
rhs = ComplexTypeMark::mul(context, converted_alpha, rhs);
}

auto add = ComplexTypeMark::add(context, lhs, rhs);
Expand Down
2 changes: 1 addition & 1 deletion src/frontends/pytorch/src/op/sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ OutputVector translate_sub_common(const NodeContext& context, bool inplace) {
auto alpha = context.get_input(2);
auto casted_alpha = ComplexTypeMark::convert_like(context, alpha, y);

y = ComplexTypeMark::mul(context, y, casted_alpha);
y = ComplexTypeMark::mul(context, casted_alpha, y);
}

auto sub = ComplexTypeMark::sub(context, x, y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def forward(self, x):
converted_model = fe.convert(input_model)
assert converted_model
assert [n.get_type_name() for n in converted_model.get_ordered_ops()] == [
"Parameter", "Convert", "Convert", "Cos", "Relu", "Constant", "Convert", "Multiply", "Add", "Result"]
"Parameter", "Convert", "Convert", "Cos", "Constant", "Convert", "Relu", "Multiply", "Add", "Result"]

converted_model = convert_model(model, example_input=(
torch.randn(100),), extension=[ModuleExtension(CosModel, "aten::sin"), ModuleExtension(model.relu_module, "aten::tan")])
Expand Down
Loading