nip.utils.maths.dict_sum

Contents

nip.utils.maths.dict_sum#

nip.utils.maths.dict_sum(dict_1: dict[Tensor], dict_2: dict[Tensor]) dict[Tensor][source]#

Calculate the sum of two dictionaries of tensors, element-wise.

Parameters:
  • dict_1 (dict[Tensor]) – The first dictionary.

  • dict_2 (dict[Tensor]) – The second dictionary.

Returns:

sum_dict (dict[Tensor]) – The sum of the two dictionaries.

Raises:

ValueError: – If the dictionaries do not have the same keys.