# What does \`Flux.@treelike\` do?

**URL:** <https://discourse.julialang.org/t/what-does-flux-treelike-do/19975>\
**Category:** Machine Learning\
**Tags:** first-steps, flux\
**Created:** [January 23, 2019, 12:08pm UTC](https://discourse.julialang.org/t/what-does-flux-treelike-do/19975 "2019-01-23T12:08:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [January 23, 2019, 12:08pm UTC](https://discourse.julialang.org/t/what-does-flux-treelike-do/19975/1 "2019-01-23T12:08:03Z")

</div>

What does `Flux.@treelike` do?

In Flux’s source code, I see a lot of Flux’s layers are defined and then `@treelike` is called. .E.g. `@treelike Dense`.

---

<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:** [January 23, 2019, 1:21pm UTC](https://discourse.julialang.org/t/what-does-flux-treelike-do/19975/2 "2019-01-23T13:21:34Z")

</div>

IIRC it tells functions like `params()` to look at the fields of the struct, like `Dense.W`, so that the optimisers can find the parameters.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [January 24, 2019, 3:24am UTC](https://discourse.julialang.org/t/what-does-flux-treelike-do/19975/3 "2019-01-24T03:24:12Z")

</div>

If that’s the case then I can help with documentation. Let me dig into the code.
