Added shallow copy of last metric dict
import warnings
+from copy import copy
from collections import defaultdict
from typing import Union, Sequence, TYPE_CHECKING
from avalanche.training.plugins.strategy_plugin import StrategyPlugin
@@ -95,18 +96,18 @@ class EvaluationPlugin(StrategyPlugin):
def get_last_metrics(self):
"""
- Return dictionary with metric names as keys and last metrics
- value as values.
+ Return a shallow copy of dictionary with metric names
+ as keys and last metrics value as values.
:return: a dictionary with full metric
names as keys and last metric value as value.
"""
- return self.last_metric_results
+ return copy(self.last_metric_results)
def get_all_metrics(self):
"""
- Return all collected metrics. This method should be called
- only when `collect_all` is set to True.
+ Return the dictionary of all collected metrics.
+ This method should be called only when `collect_all` is set to True.
:return: if `collect_all` is True, returns a dictionary
with full metric names as keys and a tuple of two lists
