CustomValidationConfig.Builder

public static class CustomValidationConfig.Builder extends Object

Builder class.

Public Constructor Summary

Builder()
Creates the custom validation config builder.

Public Method Summary

CustomValidationConfig
build()
Returns the CustomValidationConfig result.
CustomValidationConfig.Builder
CustomValidationConfig.Builder
setBatchSize(int value)
Sets the number of batches of the golden input.
CustomValidationConfig.Builder
setGoldenConfig(AccelerationConfig value)
Sets the AccelerationConfig used to calculate golden output if the CustomValidationConfig.goldenOutputs() is not provided.
CustomValidationConfig.Builder
setGoldenInputs(Object... value)
Sets the golden input of validation test.
CustomValidationConfig.Builder
setGoldenOutputs(ByteBuffer... value)
Sets the golden output used for accuracy validation.
CustomValidationConfig.Builder
setInferenceTimeoutMillis(long value)
Sets the time out setting for a validation test.

Inherited Method Summary

Public Constructors

public Builder ()

Creates the custom validation config builder.

Public Methods

public CustomValidationConfig.Builder setAccuracyValidator (CustomValidationConfig.AccuracyValidator value)

Sets the CustomValidationConfig.AccuracyValidator to decide whether a BenchmarkResult passes accuracy check. If accuracy validation is not needed, set this field to CustomValidationConfig.SKIP_VALIDATION. Default value is set to CustomValidationConfig.BYTE_MATCHING_VALIDATOR.

public CustomValidationConfig.Builder setBatchSize (int value)

Sets the number of batches of the golden input. Set to 1 by default.

public CustomValidationConfig.Builder setGoldenConfig (AccelerationConfig value)

Sets the AccelerationConfig used to calculate golden output if the CustomValidationConfig.goldenOutputs() is not provided. By default it is set to CustomValidationConfig.DEFAULT_GOLDEN_CONFIG. If accuracy validation is not needed, set this field to null.

public CustomValidationConfig.Builder setGoldenInputs (Object... value)

Sets the golden input of validation test. The value should be in the same order as inputs of the model. When more than one batch input is provided, the same input from different batches needs to be concatenated as one of the allowed input type. Each value can be an array or multidimensional rectangular array, or a Buffer of primitive types including int, float, long, and byte, or null. When Buffer is used, its content should remain unchanged until the build() is done, and the caller must ensure that the Buffer is at the appropriate read position. Boolean and String tensor type is not supported.

public CustomValidationConfig.Builder setGoldenOutputs (ByteBuffer... value)

Sets the golden output used for accuracy validation. It will be passed to CustomValidationConfig.AccuracyValidator.validate(BenchmarkResult, ByteBuffer[]) when verifying actual and golden output. If this is not provided, we will use CustomValidationConfig.goldenConfig() to calculate the golden output first.

public CustomValidationConfig.Builder setInferenceTimeoutMillis (long value)

Sets the time out setting for a validation test.