Skip to content

Commit

Permalink
style: miscellaneous style housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Mar 25, 2024
1 parent b3e2abf commit a2cafe3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion optree/integration/jax.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def tree_ravel(
A pair ``(array, unravel_func)`` where the first element is a 1D array representing the
flattened and concatenated leaf values, with ``dtype`` determined by promoting the
``dtype``\s of leaf values, and the second element is a callable for unflattening a 1D array
of the same length back to a pytree of of the same structure as the input ``tree``. If the
of the same length back to a pytree of the same structure as the input ``tree``. If the
input pytree is empty (i.e. has no leaves) then as a convention a 1D empty array of the
default dtype is returned in the first component of the output.
"""
Expand Down
2 changes: 1 addition & 1 deletion optree/integration/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def tree_ravel(
A pair ``(array, unravel_func)`` where the first element is a 1D array representing the
flattened and concatenated leaf values, with ``dtype`` determined by promoting the
``dtype``\s of leaf values, and the second element is a callable for unflattening a 1D array
of the same length back to a pytree of of the same structure as the input ``tree``. If the
of the same length back to a pytree of the same structure as the input ``tree``. If the
input pytree is empty (i.e. has no leaves) then as a convention a 1D empty array of the
default dtype is returned in the first component of the output.
"""
Expand Down
2 changes: 1 addition & 1 deletion optree/integration/torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def tree_ravel(
A pair ``(tensor, unravel_func)`` where the first element is a 1D tensor representing the
flattened and concatenated leaf values, with ``dtype`` determined by promoting the
``dtype``\s of leaf values, and the second element is a callable for unflattening a 1D tensor
of the same length back to a pytree of of the same structure as the input ``tree``. If the
of the same length back to a pytree of the same structure as the input ``tree``. If the
input pytree is empty (i.e. has no leaves) then as a convention a 1D empty tensor of the
default dtype is returned in the first component of the output.
"""
Expand Down
2 changes: 0 additions & 2 deletions optree/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ def total_order_sorted(
if key is None:

def key_fn(x: T) -> tuple[str, Any]:
# pylint: disable-next=consider-using-f-string
return (f'{x.__class__.__module__}.{x.__class__.__qualname__}', x)

else:

def key_fn(x: T) -> tuple[str, Any]:
y = key(x)
# pylint: disable-next=consider-using-f-string
return (f'{y.__class__.__module__}.{y.__class__.__qualname__}', y)

try:
Expand Down

0 comments on commit a2cafe3

Please sign in to comment.