Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to get from TrackedFoo to Foo #398

Closed
oxinabox opened this issue Sep 14, 2018 · 1 comment
Closed

Document how to get from TrackedFoo to Foo #398

oxinabox opened this issue Sep 14, 2018 · 1 comment

Comments

@oxinabox
Copy link
Member

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:

data(x::TrackedReal) = x.data

related:

Is data(xs::AbstractArray{<:TrackedReal}) = data.(xs) defined?

Possibly it should be, if not
so that
AbstractArray{<:TrackedReal} and TrackedArray act the same

@MikeInnes
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants