Two DataTrees are considered isomorphic if the set of paths to their descendent nodes are the same. Nothing about the data or attrs in each node is checked. Isomorphism is a necessary condition for two trees to be used in a nodewise binary operation, such as tree1 + tree2.
(a: DataTree, b: DataTree)
| 54 | |
| 55 | @ensure_warnings |
| 56 | def assert_isomorphic(a: DataTree, b: DataTree): |
| 57 | """ |
| 58 | Two DataTrees are considered isomorphic if the set of paths to their |
| 59 | descendent nodes are the same. |
| 60 | |
| 61 | Nothing about the data or attrs in each node is checked. |
| 62 | |
| 63 | Isomorphism is a necessary condition for two trees to be used in a nodewise binary operation, |
| 64 | such as tree1 + tree2. |
| 65 | |
| 66 | Parameters |
| 67 | ---------- |
| 68 | a : DataTree |
| 69 | The first object to compare. |
| 70 | b : DataTree |
| 71 | The second object to compare. |
| 72 | |
| 73 | See Also |
| 74 | -------- |
| 75 | DataTree.isomorphic |
| 76 | assert_equal |
| 77 | assert_identical |
| 78 | """ |
| 79 | __tracebackhide__ = True |
| 80 | assert isinstance(a, type(b)) |
| 81 | |
| 82 | if isinstance(a, DataTree): |
| 83 | assert a.isomorphic(b), diff_datatree_repr(a, b, "isomorphic") |
| 84 | else: |
| 85 | raise TypeError(f"{type(a)} not of type DataTree") |
| 86 | |
| 87 | |
| 88 | def maybe_transpose_dims(a, b, check_dim_order: bool): |
nothing calls this directly
no test coverage detected
searching dependent graphs…