Skip to content

Commit

Permalink
fix(ops): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Feb 25, 2024
1 parent ab02dba commit 11dd785
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions optree/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,17 @@ def tree_flatten_with_typed_path(
element is a list of leaf values and the last element is a treespec representing the
structure of the pytree.
""" # pylint: disable=line-too-long
leaves, treespec = _C.flatten(tree, is_leaf, none_is_leaf, namespace)
return treespec.typed_paths(), leaves, treespec


def tree_flatten_with_accessor(
tree: PyTree[T],
is_leaf: Callable[[T], bool] | None = None,
*,
none_is_leaf: bool = False,
namespace: str = '',
) -> tuple[list[PyTreeAccessor], list[T], PyTreeSpec]:
leaves, treespec = _C.flatten(tree, is_leaf, none_is_leaf, namespace)
return (

Check warning on line 377 in optree/ops.py

View check run for this annotation

Codecov / codecov/patch

optree/ops.py#L376-L377

Added lines #L376 - L377 were not covered by tests
[
Expand Down

0 comments on commit 11dd785

Please sign in to comment.