@@ -8,9 +8,11 @@ using DiffMatic: Variable, KrD, Zero
88using DiffMatic: BinaryOperation, UnaryOperation
99using DiffMatic: IndexList
1010
11+ dc = DiffMatic
12+
1113# Shortcut for simpler comparison from
1214# https://stackoverflow.com/questions/62336686/struct-equality-with-arrays
13- function Base.:(== )(a:: T , b:: T ) where {T<: DiffMatic .Tensor }
15+ function Base.:(== )(a:: T , b:: T ) where {T<: dc .Tensor }
1416 f = fieldnames (T)
1517
1618 return (getfield .(Ref (a), f) == getfield .(Ref (b), f)) ||
@@ -46,13 +48,13 @@ function equivalent(arg1::Real, arg2::Real)
4648end
4749
4850function equivalent (left, right)
49- left_ids, right_ids = DiffMatic . get_free_indices .((left, right))
51+ left_ids, right_ids = dc . get_free_indices .((left, right))
5052
5153 return can_remap (left_ids, right_ids)
5254end
5355
5456function equivalent (left:: Variable , right:: Variable )
55- left_ids, right_ids = DiffMatic . get_free_indices .((left, right))
57+ left_ids, right_ids = dc . get_free_indices .((left, right))
5658
5759 return left. id == right. id && can_remap (left_ids, right_ids)
5860end
@@ -62,7 +64,7 @@ function equivalent(left::KrD, right::KrD)
6264end
6365
6466function equivalent (left:: Zero , right:: Zero )
65- return can_remap (DiffMatic . get_free_indices (left), DiffMatic . get_free_indices (right))
67+ return can_remap (dc . get_free_indices (left), dc . get_free_indices (right))
6668end
6769
6870function equivalent (left:: BinaryOperation , right:: BinaryOperation )
0 commit comments