Skip to content

Commit

Permalink
pytree
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Isaacson committed Aug 19, 2024
1 parent 60f37cc commit 3c188e2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/beignet/func/__dataclass.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dataclasses
from typing import List, Tuple, Type, TypeVar, Iterable

import optree
from torch.utils._pytree import register_pytree_node

T = TypeVar("T")

Expand Down Expand Up @@ -42,11 +42,10 @@ def _iterable_to_cls(meta, data) -> T:

return dataclass_cls(**kwargs)

optree.register_pytree_node(
register_pytree_node(
dataclass_cls,
_iterate_cls,
_iterable_to_cls,
namespace="beignet.func",
)

return dataclass_cls

0 comments on commit 3c188e2

Please sign in to comment.