axon icon indicating copy to clipboard operation
axon copied to clipboard

Separate state parameters and actual parameters in parameter map

Open seanmor5 opened this issue 2 years ago • 2 comments

Related to #453 by grouping these together in the same part of the map we've run into lots of issues with state getting updated when it was not meant to be. I propose we make an adjustment to how Axon stores parameters by partitioning the map into parameters and state:

%{
    parameters: %{...},
    state: %{...}
   }

Then it should be clear what works on what. This could even be a struct if we want additional strictness

seanmor5 avatar Apr 13 '23 00:04 seanmor5

Thinking about this I am considering doing the following:

Creating a struct %Axon.ModelState{parameters: ..., state: ...} and then adding methods:

def update_state(%ModelState{}, state) :: model_state
def update_parameters(%ModelState{}, parameters) :: model_state

And then those will replace what's currently in Axon.Updates and Axon.Loop.

cc @jonatanklosko because this would require Bumblebee changes

seanmor5 avatar Apr 13 '23 20:04 seanmor5

For more context, this would prevent model state from being passed through Axon.Updates as this is unnecessary. So you'd only pass parameters to those and then update the state elsewhere.

seanmor5 avatar Apr 13 '23 20:04 seanmor5

Resolved in #553

seanmor5 avatar May 10 '24 17:05 seanmor5