nip.utils.nested_array_dict.stack_nested_array_dicts

nip.utils.nested_array_dict.stack_nested_array_dicts#

nip.utils.nested_array_dict.stack_nested_array_dicts(nds: Sequence[NestedArrayDict], dim=0) NestedArrayDict[source]#

Stack a sequence of NestedArrayDicts along a new dimension.

Parameters:
  • nds (Sequence[NestedArrayDict]) – The NestedArrayDicts to stack. All NestedArrayDicts must have the same keys, shapes and batch sizes.

  • dim (int, default=0) – The dimension to stack along. This must be a non-negative integer at most equal to the number of batch dimensions.

Returns:

stacked (NestedArrayDict) – The NestedArrayDict with the stacked arrays. The batch size of the new NestedArrayDict is the batch size of the input NestedArrayDicts with the new dimension added.