Package apple.coreml

Class MLMultiArray

    • Constructor Detail

      • MLMultiArray

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

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static MLMultiArray 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()
      • count

        public long count()
        Count of total number of elements
      • dataPointer

        @NotNull
        @Deprecated
        public @NotNull org.moe.natj.general.ptr.VoidPtr dataPointer()
        Deprecated.
        Unsafe pointer to underlying buffer holding the data API-Since: 11.0 Deprecated-Since: 100000.0 Deprecated-Message: Use getBytesWithHandler or getMutableBytesWithHandler instead. For Swift, use withUnsafeBytes or withUnsafeMutableBytes.
      • dataType

        public long dataType()
        Type of element held
      • 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()
      • initWithShapeDataTypeError

        public MLMultiArray initWithShapeDataTypeError​(@NotNull
                                                       @NotNull NSArray<? extends NSNumber> shape,
                                                       long dataType,
                                                       @Nullable
                                                       @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Create by C-style contiguous array by allocating and managing the necessary memory
      • 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)
      • objectAtIndexedSubscript

        @NotNull
        public @NotNull NSNumber objectAtIndexedSubscript​(long idx)
        Get a value by its linear index (assumes C-style index ordering)
      • objectForKeyedSubscript

        @NotNull
        public @NotNull NSNumber objectForKeyedSubscript​(@NotNull
                                                         @NotNull NSArray<? extends NSNumber> key)
        Get a value by its multidimensional index (NSArray)
      • resolveClassMethod

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

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

        public void setObjectAtIndexedSubscript​(@NotNull
                                                @NotNull NSNumber obj,
                                                long idx)
        Set a value by its linear index (assumes C-style index ordering)
      • setObjectForKeyedSubscript

        public void setObjectForKeyedSubscript​(@NotNull
                                               @NotNull NSNumber obj,
                                               @NotNull
                                               @NotNull NSArray<? extends NSNumber> key)
        Set a value by subindicies (NSArray)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • shape

        @NotNull
        public @NotNull NSArray<? extends NSNumber> shape()
        An array containing the sizes of each dimension in the multiarray
      • strides

        @NotNull
        public @NotNull NSArray<? extends NSNumber> strides()
        An array containing the stride in memory for each dimension. The element referred to by a multidimensional index is located at an offset equal to sum_d index[d]*strides[d]. This offset is in the units of the specified dataType.
      • superclass_static

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

        public static long version_static()
      • multiArrayByConcatenatingMultiArraysAlongAxisDataType

        public static MLMultiArray multiArrayByConcatenatingMultiArraysAlongAxisDataType​(@NotNull
                                                                                         @NotNull NSArray<? extends MLMultiArray> multiArrays,
                                                                                         long axis,
                                                                                         long dataType)
        Concatenate MLMultiArrays to form a new MLMultiArray. All the source MLMultiArrays must have a same shape except the specified axis. The resultant MLMultiArray has the same shape as inputs except this axis, which dimension will be the sum of all the input dimensions of the axis. For example, \code // Swift let A = try MLMultiArray(shape: [2, 3], dataType: .int32) let B = try MLMultiArray(shape: [2, 2], dataType: .int32) let C = MLMultiArray(concatenating: [A, B], axis: 1, dataType: .int32) assert(C.shape == [2, 5]) \endcode \code // Obj-C MLMultiArray *A = [[MLMultiArray alloc] initWithShape:@[@2, @3] dataType:MLMultiArrayDataTypeInt32 error:NULL]; MLMultiArray *B = [[MLMultiArray alloc] initWithShape:@[@2, @2] dataType:MLMultiArrayDataTypeInt32 error:NULL]; MLMultiArray *C = [MLMultiArray multiArrayByConcatenatingMultiArrays:@[A, B] alongAxis:1 dataType:MLMultiArrayDataTypeInt32]; assert(C.shape == @[@2, @5]) \endcode Numeric data will be up or down casted as needed. The method raises NSInvalidArgumentException if the shapes of input multi arrays are not compatible for concatenation.
        Parameters:
        multiArrays - Array of MLMultiArray instances to be concatenated.
        axis - Axis index with which the concatenation will performed. The value is wrapped by the dimension of the axis. For example, -1 is the last axis.
        dataType - The data type of the resultant MLMultiArray API-Since: 14.0
      • supportsSecureCoding

        public static boolean supportsSecureCoding()
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding
      • getBytesWithHandler

        public void getBytesWithHandler​(@NotNull
                                        @NotNull MLMultiArray.Block_getBytesWithHandler handler)
        Get the underlying buffer pointer to read. The buffer pointer is valid only within the block. \code MLMultiArray * A = [[MLMultiArray alloc] initWithShape:@[@3, @2] dataType:MLMultiArrayDataTypeInt32 error:NULL]; A[@[@1, @2]] = @42; [A getBytesWithHandler:^(const void *bytes, NSInteger size) { const int32_t *scalarBuffer = (const int32_t *)bytes; const int strideY = A.strides[0].intValue; // Print 42 NSLog(@"Scalar at (1, 2): %d", scalarBuffer[1 * strideY + 2]); }]; \endcode
        Parameters:
        handler - The block to receive the buffer pointer and its size in bytes. API-Since: 15.4
      • getMutableBytesWithHandler

        public void getMutableBytesWithHandler​(@NotNull
                                               @NotNull MLMultiArray.Block_getMutableBytesWithHandler handler)
        Get the underlying buffer pointer to mutate. The buffer pointer is valid only within the block. Use `strides` parameter passed in the block because the method may switch to a new backing buffer with different strides. \code MLMultiArray * A = [[MLMultiArray alloc] initWithShape:@[@3, @2] dataType:MLMultiArrayDataTypeInt32 error:NULL]; [A getMutableBytesWithHandler:^(void *bytes, NSInteger __unused size, NSArray *strides) { int32_t *scalarBuffer = (int32_t *)bytes; const int strideY = strides[0].intValue; scalarBuffer[1 * strideY + 2] = 42; // Set 42 at A[1, 2] }]; \endcode
        Parameters:
        handler - The block to receive the buffer pointer, size in bytes, and strides. API-Since: 15.4
      • initWithPixelBufferShape

        public MLMultiArray initWithPixelBufferShape​(@NotNull
                                                     @NotNull CVBufferRef pixelBuffer,
                                                     @NotNull
                                                     @NotNull NSArray<? extends NSNumber> shape)
        Create by wrapping a pixel buffer. Use this initializer to create IOSurface backed MLMultiArray, which can reduce the inference latency by avoiding the buffer copy. The instance will own the pixel buffer and release it on the deallocation. The pixel buffer's pixel format type must be OneComponent16Half. As such, MLMultiArray's data type will be MLMultiArrayDataTypeFloat16. \code CVPixelBufferRef pixelBuffer = NULL; NSDictionary* pixelBufferAttributes = @{ (id)kCVPixelBufferIOSurfacePropertiesKey: @{} }; // Since shape == [2, 3, 4], width is 4 (= shape[2]) and height is 6 (= shape[0] * shape[1]). CVPixelBufferCreate(kCFAllocatorDefault, 4, 6, kCVPixelFormatType_OneComponent16Half, (__bridge CFDictionaryRef)pixelBufferAttributes, &pixelBuffer); MLMultiArray *multiArray = [[MLMultiArray alloc] initWithPixelBuffer:pixelBuffer shape:@[@2, @3, @4]]; \endcode
        Parameters:
        pixelBuffer - The pixel buffer to be owned by the instance.
        shape - The shape of the MLMultiArray. The last dimension of `shape` must match the pixel buffer's width. The product of the rest of the dimensions must match the height. API-Since: 16.0
      • pixelBuffer

        @Nullable
        public @Nullable CVBufferRef pixelBuffer()
        Returns the backing pixel buffer if exists, otherwise nil. API-Since: 16.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.