vis4d.common.named_tuple

This module contains dictionary utility functions.

Functions

get_all_keys(entry)

Get all keys in a NamedTuple.

get_from_namedtuple(entry, key)

Get a value from a nested Named tuple.

is_namedtuple(obj)

Check if obj is namedtuple.

get_all_keys(entry)[source]

Get all keys in a NamedTuple.

Return type:

list[str]

get_from_namedtuple(entry, key)[source]

Get a value from a nested Named tuple.

Example passing key = “test.my.data” will resolve the value of the named tuple at ‘test’ ‘my’ ‘data’.

Raises:

ValueError – If the key is not present in the named tuple.

Return type:

Any

is_namedtuple(obj)[source]

Check if obj is namedtuple.

https://github.com/pytorch/pytorch/blob/v1.8.1/torch/nn/parallel/scatter_gather.py#L4-L8

Return type:

bool