vis4d.common.util¶
Utility functions for common usage.
Functions
|
Create a did you mean message. |
Initialize random seed for the experiment. |
|
|
Set random seed. |
|
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
- 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:
use_tf32 (
bool
) – Whether to use torch TF32. Details: https://pytorch.org/docs/stable/notes/cuda.html#tf32-on-ampereprecision (
str
) – Internal precision of float32 matrix multiplications. Details: https://pytorch.org/docs/stable/generated/torch.set_float32_matmul_precision.html#torch.set_float32_matmul_precision # pylint: disable=line-too-long
- Return type:
None