Package apple.coreml
Class MLMultiArray
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.coreml.MLMultiArray
-
- All Implemented Interfaces:
NSCoding,NSSecureCoding,NSObject
public class MLMultiArray extends NSObject implements NSSecureCoding
Multidimensional Array API-Since: 11.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMLMultiArray.Block_getBytesWithHandlerstatic interfaceMLMultiArray.Block_getMutableBytesWithHandlerstatic interfaceMLMultiArray.Block_initWithDataPointerShapeDataTypeStridesDeallocatorError-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Block_accessibilityActivateBlock_ret, NSObject.Block_accessibilityActivationPointBlock_ret, NSObject.Block_accessibilityAttributedHintBlock_ret, NSObject.Block_accessibilityAttributedLabelBlock_ret, NSObject.Block_accessibilityAttributedUserInputLabelsBlock_ret, NSObject.Block_accessibilityAttributedValueBlock_ret, NSObject.Block_accessibilityContainerTypeBlock_ret, NSObject.Block_accessibilityCustomActionsBlock_ret, NSObject.Block_accessibilityCustomRotorsBlock_ret, NSObject.Block_accessibilityDecrementBlock_ret, NSObject.Block_accessibilityElementsBlock_ret, NSObject.Block_accessibilityElementsHiddenBlock_ret, NSObject.Block_accessibilityFrameBlock_ret, NSObject.Block_accessibilityHeaderElementsBlock_ret, NSObject.Block_accessibilityHintBlock_ret, NSObject.Block_accessibilityIdentifierBlock_ret, NSObject.Block_accessibilityIncrementBlock_ret, NSObject.Block_accessibilityLabelBlock_ret, NSObject.Block_accessibilityLanguageBlock_ret, NSObject.Block_accessibilityMagicTapBlock_ret, NSObject.Block_accessibilityNavigationStyleBlock_ret, NSObject.Block_accessibilityPathBlock_ret, NSObject.Block_accessibilityPerformEscapeBlock_ret, NSObject.Block_accessibilityRespondsToUserInteractionBlock_ret, NSObject.Block_accessibilityShouldGroupAccessibilityChildrenBlock_ret, NSObject.Block_accessibilityTextualContextBlock_ret, NSObject.Block_accessibilityTraitsBlock_ret, NSObject.Block_accessibilityUserInputLabelsBlock_ret, NSObject.Block_accessibilityValueBlock_ret, NSObject.Block_accessibilityViewIsModalBlock_ret, NSObject.Block_automationElementsBlock_ret, NSObject.Block_isAccessibilityElementBlock_ret, NSObject.Block_setAccessibilityActivateBlock, NSObject.Block_setAccessibilityActivationPointBlock, NSObject.Block_setAccessibilityAttributedHintBlock, NSObject.Block_setAccessibilityAttributedLabelBlock, NSObject.Block_setAccessibilityAttributedUserInputLabelsBlock, NSObject.Block_setAccessibilityAttributedValueBlock, NSObject.Block_setAccessibilityContainerTypeBlock, NSObject.Block_setAccessibilityCustomActionsBlock, NSObject.Block_setAccessibilityCustomRotorsBlock, NSObject.Block_setAccessibilityDecrementBlock, NSObject.Block_setAccessibilityElementsBlock, NSObject.Block_setAccessibilityElementsHiddenBlock, NSObject.Block_setAccessibilityFrameBlock, NSObject.Block_setAccessibilityHeaderElementsBlock, NSObject.Block_setAccessibilityHintBlock, NSObject.Block_setAccessibilityIdentifierBlock, NSObject.Block_setAccessibilityIncrementBlock, NSObject.Block_setAccessibilityLabelBlock, NSObject.Block_setAccessibilityLanguageBlock, NSObject.Block_setAccessibilityMagicTapBlock, NSObject.Block_setAccessibilityNavigationStyleBlock, NSObject.Block_setAccessibilityPathBlock, NSObject.Block_setAccessibilityPerformEscapeBlock, NSObject.Block_setAccessibilityRespondsToUserInteractionBlock, NSObject.Block_setAccessibilityShouldGroupAccessibilityChildrenBlock, NSObject.Block_setAccessibilityTextualContextBlock, NSObject.Block_setAccessibilityTraitsBlock, NSObject.Block_setAccessibilityUserInputLabelsBlock, NSObject.Block_setAccessibilityValueBlock, NSObject.Block_setAccessibilityViewIsModalBlock, NSObject.Block_setAutomationElementsBlock, NSObject.Block_setIsAccessibilityElementBlock, NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMLMultiArray(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean_supportsSecureCoding()This property must return YES on all classes that allow secure coding.static booleanaccessInstanceVariablesDirectly()static MLMultiArrayalloc()static MLMultiArrayallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(@NotNull java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(@NotNull java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(@NotNull java.lang.Object aTarget, @NotNull org.moe.natj.objc.SEL aSelector, @Nullable java.lang.Object anArgument)static @NotNull NSArray<java.lang.String>classFallbacksForKeyedArchiver()static @NotNull org.moe.natj.objc.ClassclassForKeyedUnarchiver()longcount()Count of total number of elements@NotNull org.moe.natj.general.ptr.VoidPtrdataPointer()Deprecated.longdataType()Type of element heldstatic java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voidencodeWithCoder(@NotNull NSCoder coder)voidgetBytesWithHandler(@NotNull MLMultiArray.Block_getBytesWithHandler handler)Get the underlying buffer pointer to read.voidgetMutableBytesWithHandler(@NotNull MLMultiArray.Block_getMutableBytesWithHandler handler)Get the underlying buffer pointer to mutate.static longhash_static()MLMultiArrayinit()MLMultiArrayinitWithCoder(@NotNull NSCoder coder)NS_DESIGNATED_INITIALIZERMLMultiArrayinitWithDataPointerShapeDataTypeStridesDeallocatorError(@NotNull org.moe.natj.general.ptr.VoidPtr dataPointer, @NotNull NSArray<? extends NSNumber> shape, long dataType, @NotNull NSArray<? extends NSNumber> strides, @Nullable MLMultiArray.Block_initWithDataPointerShapeDataTypeStridesDeallocatorError deallocator, @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)Create by wrapping existing dataMLMultiArrayinitWithPixelBufferShape(@NotNull CVBufferRef pixelBuffer, @NotNull NSArray<? extends NSNumber> shape)Create by wrapping a pixel buffer.MLMultiArrayinitWithShapeDataTypeError(@NotNull NSArray<? extends NSNumber> shape, long dataType, @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)Create by C-style contiguous array by allocating and managing the necessary memorystatic NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static @NotNull NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(@NotNull java.lang.String key)static MLMultiArraymultiArrayByConcatenatingMultiArraysAlongAxisDataType(@NotNull NSArray<? extends MLMultiArray> multiArrays, long axis, long dataType)Concatenate MLMultiArrays to form a new MLMultiArray.static MLMultiArraynew_objc()@NotNull NSNumberobjectAtIndexedSubscript(long idx)Get a value by its linear index (assumes C-style index ordering)@NotNull NSNumberobjectForKeyedSubscript(@NotNull NSArray<? extends NSNumber> key)Get a value by its multidimensional index (NSArray) @Nullable CVBufferRefpixelBuffer()Returns the backing pixel buffer if exists, otherwise nil.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetObjectAtIndexedSubscript(@NotNull NSNumber obj, long idx)Set a value by its linear index (assumes C-style index ordering)voidsetObjectForKeyedSubscript(@NotNull NSNumber obj, @NotNull NSArray<? extends NSNumber> key)Set a value by subindicies (NSArray) static voidsetVersion_static(long aVersion)@NotNull NSArray<? extends NSNumber>shape()An array containing the sizes of each dimension in the multiarray@NotNull NSArray<? extends NSNumber>strides()An array containing the stride in memory for each dimension.static org.moe.natj.objc.Classsuperclass_static()static booleansupportsSecureCoding()static booleanuseStoredAccessor()Deprecated.static longversion_static()-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivateBlock, accessibilityActivationPoint, accessibilityActivationPointBlock, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedHintBlock, accessibilityAttributedLabel, accessibilityAttributedLabelBlock, accessibilityAttributedUserInputLabels, accessibilityAttributedUserInputLabelsBlock, accessibilityAttributedValue, accessibilityAttributedValueBlock, accessibilityContainerType, accessibilityContainerTypeBlock, accessibilityCustomActions, accessibilityCustomActionsBlock, accessibilityCustomRotors, accessibilityCustomRotorsBlock, accessibilityDecrement, accessibilityDecrementBlock, accessibilityDirectTouchOptions, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsBlock, accessibilityElementsHidden, accessibilityElementsHiddenBlock, accessibilityFrame, accessibilityFrameBlock, accessibilityHeaderElementsBlock, accessibilityHint, accessibilityHintBlock, accessibilityIdentifierBlock, accessibilityIncrement, accessibilityIncrementBlock, accessibilityLabel, accessibilityLabelBlock, accessibilityLanguage, accessibilityLanguageBlock, accessibilityMagicTapBlock, accessibilityNavigationStyle, accessibilityNavigationStyleBlock, accessibilityPath, accessibilityPathBlock, accessibilityPerformEscape, accessibilityPerformEscapeBlock, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityRespondsToUserInteractionBlock, accessibilityScroll, accessibilityShouldGroupAccessibilityChildrenBlock, accessibilityTextualContext, accessibilityTextualContextBlock, accessibilityTraits, accessibilityTraitsBlock, accessibilityUserInputLabels, accessibilityUserInputLabelsBlock, accessibilityValue, accessibilityValueBlock, accessibilityViewIsModal, accessibilityViewIsModalBlock, accessibilityZoomInAtPoint, accessibilityZoomOutAtPoint, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, automationElements, automationElementsBlock, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hash, indexOfAccessibilityElement, isAccessibilityElement, isAccessibilityElementBlock, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivateBlock, setAccessibilityActivationPoint, setAccessibilityActivationPointBlock, setAccessibilityAttributedHint, setAccessibilityAttributedHintBlock, setAccessibilityAttributedLabel, setAccessibilityAttributedLabelBlock, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedUserInputLabelsBlock, setAccessibilityAttributedValue, setAccessibilityAttributedValueBlock, setAccessibilityContainerType, setAccessibilityContainerTypeBlock, setAccessibilityCustomActions, setAccessibilityCustomActionsBlock, setAccessibilityCustomRotors, setAccessibilityCustomRotorsBlock, setAccessibilityDecrementBlock, setAccessibilityDirectTouchOptions, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsBlock, setAccessibilityElementsHidden, setAccessibilityElementsHiddenBlock, setAccessibilityFrame, setAccessibilityFrameBlock, setAccessibilityHeaderElementsBlock, setAccessibilityHint, setAccessibilityHintBlock, setAccessibilityIdentifierBlock, setAccessibilityIncrementBlock, setAccessibilityLabel, setAccessibilityLabelBlock, setAccessibilityLanguage, setAccessibilityLanguageBlock, setAccessibilityMagicTapBlock, setAccessibilityNavigationStyle, setAccessibilityNavigationStyleBlock, setAccessibilityPath, setAccessibilityPathBlock, setAccessibilityPerformEscapeBlock, setAccessibilityRespondsToUserInteraction, setAccessibilityRespondsToUserInteractionBlock, setAccessibilityShouldGroupAccessibilityChildrenBlock, setAccessibilityTextualContext, setAccessibilityTextualContextBlock, setAccessibilityTraits, setAccessibilityTraitsBlock, setAccessibilityUserInputLabels, setAccessibilityUserInputLabelsBlock, setAccessibilityValue, setAccessibilityValueBlock, setAccessibilityViewIsModal, setAccessibilityViewIsModalBlock, setAutomationElements, setAutomationElementsBlock, setIsAccessibilityElement, setIsAccessibilityElementBlock, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, storedValueForKey, superclass, takeStoredValueForKey, takeValueForKey, takeValueForKeyPath, takeValuesFromDictionary, unableToSetNilForKey, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, valuesForKeys, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static MLMultiArray alloc()
-
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()
-
init
public MLMultiArray init()
-
initWithDataPointerShapeDataTypeStridesDeallocatorError
public MLMultiArray initWithDataPointerShapeDataTypeStridesDeallocatorError(@NotNull @NotNull org.moe.natj.general.ptr.VoidPtr dataPointer, @NotNull @NotNull NSArray<? extends NSNumber> shape, long dataType, @NotNull @NotNull NSArray<? extends NSNumber> strides, @Nullable @Nullable MLMultiArray.Block_initWithDataPointerShapeDataTypeStridesDeallocatorError deallocator, @Nullable @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
Create by wrapping existing data
-
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
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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)
-
new_objc
public static MLMultiArray new_objc()
-
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()
-
encodeWithCoder
public void encodeWithCoder(@NotNull @NotNull NSCoder coder)- Specified by:
encodeWithCoderin interfaceNSCoding
-
initWithCoder
public MLMultiArray initWithCoder(@NotNull @NotNull NSCoder coder)
Description copied from interface:NSCodingNS_DESIGNATED_INITIALIZER- Specified by:
initWithCoderin interfaceNSCoding
-
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:NSSecureCodingThis 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:
_supportsSecureCodingin interfaceNSSecureCoding
-
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.
-
-