is just a configured Engine. Engine, by default, does not store any info on model, optimizer, loss etc.
This can be done if needed like that:
trainer = ...
# trainer.state is not None in recent nightly releases: 0.4.0.dev202005XX
trainer.state.model = model
trainer.state.optimizer = optimizer
# otherwise, in stable v0.3.0, you need to set attributes in a handler attached to `Events.STARTED`
@trainer.on(Events.EPOCH_STARTED(once=10)
def change_attribute(engine):
trainer.state.model.my_attribute = new_attribute
A good practice is to use State also as a storage of user data created in update or handler functions. For example, we would like to save new_attribute in the state: