logger¶
Functions
Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function. |
Classes
Dummy logger for internal use. |
|
Base class for experiment loggers. |
Abstract base class used to build new loggers.
- class lightning.pytorch.loggers.logger.DummyLogger[소스]¶
기반 클래스:
lightning.pytorch.loggers.logger.Logger
Dummy logger for internal use.
It is useful if we want to disable user’s logger for a feature, but still ensure that user code can run
- log_metrics(*args, **kwargs)[소스]¶
Records metrics. This method logs metrics as soon as it received them.
- property experiment: lightning.fabric.loggers.logger._DummyExperiment¶
Return the experiment object associated with this logger.
- 반환 형식
_DummyExperiment
- class lightning.pytorch.loggers.logger.Logger[소스]¶
기반 클래스:
lightning.fabric.loggers.logger.Logger
,abc.ABC
Base class for experiment loggers.
- after_save_checkpoint(checkpoint_callback)[소스]¶
Called after model checkpoint callback saves a new checkpoint.
- 매개변수
checkpoint_callback¶ (
ModelCheckpoint
) – the model checkpoint callback instance- 반환 형식
- lightning.pytorch.loggers.logger.merge_dicts(dicts, agg_key_funcs=None, default_func=<function mean>)[소스]¶
Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function.
- 매개변수
dicts¶ (
Sequence
[Mapping
]) – Sequence of dictionaries to be merged.agg_key_funcs¶ (
Optional
[Mapping
]) – Mapping from key name to function. This function will aggregate a list of values, obtained from the same key of all dictionaries. If some key has no specified aggregation function, the default one will be used. Default is:None
(all keys will be aggregated by the default function).default_func¶ (
Callable
[[Sequence
[float
]],float
]) – Default function to aggregate keys, which are not presented in the agg_key_funcs map.
- 반환 형식
- 반환
Dictionary with merged values.
예제
>>> import pprint >>> d1 = {'a': 1.7, 'b': 2.0, 'c': 1, 'd': {'d1': 1, 'd3': 3}} >>> d2 = {'a': 1.1, 'b': 2.2, 'v': 1, 'd': {'d1': 2, 'd2': 3}} >>> d3 = {'a': 1.1, 'v': 2.3, 'd': {'d3': 3, 'd4': {'d5': 1}}} >>> dflt_func = min >>> agg_funcs = {'a': np.mean, 'v': max, 'd': {'d1': sum}} >>> pprint.pprint(merge_dicts([d1, d2, d3], agg_funcs, dflt_func)) {'a': 1.3, 'b': 2.0, 'c': 1, 'd': {'d1': 3, 'd2': 3, 'd3': 3, 'd4': {'d5': 1}}, 'v': 2.3}