We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa4e64a commit 9c2c05eCopy full SHA for 9c2c05e
src/back.jl
@@ -173,8 +173,9 @@ Calculate the output jacobian `J = d/dx m(x)` such that each row `i` of `J` corr
173
"""
174
function jacobian(f, x::AbstractVector)
175
y::AbstractVector, back = forward(f, x)
176
+ z = float(zero(eltype(data(y))))
177
# Using broadcasting so that output of `ȳ` is a GPU array if `y` is so:
- ȳ(i) = ((j, _) -> i == j).(1:length(y), y)
178
+ ȳ(i) = ((j, _) -> i == j).(1:length(y), y) .+ z
179
vcat([transpose(back(ȳ(i))[1]) for i = 1:length(y)]...)
180
end
181
0 commit comments