Shortcuts

logger

Functions

merge_dicts

Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function.

Classes

DummyLogger

Dummy logger for internal use.

Logger

Base class for experiment loggers.

Abstract base class used to build new loggers.

class pytorch_lightning.loggers.logger.DummyLogger[source]

Bases: pytorch_lightning.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_hyperparams(*args, **kwargs)[source]

Record hyperparameters.

Parameters
  • paramsNamespace or Dict containing the hyperparameters

  • args (Any) – Optional positional arguments, depends on the specific logger being used

  • kwargs (Any) – Optional keyword arguments, depends on the specific logger being used

Return type

None

log_metrics(*args, **kwargs)[source]

Records metrics. This method logs metrics as soon as it received them.

Parameters
  • metrics – Dictionary with metric names as keys and measured quantities as values

  • step – Step number at which the metrics should be recorded

Return type

None

property experiment: lightning_fabric.loggers.logger._DummyExperiment

Return the experiment object associated with this logger.

Return type

_DummyExperiment

property name: str

Return the experiment name.

Return type

str

property version: str

Return the experiment version.

Return type

str

class pytorch_lightning.loggers.logger.Logger[source]

Bases: lightning_fabric.loggers.logger.Logger, abc.ABC

Base class for experiment loggers.

after_save_checkpoint(checkpoint_callback)[source]

Called after model checkpoint callback saves a new checkpoint.

Parameters

checkpoint_callback (ModelCheckpoint) – the model checkpoint callback instance

Return type

None

property save_dir: Optional[str]

Return the root directory where experiment logs get saved, or None if the logger does not save data locally.

Return type

Optional[str]

pytorch_lightning.loggers.logger.merge_dicts(dicts, agg_key_funcs=None, default_func=<function mean>)[source]

Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function.

Parameters
  • 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.

Return type

Dict

Returns

Dictionary with merged values.

Examples

>>> 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}
Read the Docs v: stable
Versions
latest
stable
1.8.3post1
1.8.3.post0
1.8.3
1.8.2
1.8.1
1.8.0.post1
1.8.0
1.7.7
1.7.6
1.7.5
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.10
1.5.9
1.5.8
1.5.7
1.5.6
1.5.5
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.8
1.3.7
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.10
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.10.0
0.9.0
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.0
0.5.3
0.4.9
Downloads
html
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.