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.
2 parents a5bcc63 + 8c0ba95 commit 96686cbCopy full SHA for 96686cb
src/zygote_adjoints.jl
@@ -1,20 +1,3 @@
1
-@adjoint function evaluate(s::SqEuclidean, x::AbstractVector, y::AbstractVector)
2
- δ = x .- y
3
- sum(abs2, δ), Δ -> begin
4
- x̄ = (2 * Δ) .* δ
5
- (nothing, x̄, -x̄)
6
- end
7
-end
8
-
9
-@adjoint function evaluate(s::Euclidean, x::AbstractVector, y::AbstractVector)
10
- D = x.-y
11
- δ = sqrt(sum(abs2,D))
12
- δ, Δ -> begin
13
- x̄ = Δ .* D / (δ + eps(δ))
14
15
16
17
18
@adjoint function evaluate(s::DotProduct, x::AbstractVector, y::AbstractVector)
19
dot(x,y), Δ -> begin
20
(nothing, Δ.*y, Δ.*x)
0 commit comments