# Flux: MethodError: no method matching Float32(::Tracker.TrackedReal{Float32})

**URL:** <https://discourse.julialang.org/t/flux-methoderror-no-method-matching-float32-tracker-trackedreal-float32/26018>\
**Category:** Machine Learning\
**Tags:** flux\
**Created:** [July 4, 2019, 5:45pm UTC](https://discourse.julialang.org/t/flux-methoderror-no-method-matching-float32-tracker-trackedreal-float32/26018 "2019-07-04T17:45:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlrs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rlrs/32/18043_2.png) [@rlrs](https://discourse.julialang.org/u/rlrs)\
**Post date:** [July 4, 2019, 5:45pm UTC](https://discourse.julialang.org/t/flux-methoderror-no-method-matching-float32-tracker-trackedreal-float32/26018/1 "2019-07-04T17:45:04Z")

</div>

I’m trying to calculate gradients through a chain of NN applications where I have some other differentiable operations in between, but Flux fails with the error in the title. I have made a minimal example to show the problem I have, showing the first iteration of the chain plus the first steps of the second iteration:

```julia
using Flux
using Flux.Tracker

net = Dense(4, 1)
s = rand(Float32, 4)

a = net(s)[1]
s1, s2, s3, s4 = s
ns = [s1 + a, s2, s3, s4]
s = ns

a = net(s)[1] # error

```

It seems that the problem has something to do with the (s1 + a) entry in ns, but I don’t see why it’s an issue? I need gradients back through a, and back through s1 in subsequent calls (not in the first one shown here, though), with respect to the NN parameters.

---

<div class="post-metadata">

**Author:** ![improbable22](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/improbable22/32/5464_2.png) [@improbable22](https://discourse.julialang.org/u/improbable22)\
**Post date:** [July 4, 2019, 6:00pm UTC](https://discourse.julialang.org/t/flux-methoderror-no-method-matching-float32-tracker-trackedreal-float32/26018/2 "2019-07-04T18:00:17Z")

</div>

I think you’re looking for `Tracker.collect(s)`. The `ns` is an array of TrackedReals, rather than a TrackedArray of floats.

---

<div class="post-metadata">

**Author:** ![rlrs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rlrs/32/18043_2.png) [@rlrs](https://discourse.julialang.org/u/rlrs)\
**Post date:** [July 4, 2019, 6:08pm UTC](https://discourse.julialang.org/t/flux-methoderror-no-method-matching-float32-tracker-trackedreal-float32/26018/3 "2019-07-04T18:08:11Z")

</div>

That seems to have worked, thanks. That function seems to not be documented by Flux, but perhaps it would be obvious if I were more familiar with Julia?
