Add ClusteringInitMethod enum constants to __init__.pyi stub#5324
Open
alibeklfc wants to merge 1 commit into
Open
Add ClusteringInitMethod enum constants to __init__.pyi stub#5324alibeklfc wants to merge 1 commit into
alibeklfc wants to merge 1 commit into
Conversation
Summary: Add the three ClusteringInitMethod enum constants (ClusteringInitMethod_RANDOM, ClusteringInitMethod_KMEANS_PLUS_PLUS, ClusteringInitMethod_AFK_MC2) and the ClusteringInitMethod type alias to the authoritative __init__.pyi Pyre stub. These constants were introduced in commit bc5fe3d75e85 (Dec 2025) when k-means++ and AFK-MC² centroid initialization were added to Clustering.h. They are accessible at runtime via the SWIG-generated module but were never added to __init__.pyi. When D107274305 (Jun 2026) wired __init__.pyi as the authoritative Pyre source, all code using these constants acquired [missing-attribute] errors. test_clustering_initialization.py already references them 14 times. Fix: add ClusteringInitMethod = int type alias and three int constants near the MetricType block at the top of the stub (matching the established pattern for SWIG-wrapped scoped enums). Update ClusteringParameters.init_method from 'int # comment' to 'ClusteringInitMethod' to match how MetricType is used throughout the file. Test: buck test fbcode//faiss/tests:test_swig_wrapper — 25 pass, 0 fail (24 pre-existing + 1 new: test_clustering_init_method_enum_values). Test session: https://www.internalfb.com/intern/testinfra/testrun/32369622335973550 Reviewed By: limqiying Differential Revision: D109007472
Contributor
|
@alibeklfc has exported this pull request. If you are a Meta employee, you can view the originating Diff in D109007472. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Add the three ClusteringInitMethod enum constants
(ClusteringInitMethod_RANDOM, ClusteringInitMethod_KMEANS_PLUS_PLUS,
ClusteringInitMethod_AFK_MC2) and the ClusteringInitMethod type alias to
the authoritative init.pyi Pyre stub.
These constants were introduced in commit bc5fe3d75e85 (Dec 2025) when
k-means++ and AFK-MC² centroid initialization were added to Clustering.h.
They are accessible at runtime via the SWIG-generated module but were never
added to init.pyi. When D107274305 (Jun 2026) wired init.pyi as
the authoritative Pyre source, all code using these constants acquired
[missing-attribute] errors. test_clustering_initialization.py already
references them 14 times.
Fix: add ClusteringInitMethod = int type alias and three int constants
near the MetricType block at the top of the stub (matching the established
pattern for SWIG-wrapped scoped enums). Update ClusteringParameters.init_method
from 'int # comment' to 'ClusteringInitMethod' to match how MetricType
is used throughout the file.
Test: buck test fbcode//faiss/tests:test_swig_wrapper — 25 pass, 0 fail
(24 pre-existing + 1 new: test_clustering_init_method_enum_values).
Test session: https://www.internalfb.com/intern/testinfra/testrun/32369622335973550
Reviewed By: limqiying
Differential Revision: D109007472