Shortcuts

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

set_list_to_stack.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources