returnn.tensor.tensor_dict

Dict of tensors.

For example the extern_data in the user config is such a dict, describing the data coming from the dataset (after batch preparation).

We also might have model_outputs in the user config. (https://github.com/rwth-i6/returnn/issues/1166)

class returnn.tensor.tensor_dict.TensorDict(data: Dict[str, Tensor] | Sequence[Tensor] | None = None)[source]

dict of tensors

update(data: Dict[str, Tensor | Dict[str, Any]] | Sequence[Tensor | Dict[str, Any]] | TensorDict, *, auto_convert: bool = False)[source]
reset_content()[source]

reset content, i.e. all raw_tensor’s to None, including dyn_size_ext of dim tags

copy_template() TensorDict[source]

copy template

as_raw_tensor_dict(*, include_const_sizes: bool = False, include_scalar_dyn_sizes: bool = True, exclude_duplicate_dims: bool = False, expected_value_type: ~typing.Type | ~typing.Sequence[~typing.Type] = <class 'object'>) Dict[str, Any][source]
Returns:

dict of raw tensors, including any sequence lengths / dynamic sizes

assign_from_raw_tensor_dict_(raw_tensor_dict: Dict[str, Any], *, with_scalar_dyn_sizes: bool = True, duplicate_dims_are_excluded: bool = False)[source]
Parameters:
  • raw_tensor_dict – dict of raw tensors, including any sequence lengths / dynamic sizes

  • with_scalar_dyn_sizesinclude_scalar_dyn_sizes was used in as_raw_tensor_dict()

  • duplicate_dims_are_excludedexclude_duplicate_dims was used in as_raw_tensor_dict()