pytensor_ml.model.Model.initialize#

Model.initialize(seed=None, initializers=None)#

Redraw every trainable weight from its own initializer, in place, and return self.

Each parameter was already built holding a draw, so this is what makes a run reproducible rather than what makes it trainable: one seed regenerates all of them. Every layer declares how each parameter it builds is drawn, so a batch norm layer redraws to its identity transform and a bias to zero.

Parameters:
seedint or numpy Generator, optional

Seed for reproducible initialization.

initializersdict mapping parameter to Initializer, optional

How to draw specific parameters, in place of what they declare. Keyed by the parameter object, reached through the layer that owns it – {block.ff.fc_in.b: ...} – so a parameter no constructor keyword exposes is still addressable.