Package apple.coreml

Class MLPredictionOptions

  • All Implemented Interfaces:
    NSObject

    public class MLPredictionOptions
    extends NSObject
    MLPredictionOptions An object to hold options / controls / parameters of how model prediction is performed API-Since: 11.0
    • Constructor Detail

      • MLPredictionOptions

        protected MLPredictionOptions​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static MLPredictionOptions allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setUsesCPUOnly

        @Deprecated
        public void setUsesCPUOnly​(boolean value)
        Deprecated.
        Set to YES to force computation to be on the CPU only API-Since: 11.0 Deprecated-Since: 15.0
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • usesCPUOnly

        @Deprecated
        public boolean usesCPUOnly()
        Deprecated.
        Set to YES to force computation to be on the CPU only API-Since: 11.0 Deprecated-Since: 15.0
      • version_static

        public static long version_static()
      • outputBackings

        @NotNull
        public @NotNull NSDictionary<java.lang.String,​?> outputBackings()
        Propose the model to use the specified backing objects for the output feature values. Use the property to get the inference result directly into the client allocated buffer when possible for efficient memory management. The property is a dictionary of the feature name and the output backing object. The framework may not use the specified backing object and instead allocates one by itself if the outputBacking dictionary doesn't contain the entry for the feature name, the model doesn't support the user allocated buffers, or in the batch prediction mode. To check if the backing object was used, compare the output prediction and the backing object by object identity. \code CVPixelBufferRef outputBacking = ...; [options setOutputBackings:@{@"outputImage" : (__bridge id)outputBacking}]; id prediction = [model predictionFromFeatures:inputFeatures options:options error:&error]; if ([prediction featureValueForName:@"outputImage"].imageBufferValue == outputBacking) { // backing was used. } else { // backing was NOT used. } \endcode The backing object must be either CVPixelBuffer or MLMultiArray depending on the feature value type. Do not lock the base address of the CVPixelBuffer. In the case of a MLMultiArray backed by a pixel buffer, make sure not to lock the underlying pixel buffer by not calling any data methods such as `.dataPointer` and subscript methods before the prediction. The framework ignores a backing object with an unknown feature name. For the best performance, use page-aligned address in MLMultiArray. \code #import : void *backingBuffer = aligned_alloc(vm_page_size, round_page(backingBufferSize)); if (backingBuffer == NULL) { ... error handling ... } MLMultiArray *outputBacking = [[MLMultiArray alloc] initWithDataPointer:(char *)backingBuffer ... deallocator:^(void *) { free(backingBuffer); } ... ]; \endcode For CVPixelBuffer backing, consider to use IOSurface-backed CVPixelBuffer created by CVPixelBufferPool because it is often the most efficient choice for memory footprint and performance, especially when the pixel buffers are subsequently used for playback or export. (See also AVSampleBufferDisplayLayer and AVAssetWriter.) The output backing object must satisfy the output feature description's `-isAllowedValue:` test, or the framework reporets an error at the prediction time. The exception is FP16 MLMultiArray backed by CVPixelBuffer, which may be accepted in Double or Float32 multi array output feature depending on the underlying inference engine. API-Since: 16.0
      • setOutputBackings

        public void setOutputBackings​(@NotNull
                                      @NotNull NSDictionary<java.lang.String,​?> value)
        Propose the model to use the specified backing objects for the output feature values. Use the property to get the inference result directly into the client allocated buffer when possible for efficient memory management. The property is a dictionary of the feature name and the output backing object. The framework may not use the specified backing object and instead allocates one by itself if the outputBacking dictionary doesn't contain the entry for the feature name, the model doesn't support the user allocated buffers, or in the batch prediction mode. To check if the backing object was used, compare the output prediction and the backing object by object identity. \code CVPixelBufferRef outputBacking = ...; [options setOutputBackings:@{@"outputImage" : (__bridge id)outputBacking}]; id prediction = [model predictionFromFeatures:inputFeatures options:options error:&error]; if ([prediction featureValueForName:@"outputImage"].imageBufferValue == outputBacking) { // backing was used. } else { // backing was NOT used. } \endcode The backing object must be either CVPixelBuffer or MLMultiArray depending on the feature value type. Do not lock the base address of the CVPixelBuffer. In the case of a MLMultiArray backed by a pixel buffer, make sure not to lock the underlying pixel buffer by not calling any data methods such as `.dataPointer` and subscript methods before the prediction. The framework ignores a backing object with an unknown feature name. For the best performance, use page-aligned address in MLMultiArray. \code #import : void *backingBuffer = aligned_alloc(vm_page_size, round_page(backingBufferSize)); if (backingBuffer == NULL) { ... error handling ... } MLMultiArray *outputBacking = [[MLMultiArray alloc] initWithDataPointer:(char *)backingBuffer ... deallocator:^(void *) { free(backingBuffer); } ... ]; \endcode For CVPixelBuffer backing, consider to use IOSurface-backed CVPixelBuffer created by CVPixelBufferPool because it is often the most efficient choice for memory footprint and performance, especially when the pixel buffers are subsequently used for playback or export. (See also AVSampleBufferDisplayLayer and AVAssetWriter.) The output backing object must satisfy the output feature description's `-isAllowedValue:` test, or the framework reporets an error at the prediction time. The exception is FP16 MLMultiArray backed by CVPixelBuffer, which may be accepted in Double or Float32 multi array output feature depending on the underlying inference engine. API-Since: 16.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.