Open SebastianM-C opened 4 years ago
Wouldn't just computing knn by itself and then differentiating through the distance function give the same result?
I'm not sure I understand what you mean. Could you please elaborate a bit more?
I think this is still an issue.
I'm trying defining a loss function as:
function loss(model, x, y)
sum(nn(tree, model(x))[2] .^ 2)
end
(Yes, instead of y
I'm using the nearest neighbor!)
And Flux.train!
returns
Mutating arrays is not supported -- called setindex!(Vector{Int64}, ...)
This error occurs when you ask Zygote to differentiate operations that change
the elements of arrays in place (e.g. setting values with x .= ...)
Would it make sense to be able to autodiff through
knn
s?I tried using
ForwardDiff
but due to the definition of distances
and the fact that a dual number distance is asigned to elements of that vector
I get the following error with the code above: