Skip to content

Commit

Permalink
Resolve #235 (#237)
Browse files Browse the repository at this point in the history
* Fix mul

* Bump patch
  • Loading branch information
willtebbutt authored Aug 14, 2023
1 parent 105290f commit 6c7b9cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ReverseDiff"
uuid = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
version = "1.15.0"
version = "1.15.1"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
2 changes: 1 addition & 1 deletion src/derivatives/linalg/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ for (f, F) in ((:transpose, :Transpose), (:adjoint, :Adjoint))
# f(a) * b
function reverse_mul!(output, output_deriv, a::$F, b, a_tmp, b_tmp)
_a = ($f)(a)
istracked(_a) && increment_deriv!(_a, ($f)(mul!(a_tmp, output_deriv, value(b))))
istracked(_a) && increment_deriv!(_a, ($f)(mul!(a_tmp, output_deriv, ($f)(value(b)))))
istracked(b) && increment_deriv!(b, mul!(b_tmp, ($f)(mulargvalue(a)), ($f)(output_deriv)))
end
# f(a) * f(b)
Expand Down
4 changes: 4 additions & 0 deletions test/derivatives/LinAlgTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,8 @@ test_println("*(A, B) functions", "*(transpose(a), adjoint(b))")
test_arr2arr(*, transpose(a), adjoint(b), tp)
test_arr2arr_inplace(mul!, *, x, transpose(a), adjoint(b), tp)

# Prevent regression on https://github.com/JuliaDiff/ReverseDiff.jl/issues/235
A = [1 2; 3 4]; x = [5, 6];
@test ReverseDiff.gradient(y -> sum(y'*A), x) == [3, 7]

end # module

4 comments on commit 6c7b9cf

@willtebbutt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Register Failed
@willtebbutt, it looks like you are not a publicly listed member/owner in the parent organization (JuliaDiff).
If you are a member/owner, you will need to change your membership to public. See GitHub Help

@willtebbutt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/89643

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.15.1 -m "<description of version>" 6c7b9cfbb06cc1e91d36be12746aaeb55e433ff4
git push origin v1.15.1

Please sign in to comment.