-
-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Description
It's not possible to differentiate through a matrix constructed from a multidimensional array comprehension, which returns a ProductIterator type with no adjoint. MWE:
julia> using Zygote
julia> X = rand(4);
julia> Σ(λ) = [exp(-((x-x′)/λ)^2) for x in X, x′ in X]
Σ (generic function with 1 method)
julia> gradient(λ -> sum(Σ(λ)), 0.2)
ERROR: Need an adjoint for constructor Base.Iterators.ProductIterator{Tuple{Array{Float64,1},Array{Float64,1}}}. Gradient is of type Array{Tuple{Float64,Float64},2}
julia> gradient(λ -> sum([x^2/λ for x in X]), 0.2) # simple generator OK
(-46.45199007830025,)
Originally posted by @mcabbott in #377 (comment)
collodi
Metadata
Metadata
Assignees
Labels
No labels