# MethodError: objects of type Float64 are not callable

**URL:** <https://discourse.julialang.org/t/methoderror-objects-of-type-float64-are-not-callable/81876>\
**Category:** Machine Learning\
**Tags:** flux\
**Created:** [May 29, 2022, 5:38pm UTC](https://discourse.julialang.org/t/methoderror-objects-of-type-float64-are-not-callable/81876 "2022-05-29T17:38:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ToucheSir](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/touchesir/32/14411_2.png) [@ToucheSir](https://discourse.julialang.org/u/ToucheSir)\
**Post date:** [May 29, 2022, 6:04pm UTC](https://discourse.julialang.org/t/methoderror-objects-of-type-float64-are-not-callable/81876/3 "2022-05-29T18:04:11Z")

</div>

If you print out `typeof(loss)`, you will see that it is a `Float64` and not a function as you would expect. Thus calling it fails because you can’t call a floating point number 😉

More broadly, Zygote requires that _all_ the code between the first use of the input `x` and the final calculation of `loss` needs to be inside that callback you pass to `gradient`. That means at least line 125-135 and possibly higher up in your file. I would highly, highly recommend you read through [Basics · Flux](https://fluxml.ai/Flux.jl/stable/models/basics/) and/or [Overview · Flux](https://fluxml.ai/Flux.jl/stable/models/overview/) to get an understanding of how the library works before continuing.

---

_[View the full topic](https://discourse.julialang.org/t/methoderror-objects-of-type-float64-are-not-callable/81876)._
