Skip to content

[mlir][Bindings] Fix missing return value of functions and incorrect type hint in pyi. #116731

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

Merged
merged 1 commit into from
Nov 19, 2024
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: 2 additions & 0 deletions mlir/lib/Bindings/Python/DialectQuant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ static void populateDialectQuantSubmodule(const py::module &m) {
double scale = mlirUniformQuantizedPerAxisTypeGetScale(type, i);
scales.push_back(scale);
}
return scales;
},
"The scales designate the difference between the real values "
"corresponding to consecutive quantized values differing by 1. The ith "
Expand All @@ -265,6 +266,7 @@ static void populateDialectQuantSubmodule(const py::module &m) {
mlirUniformQuantizedPerAxisTypeGetZeroPoint(type, i);
zeroPoints.push_back(zeroPoint);
}
return zeroPoints;
},
"the storage values corresponding to the real value 0 in the affine "
"equation. The ith zero point corresponds to the ith slice in the "
Expand Down
2 changes: 1 addition & 1 deletion mlir/python/mlir/_mlir_libs/_mlir/dialects/quant.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class UniformQuantizedPerAxisType(QuantizedType):
def scales(self) -> list[float]: ...

@property
def zero_points(self) -> list[float]: ...
def zero_points(self) -> list[int]: ...

@property
def quantized_dimension(self) -> int: ...
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/python/dialects/quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def test_uniform_per_axis_type():
),
)

# CHECK: scales: None
# CHECK: scales: [200.0, 0.99872]
print(f"scales: {per_axis.scales}")
# CHECK: zero_points: None
# CHECK: zero_points: [0, 120]
print(f"zero_points: {per_axis.zero_points}")
# CHECK: quantized dim: 1
print(f"quantized dim: {per_axis.quantized_dimension}")
Expand Down
Loading