See each this conversation.
<@JonasIsensee>
Hey there,
I just started playing with Flux and ML in general for the first time.How can I plot predictions?
scatter(y, predict.(x))
gives me the following
MethodError: no method matching Float64(::Flux.Tracker.TrackedReal{Float64}<@JonasIsensee>
This seems to work
yhat = map(x -> x[1].data, predict.(x))
I can never remember how to do it.
And I always endup looking around the code base for:
related:
Is data(xs::AbstractArray{<:TrackedReal}) = data.(xs) defined?
Possibly it should be, if not
so that
AbstractArray{<:TrackedReal} and TrackedArray act the same
We can mention this in the docs if we aren't already. Calling Tracker.data(x) seems like it's about as simple as this is going to get though.
The AbstractArray{<:TrackedReal} thing is tricky, especially because you don't want AbstractArray{Any} to behave differently. But I don't think it'd hurt to just always broadcast over any abstractarray.
Most helpful comment
We can mention this in the docs if we aren't already. Calling
Tracker.data(x)seems like it's about as simple as this is going to get though.The
AbstractArray{<:TrackedReal}thing is tricky, especially because you don't wantAbstractArray{Any}to behave differently. But I don't think it'd hurt to just always broadcast over any abstractarray.