Skip to content

Commit d94390a

Browse files
committed
Simplify - with at-j
1 parent 525dd8f commit d94390a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/reverse_mode.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ function _forward_eval(
147147
@inbounds ix1 = children_arr[child1]
148148
@inbounds ix2 = children_arr[child1+1]
149149
for j in _eachindex(f.sizes, k)
150-
tmp_sub = _getindex(f.forward_storage, f.sizes, ix1, j)
151-
tmp_sub -= _getindex(f.forward_storage, f.sizes, ix2, j)
152-
_setindex!(f.partials_storage, one(T), f.sizes, ix1, j)
153-
_setindex!(f.partials_storage, -one(T), f.sizes, ix2, j)
154-
_setindex!(f.forward_storage, tmp_sub, f.sizes, k, j)
150+
tmp_sub = @j f.forward_storage[ix1]
151+
tmp_sub -= @j f.forward_storage[ix2]
152+
@j f.partials_storage[ix1] = one(T)
153+
@j f.partials_storage[ix2] = -one(T)
154+
@j f.forward_storage[k] = tmp_sub
155155
end
156156
elseif node.index == 3 # :*
157157
tmp_prod = one(T)

0 commit comments

Comments
 (0)