mridc.core.utils package

Submodules

mridc.core.utils.neural_type_utils module

mridc.core.utils.neural_type_utils.extract_dynamic_axes(name: str, ntype: NeuralType)[source]

This method will extract BATCH and TIME dimension ids from each provided input/output name argument.

For example, if module/model accepts argument named “input_signal” with type corresponding to [Batch, Time, Dim] shape, then the returned result should contain “input_signal” -> [0, 1] because Batch and Time are dynamic axes as they can change from call to call during inference.

Parameters
  • name (Name of input or output parameter) –

  • ntype (Corresponding Neural Type) –

Return type

A dictionary with input/output name as key and a list of dynamic axes as value.

mridc.core.utils.neural_type_utils.get_dynamic_axes(types, names)[source]

This method will return a dictionary with input/output names as keys and a list of dynamic axes as values.

Parameters
  • types (The NeuralType of the module or model to be inspected.) –

  • names (A list of names that should be inspected.) –

Return type

A dictionary with input/output names as keys and a list of dynamic axes as values.

mridc.core.utils.neural_type_utils.get_io_names(types, disabled_names)[source]

This method will return a list of input and output names for a given NeuralType.

Parameters
  • types (The NeuralType of the module or model to be inspected.) –

  • disabled_names (A list of names that should be excluded from the result.) –

Return type

A list of input and output names.

mridc.core.utils.numba_utils module

mridc.core.utils.numba_utils.is_numba_compat_strict() bool[source]

Returns strictness level of numba cuda compatibility checks. If value is true, numba cuda compatibility matrix must be satisfied. If value is false, only cuda availability is checked, not compatibility. Numba Cuda may still compile and run without issues in such a case, or it may fail.

mridc.core.utils.numba_utils.numba_cpu_is_supported(min_version: str) bool[source]

Tests if an appropriate version of numba is installed.

Parameters

min_version (The minimum version of numba that is required.) –

Return type

bool, whether numba CPU supported with this current installation or not.

mridc.core.utils.numba_utils.numba_cuda_is_supported(min_version: str) bool[source]

Tests if an appropriate version of numba is installed, and if it is, if cuda is supported properly within it.

Parameters

min_version (The minimum version of numba that is required.) –

Return type

Whether cuda is supported with this current installation or not.

mridc.core.utils.numba_utils.set_numba_compat_strictness(strict: bool)[source]

Sets the strictness level of numba cuda compatibility checks. If value is true, numba cuda compatibility matrix must be satisfied. If value is false, only cuda availability is checked, not compatibility. Numba Cuda may still compile and run without issues in such a case, or it may fail.

Parameters

strict (Whether to enforce strict compatibility checks or relax them.) –

mridc.core.utils.numba_utils.skip_numba_cuda_test_if_unsupported(min_version: str)[source]

Helper method to skip pytest test case if numba cuda is not supported.

Parameters

min_version (The minimum version of numba that is required.) –

mridc.core.utils.numba_utils.with_numba_compat_strictness(strict: bool)[source]

Context manager to temporarily set numba cuda compatibility strictness.

Module contents