MeanDice.attach#

MeanDice.attach(engine: ~ignite.engine.engine.Engine, name: str, usage: ~typing.Union[str, ~ignite.metrics.metric.MetricUsage] = <ignite.metrics.metric.EpochWise object>) None#

Attaches current metric to provided engine. On the end of engine’s run, engine.state.metrics dictionary will contain computed metric’s value under provided name.

Args:

engine: the engine to which the metric must be attached name: the name of the metric to attach usage: the usage of the metric. Valid string values should be

ignite.metrics.metric.EpochWise.usage_name (default) or ignite.metrics.metric.BatchWise.usage_name.

Examples:

metric = ...
metric.attach(engine, "mymetric")

assert "mymetric" in engine.run(data).metrics

assert metric.is_attached(engine)

Example with usage:

metric = ...
metric.attach(engine, "mymetric", usage=BatchWise.usage_name)

assert "mymetric" in engine.run(data).metrics

assert metric.is_attached(engine, usage=BatchWise.usage_name)