list_to_stack¶
- class tensordict.list_to_stack(allow_none=False)¶
Retrieves the current setting for list-to-stack conversion in TensorDict.
This function checks the global environment variable or the context manager setting to determine whether lists should be automatically stacked when assigned to a TensorDict.
- Current Behavior:
- Returns the current setting for list-to-stack conversion. If the setting is not defined and allow_none
is True, it returns None. Otherwise, it returns the default setting.
- Future Behavior:
The default behavior will change in version 0.10.0 to automatically stack lists.
- Parameters:
allow_none (bool) – If True, allows the function to return None if the setting is not defined.
- Returns:
The current setting for list-to-stack conversion.
- Return type:
bool or None
See also