in mbrl/util/logger.py [0:0]
def log_data(self, group_name: str, data: Mapping[str, LogTypes]):
"""Logs the data contained in a given dictionary to the given logging group.
Args:
group_name (str): the name of the logging group to use. It must have been registered
already, otherwise an exception will be thrown.
data (mapping str->(int/float/torch.Tensor)): the dictionary with the data. Each
keyword must be a variable name in the log format passed when creating this group.
"""
if group_name not in self._groups:
raise ValueError(f"Group {group_name} has not been registered.")
meter_group, dump_frequency, color = self._groups[group_name]
for key, value in data.items():
if isinstance(value, torch.Tensor):
value = value.item() # type: ignore
meter_group.log(key, value)
self._group_steps[group_name] += 1
if self._group_steps[group_name] % dump_frequency == 0:
self._dump(group_name)