Trainer defined as
trainer = create_supervised_trainer(~)
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.state.model.my_attribute = new_attribute
About using Engine, see https://pytorch.org/ignite/concepts.html#engine .
About State, please, see the documentation on it : https://pytorch.org/ignite/engine.html#ignite.engine.State and https://pytorch.org/ignite/concepts.html#state
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:
engine.state.new_attribute = 12345