vis4d.common.util

Utility functions for common usage.

Functions

create_did_you_mean_msg(keys, query)

Create a did you mean message.

init_random_seed()

Initialize random seed for the experiment.

set_random_seed(seed[, deterministic])

Set random seed.

set_tf32(use_tf32, precision)

Set torch TF32.

create_did_you_mean_msg(keys, query)[source]

Create a did you mean message.

Parameters:
  • keys (list[str]) – List of available keys.

  • query (str) – Query.

Returns:

Did you mean message.

Return type:

str

Examples

>>> keys = ["foo", "bar", "baz"]
>>> query = "fo"
>>> print(create_did_you_mean_msg(keys, query))
Did you mean:
    foo
init_random_seed()[source]

Initialize random seed for the experiment.

Return type:

int

set_random_seed(seed, deterministic=False)[source]

Set random seed.

Parameters:
  • seed (int) – Seed to be used.

  • deterministic (bool) – Whether to set the deterministic option for CUDNN backend, i.e., set torch.backends.cudnn.deterministic to True and torch.backends.cudnn.benchmark to False. Default: False.

Return type:

None

set_tf32(use_tf32, precision)[source]

Set torch TF32.

Parameters:
Return type:

None