Can model layers be updated after a worker has executed the model?

I am exploring NEAT and related algorithms for evolving neural networks (inspired in part by https://weightagnostic.github.io/), and am wondering if a Barracuda Model can be dynamically updated once a Worker has been created and executed the Model. Examples of dynamic updates would be adding a new layer, removing a layer, or changing parameters of an existing layer (e.g. weights and biases of a Dense layer). By looking at the source code in Barracuda/Runtime/Core/ — Model.cs and ModelBuilder.cs in particular — I can infer how to update the model, but what is unclear to me is if/how those changes can be picked up by the model’s worker.

Can a worker handle dynamic changes to its underlying model? If not, what would be the correct way to destroy the worker and instantiate a new one for the updated model?

Thanks for the help!
Mikey

In theory, yes this should work, but some things can get precompiled down (e.g. PrecompiledComputeOps), so I’d suggest calling Dispose on your previous worker and instantiating a new one.

Yes, you can use the ModelBuilder to edit a existing model (add/remove layers).
But as @amirebrahimi_unity mentioned, you’d need to re-compile the worker with the new model.