aitune.torch.task.correctness
Correctness checking utilities.
Module Contents
Classes
Functions
API
Bases: ValueError
Error raised when dynamic-shape boundary inference fails.
Bases: ValueError
Error raised when tensor shapes do not match.
Bases: ValueError
Error raised when value is not finite i.e. NaN or infinity.
Check if model outputs contain any NaN or infinity values.
Parameters:
Model outputs. Dict, list, tensors or scalars. Strings are ignored.
Name of the output. If not provided, the name will be inferred from the output type.
Depth of the output. Auxiliary variable for recursive calls.
Raises:
CorrectnessCheckError: If any output contains NaN or infinity valuesValueError: If output does not contain tensors or scalars
Check if the output tensor shapes are the same as the original output tensor shapes.
Create min/max input samples for dynamic-shape correctness checks.
Note: These samples are intended only for validating min and max shapes. Their tensor values may be numerically invalid and can produce NaN or Inf outputs.
Resize each tensor input in a sample to the requested TensorSpec shape attribute.
Note: These samples are intended only for validating min and max shapes. Their tensor values may be numerically invalid and can produce NaN or Inf outputs.
Resize a tensor by slicing or repeating each axis to match a target shape.
Note: These samples are intended only for validating min and max shapes. Their tensor values may be numerically invalid and can produce NaN or Inf outputs.
Check dynamic-shape boundary inference.
Parameters:
Sample inputs used as a template for min and max shape checks.
Recorded graph metadata used to construct and validate boundary inputs.
Inference callable to validate.
Name of the module or backend being checked.
Returns:
None.
Raises:
CorrectnessDynamicShapeError: If inference fails on min or max shape inputs.CorrectnessTensorShapeError: If inferred output tensor shapes do not match the expected metadata.
Check recorded-sample inference output correctness.
Parameters:
Recorded samples to run through inference.
Recorded output metadata with expected output tensor shapes.
Inference callable to validate.
Name of the module or backend being checked.
Returns:
None.
Raises:
CorrectnessValueError: If any output value is NaN or infinite.CorrectnessTensorShapeError: If inferred output tensor shapes do not match the expected metadata.