Reduce

packnet_sfm.utils.reduce.all_reduce_metrics(output_data_batch, datasets, name='depth')[source]
packnet_sfm.utils.reduce.average_key(batch_list, key)[source]

Average key in a list of batches

Parameters
  • batch_list (list of dict) – List containing dictionaries with the same keys

  • key (str) – Key to be averaged

Returns

average – Average of the value contained in key for all batches

Return type

float

packnet_sfm.utils.reduce.average_loss_and_metrics(batch_list, prefix)[source]

Average loss and metrics values in a list of batches

Parameters
  • batch_list (list of dict) – List containing dictionaries with the same keys

  • prefix (str) – Prefix string for metrics logging

Returns

values – Dictionary containing a ‘loss’ float entry and a ‘metrics’ dict entry

Return type

dict

packnet_sfm.utils.reduce.average_sub_key(batch_list, key, sub_key)[source]

Average subkey in a dictionary in a list of batches

Parameters
  • batch_list (list of dict) – List containing dictionaries with the same keys

  • key (str) – Key to be averaged

  • sub_key – Sub key to be averaged (belonging to key)

Returns

average – Average of the value contained in the sub_key of key for all batches

Return type

float

packnet_sfm.utils.reduce.collate_metrics(output_data_batch, name='depth')[source]

Collate epoch output to produce average metrics.

packnet_sfm.utils.reduce.create_dict(metrics_data, metrics_keys, metrics_modes, dataset, name='depth')[source]

Creates a dictionary from collated metrics.

packnet_sfm.utils.reduce.reduce_dict(dict, to_item=False)[source]

Reduce the mean values of a dictionary from all GPUs

packnet_sfm.utils.reduce.reduce_value(value)[source]

Reduce the mean value of a tensor from all GPUs