Skip to content

Commit

Permalink
[pytree] hardcode values for none_is_leaf and namespace in C++ py…
Browse files Browse the repository at this point in the history
…tree (pytorch#114858)

Pull Request resolved: pytorch#114858
Approved by: https://github.com/zou3519
  • Loading branch information
XuehaiPan authored and pytorchmergebot committed Dec 1, 2023
1 parent 5eb3616 commit ec124b9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 402 deletions.
12 changes: 2 additions & 10 deletions test/test_pytree.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,10 @@ def test_aligned_public_apis(self):
cxx_signature = inspect.signature(cxx_api)
py_signature = inspect.signature(py_api)

# The C++ pytree APIs provide more features than the Python APIs.
# The Python APIs are a subset of the C++ APIs.
# Check the signature of the Python API is a subset of the C++ API.
# Check the parameter names are the same.
cxx_param_names = list(cxx_signature.parameters)
py_param_names = list(py_signature.parameters)
self.assertTrue(
set(cxx_param_names).issuperset(py_param_names),
msg=(
f"C++ parameter(s) ({cxx_param_names}) "
f"not in Python parameter(s) ({py_param_names})"
),
)
self.assertEqual(cxx_param_names, py_param_names)

# Check the positional parameters are the same.
cxx_positional_param_names = [
Expand Down
Loading

0 comments on commit ec124b9

Please sign in to comment.