# Lux.jl QuickStart: why \`Lux.apply\` returns the state?

**URL:** <https://discourse.julialang.org/t/lux-jl-quickstart-why-lux-apply-returns-the-state/125607>\
**Category:** Machine Learning\
**Tags:** neural-network, lux\
**Created:** [February 6, 2025, 9:36am UTC](https://discourse.julialang.org/t/lux-jl-quickstart-why-lux-apply-returns-the-state/125607 "2025-02-06T09:36:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [February 6, 2025, 9:36am UTC](https://discourse.julialang.org/t/lux-jl-quickstart-why-lux-apply-returns-the-state/125607/1 "2025-02-06T09:36:59Z")

</div>

In the [QuickStart section](https://github.com/LuxDL/Lux.jl?tab=readme-ov-file#-quickstart) of Lux.jl documentation, there is the line

```julia
y, st = Lux.apply(model, x, ps, st)

```

Why does `Lux.apply` return not only `y` but also `st`? How can inference computations change the neural network state? In fact, for the quick start example, the returned `st` is identical to the old `st`, as you could verify with `===`.

---

<div class="post-metadata">

**Author:** ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Post date:** [February 6, 2025, 9:55am UTC](https://discourse.julialang.org/t/lux-jl-quickstart-why-lux-apply-returns-the-state/125607/2 "2025-02-06T09:55:10Z")

</div>

OK, reading the docs a bit more, it looks like `Dropout` and `BatchNorm` layers have useful states that are updated, like tracked statistics.
