Shortcuts

EpochOutputStore#

class ignite.handlers.stores.EpochOutputStore(output_transform=<function EpochOutputStore.<lambda>>)[source]#

EpochOutputStore handler to save output prediction and target history after every epoch, could be useful for e.g., visualization purposes.

Note

This can potentially lead to a memory error if the output data is larger than available RAM.

Parameters

output_transform (Callable) – a callable that is used to transform the Engine’s process_function’s output , e.g., lambda x: x[0]

data#

a list of Engine outputs, optionally transformed by output_transform.

Examples

eos = EpochOutputStore()
trainer = create_supervised_trainer(model, optimizer, loss)
train_evaluator = create_supervised_evaluator(model, metrics)
eos.attach(train_evaluator, 'output')

@trainer.on(Events.EPOCH_COMPLETED)
def log_training_results(engine):
    train_evaluator.run(train_loader)
    output = train_evaluator.state.output
    # output = [(y_pred0, y0), (y_pred1, y1), ...]
    # do something with output, e.g., plotting

New in version 0.4.5.

Changed in version 0.4.5: attach now accepts an optional argument name

Methods

attach

Attaching reset method at EPOCH_STARTED and update method at ITERATION_COMPLETED.

reset

Reset the attribute data to empty list.

store

Store self.data on engine.state.{self.name}

update

Append the output of Engine to attribute data.

attach(engine, name=None)[source]#

Attaching reset method at EPOCH_STARTED and update method at ITERATION_COMPLETED.

If name is passed, will store self.data on engine.state under name.

Parameters
Return type

None

reset()[source]#

Reset the attribute data to empty list.

Return type

None

store(engine)[source]#

Store self.data on engine.state.{self.name}

Parameters

engine (Engine) –

Return type

None

update(engine)[source]#

Append the output of Engine to attribute data.

Parameters

engine (Engine) –

Return type

None