import type { NobjcObject } from "objc-js";
import type { _NSArray } from "../Foundation/NSArray.js";
import type { _NSNumber } from "../Foundation/NSNumber.js";
import type { _NSObject } from "../Foundation/NSObject.js";
import type { _NSSecureCoding } from "../Foundation/NSSecureCoding.js";
import type { MLMultiArrayDataType } from "./MLMultiArrayDataType.js";
export declare class _MLMultiArray extends _NSObject {
    static alloc(): _MLMultiArray;
    static new(): _MLMultiArray;
    init(): _MLMultiArray;
    /**
     * 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, ```swift // 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]) ``` ```objc // 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]) ``` 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.
     */
    static multiArrayByConcatenatingMultiArrays$alongAxis$dataType$(multiArrays: _NSArray, axis: number, dataType: MLMultiArrayDataType): _MLMultiArray;
    /**
     * Creates the object. The contents of the object are left uninitialized; the client must initialize it. The scalars will use the first-major contiguous layout. - Parameters: - shape: The shape - dataType: The data type - error: Filled with error information on error.
     */
    initWithShape$dataType$error$(shape: _NSArray, dataType: MLMultiArrayDataType, error: NobjcObject | null): _MLMultiArray | null;
    /**
     * Creates the object with specified strides. The contents of the object are left uninitialized; the client must initialize it. ```swift let shape = [2, 3]; let strides = [4, 1] let multiArray = MLMultiArray(shape: shape, dataType: .float32, strides: strides) XCTAssertEqual(multiArray.shape, shape as [NSNumber]) XCTAssertEqual(multiArray.strides, strides as [NSNumber]) ``` ```objc NSArray <NSNumber *> *shape = @ [ @ 2, @ 3]; NSArray <NSNumber *> *strides = @ [ @ 4, @ 1]; MLMultiArray *multiArray = [[MLMultiArray alloc] initWithShape:shape dataType:MLMultiArrayDataTypeFloat32 strides:strides]; XCTAssertEqualObjects(multiArray.shape, shape); XCTAssertEqualObjects(multiArray.strides, strides); ``` - Parameters: - shape: The shape - dataType: The data type - strides: The strides.
     */
    initWithShape$dataType$strides$(shape: _NSArray, dataType: MLMultiArrayDataType, strides: _NSArray): _MLMultiArray;
    /**
     * Creates the object with existing data without copy. Use this initializer to reference the existing buffer as the storage without copy. ```objc int32_t *buffer = malloc(sizeof(int32_t) * 2 * 3 * 4); MLMultiArray *multiArray = [[MLMultiArray alloc] initWithDataPointer:buffer shape: @ [ @ 2, @ 3, @ 4] dataType:MLMultiArrayDataTypeInt32 strides: @ [ @ 12, @ 4, @ 1] deallocator:^(void *bytes) { free(bytes); } error:NULL]; ``` - Parameters: - dataPointer: The pointer to the buffer. - shape: The shape - dataType: The data type - strides: The strides. - deallocator: Block to be called on the deallocation of the instance. - error: Filled with error information on error.
     */
    initWithDataPointer$shape$dataType$strides$deallocator$error$(dataPointer: Uint8Array, shape: _NSArray, dataType: MLMultiArrayDataType, strides: _NSArray, deallocator: ((bytes: NobjcObject) => void) | null, error: NobjcObject | null): _MLMultiArray | null;
    /**
     * Create by wrapping a pixel buffer. Use this initializer to create an 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 either `kCVPixelFormatType_OneComponent16Half` for `MLMultiArrayDataTypeFloat16` or `kCVPixelFormatType_OneComponent8` for `MLMultiArrayDataTypeInt8`. ```objc 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]]; ``` - 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.
     */
    initWithPixelBuffer$shape$(pixelBuffer: NobjcObject, shape: _NSArray): _MLMultiArray;
    /**
     * Get the underlying buffer pointer to read. The buffer pointer is valid only within the block. ```objc 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]); }]; ``` - Parameters: - handler: The block to receive the buffer pointer and its size in bytes.
     */
    getBytesWithHandler$(handler: (bytes: NobjcObject, size: number) => void): void;
    /**
     * 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. ```objc MLMultiArray * A = [[MLMultiArray alloc] initWithShape: @ [ @ 3, @ 2] dataType:MLMultiArrayDataTypeInt32 error:NULL]; [A getMutableBytesWithHandler:^(void *bytes, NSInteger __unused size, NSArray <NSNumber *> *strides) { int32_t *scalarBuffer = (int32_t *)bytes; const int strideY = strides[0].intValue; scalarBuffer[1 * strideY + 2] = 42; // Set 42 at A[1, 2] }]; ``` - Parameters: - handler: The block to receive the buffer pointer, size in bytes, and strides.
     */
    getMutableBytesWithHandler$(handler: (mutableBytes: NobjcObject, size: number, strides: _NSArray) => void): void;
    /** Get a value by its linear index (assumes C-style index ordering) */
    objectAtIndexedSubscript$(idx: number): _NSNumber;
    /** Get a value by its multidimensional index (NSArray <NSNumber *>) */
    objectForKeyedSubscript$(key: _NSArray): _NSNumber;
    /** Set a value by its linear index (assumes C-style index ordering) */
    setObject$atIndexedSubscript$(obj: _NSNumber, idx: number): void;
    /** Set a value by subindicies (NSArray <NSNumber *>) */
    setObject$forKeyedSubscript$(obj: _NSNumber, key: _NSArray): void;
    /**
     * Transfer the contents to the destination multi-array. Numeric data will be up or down casted as needed. It can transfer to a multi-array with different layout (strides). ```swift let sourceMultiArray: MLMultiArray = ... // shape is [2, 3] and data type is Float64 let newStrides = [4, 1] let destinationMultiArray = MLMultiArray(shape: [2, 3], dataType: .float32, strides: newStrides) sourceMultiArray.transfer(to: destinationMultiArray) ``` ```objc NSArray <NSNumber *> *shape = @ [ @ 2, @ 3]; NSArray <NSNumber *> *sourceStrides = @ [ @ 3, @ 1]; NSArray <NSNumber *> *destinationStrides = @ [ @ 4, @ 1]; MLMultiArray *source = [[MLMultiArray alloc] initWithShape:shape dataType:MLMultiArrayDataTypeDouble strides:sourceStrides]; // Initialize source... MLMultiArray *destination = [[MLMultiArray alloc] initWithShape:shape dataType:MLMultiArrayDataTypeFloat32 strides:destinationStrides]; [source transferToMultiArray:destination]; ``` - Parameters: - destinationMultiArray: The transfer destination.
     */
    transferToMultiArray$(destinationMultiArray: _MLMultiArray): void;
    /**
     * Unsafe pointer to underlying buffer holding the data
     * @deprecated Use getBytesWithHandler or getMutableBytesWithHandler instead. For Swift, use withUnsafeBytes or withUnsafeMutableBytes.
     */
    dataPointer(): NobjcObject;
    /** Scalar's data type. */
    dataType(): MLMultiArrayDataType;
    /** Shape of the multi-dimensional space that this instance represents. */
    shape(): _NSArray;
    /**
     * Strides. It defines the offset of the scalar of a given coordinate index in the storage, which is: ``` scalarOffset = sum_d index[d]*strides[d] ```
     */
    strides(): _NSArray;
    /**
     * Count of total number of addressable scalars. The value is same as `product_d shape[d]`.
     */
    count(): number;
    /** Returns the backing pixel buffer if exists, otherwise nil. */
    pixelBuffer(): NobjcObject | null;
}
export interface _MLMultiArray extends _NSSecureCoding {
}
