- AveragePrecisionRecall.detach(engine: ~ignite.engine.engine.Engine, usage: ~typing.Union[str, ~ignite.metrics.metric.MetricUsage] = <ignite.metrics.metric.EpochWise object>) None #
Detaches current metric from the engine and no metric’s computation is done during the run. This method in conjunction with
attach()can be useful if several metrics need to be computed with different periods. For example, one metric is computed every training epoch and another metric (e.g. more expensive one) is done every n-th training epoch.
engine: the engine from which the metric must be detached usage: the usage of the metric. Valid string values should be
‘epoch_wise’ (default) or ‘batch_wise’.
metric = ... engine = ... metric.detach(engine) assert "mymetric" not in engine.run(data).metrics assert not metric.is_attached(engine)
Example with usage:
metric = ... engine = ... metric.detach(engine, usage="batch_wise") assert "mymetric" not in engine.run(data).metrics assert not metric.is_attached(engine, usage="batch_wise")