Closed as not planned
Description
They are caused by EnzymeAD/Enzyme.jl#1354, because we define our array-to-scalar scenarios as:
f_vector_scalar(x::AbstractVector)::Number = sum(sin, x)
f_matrix_scalar(x::AbstractMatrix)::Number = sum(sin, x)
If instead we do the following, problem solved, but it allocates:
f_vector_scalar(x::AbstractVector)::Number = sum(sin.(x))
f_matrix_scalar(x::AbstractMatrix)::Number = sum(sin.(x))
We need scalar-valued functions which
- do not allocate
- do not use LinearAlgebra
- have different derivatives for every component
My suggestion would be
function f_vector_scalar(x::AbstractVector)::Number
s = zero(eltype(x))
for i in eachindex(x)
s += sin(i * x[i])
end
return s
end
but it causes JuliaDiff/Diffractor.jl#280
Metadata
Metadata
Assignees
Labels
No labels