Type Definitions

The following type definitions are available globally.

  • A vector is an array of 32 bit floats or 8 bit unsigned integers.

    Declaration

    Objective-C

    typedef NSArray<NSNumber *> TIOVector
  • A validation block that allows clients of the validator to add custom validation as a final step.

    For example, Net Runner currrently only works with models that take a single image input, so it verifies that model inputs conform to that requirement in its custom validation block.

    Declaration

    Objective-C

    typedef BOOL (^TIOModelBundleValidationBlock)(NSString *_Nonnull,
                                                  NSDictionary *_Nonnull,
                                                  NSError *_Nullable *_Nullable)

    Swift

    typealias TIOModelBundleValidationBlock = (String, [AnyHashable : Any], NSErrorPointer) -> Bool

    Parameters

    path

    The path to the model bundle.

    JSON

    The json loaded from model.json in the model bundle.

    error

    A pointer to an error object that the custom validator can set if validation fails.

    Return Value

    BOOL YES if the custom validation passed, NO otherwise.

  • Undocumented

    See more

    Declaration

    Objective-C

    typedef struct TIOPixelNormalization TIOPixelNormalization
  • Describes a denormalization, or how pixel values in some arbitrary range will be denormalized back to pixe values in the range of [0,255]

    Pixels will typically be denormalized from values in the range [0,1] or [-1,+1], although separate denormaliation biases may be required for each of the RGB channels.

    Normalization and denormalization apply the same operations with scaling and bias values, but they are typically inverses of one another.

    Declaration

    Objective-C

    typedef TIOPixelNormalization TIOPixelDenormalization

    Swift

    typealias TIOPixelDenormalization = TIOPixelNormalization
  • A TIOPixelNormalizer is a function that transforms a pixel value in the range [0,255] to some other range, where the transformation may be channel dependent.

    The normalizer will typically be constructed with the help of a TIOPixelNormalization struct or using one of the core or standard normalizers provided.

    Declaration

    Objective-C

    typedef float_t (^TIOPixelNormalizer)(const uint8_t)

    Swift

    typealias TIOPixelNormalizer = (UInt8) -> float_t

    Parameters

    value

    The single byte pixel value being transformed.

    channel

    The RGB channel of the pixel value being transformed.

    Return Value

    float_t The transformed value.

  • A TIOPixelDenormalizer is a function that transforms a normalized pixel value, typically in the range [0,1] or [-1,1] back to a pixel value in the range [0,255], where the denormalization may be channel dependent.

    The denormalizer will typically be constructed with the help of a TIOPixelDenormalization struct or using one of the core or standard denormalizers provided.

    Declaration

    Objective-C

    typedef uint8_t (^TIOPixelDenormalizer)(const float_t)

    Swift

    typealias TIOPixelDenormalizer = (float_t) -> UInt8

    Parameters

    value

    The four byte normalized pixel value being transformed.

    channel

    The RGB channel of the pixel value being transformed.

    Return Value

    uint8_t The denormalized value.

  • Undocumented

    See more

    Declaration

    Objective-C

    typedef struct TIODataQuantization TIODataQuantization
  • A TIODataQuantizer is a function that quantizes unquantized values, converting them from floating point representations to uint8_t representations.

    Declaration

    Objective-C

    typedef uint8_t (^TIODataQuantizer)(const float_t)

    Swift

    typealias TIODataQuantizer = (float_t) -> UInt8

    Parameters

    value

    The float_t value that will be quantized.

    Return Value

    uint8_t A quantized representation of the value.

  • Undocumented

    See more

    Declaration

    Objective-C

    typedef struct TIODataDequantization TIODataDequantization
  • A TIODataDequantizer is a function that dequantizes quantized values, converting them from uint8_t representations to floating point representations.

    Declaration

    Objective-C

    typedef float_t (^TIODataDequantizer)(const uint8_t)

    Swift

    typealias TIODataDequantizer = (UInt8) -> float_t

    Parameters

    value

    The uint8_t value that will be dequantized.

    Return Value

    float_t A floating point representation of the value.