Skip to content

Commit 56f25bf

Browse files
committed
Update TestUtils
1 parent a625148 commit 56f25bf

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/TestUtils.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ using DiffMatic: Variable, KrD, Zero
88
using DiffMatic: BinaryOperation, UnaryOperation
99
using 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)
4648
end
4749

4850
function 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)
5254
end
5355

5456
function 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)
5860
end
@@ -62,7 +64,7 @@ function equivalent(left::KrD, right::KrD)
6264
end
6365

6466
function 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))
6668
end
6769

6870
function equivalent(left::BinaryOperation, right::BinaryOperation)

0 commit comments

Comments
 (0)