# How often is Loss Function executed

**URL:** <https://discourse.julialang.org/t/how-often-is-loss-function-executed/60391>\
**Category:** New to Julia\
**Created:** [May 1, 2021, 5:57pm UTC](https://discourse.julialang.org/t/how-often-is-loss-function-executed/60391 "2021-05-01T17:57:43Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![czylabsonasa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/czylabsonasa/32/8663_2.png) [@czylabsonasa](https://discourse.julialang.org/u/czylabsonasa)\
**Post date:** [May 4, 2021, 7:26pm UTC](https://discourse.julialang.org/t/how-often-is-loss-function-executed/60391/11 "2021-05-04T19:26:40Z")

</div>

I think the answer is: if your intention is to reassign of some member of your struct then you should use mutable (for the primitive type Int the expression cntr+=1 is reassignment, we need mutable) but there is no reassignment for callsat in the above example, you only mutate its content. But maybe some expert will explain you better.  
read this: [Assignment and mutation - #4 by StefanKarpinski](https://discourse.julialang.org/t/assignment-and-mutation/19119/4)  
and this: [Julia Learning Circle: Memory Allocations and Garbage Collection · W.](https://wesselb.github.io/2020/11/23/julia-learning-circle-meeting-2.html)

---

_[View the full topic](https://discourse.julialang.org/t/how-often-is-loss-function-executed/60391)._
