data
TypeScriptget data(): (SDKHandle) | nullSwift declarationvar data: UnsafeMutableRawPointer?struct · SDK 27.1
struct BNNSTensorget data(): (SDKHandle) | nullSwift declarationvar data: UnsafeMutableRawPointer?set data(value: (SDKHandle) | null)Swift declarationvar data: UnsafeMutableRawPointer?get data_size_in_bytes(): numberSwift declarationvar data_size_in_bytes: Intset data_size_in_bytes(value: number)Swift declarationvar data_size_in_bytes: Intget data_type(): BNNSDataTypeSwift declarationvar data_type: BNNSDataTypeset data_type(value: BNNSDataType)Swift declarationvar data_type: BNNSDataTypeget name(): (SDKHandle) | nullSwift declarationvar name: UnsafePointer<CChar>?set name(value: (SDKHandle) | null)Swift declarationvar name: UnsafePointer<CChar>?get rank(): numberSwift declarationvar rank: UInt8set rank(value: number)Swift declarationvar rank: UInt8get shape(): [number, number, number, number, number, number, number, number]Swift declarationvar shape: (Int, Int, Int, Int, Int, Int, Int, Int)set shape(value: [number, number, number, number, number, number, number, number])Swift declarationvar shape: (Int, Int, Int, Int, Int, Int, Int, Int)get stride(): [number, number, number, number, number, number, number, number]Swift declarationvar stride: (Int, Int, Int, Int, Int, Int, Int, Int)set stride(value: [number, number, number, number, number, number, number, number])Swift declarationvar stride: (Int, Int, Int, Int, Int, Int, Int, Int)deallocate(): voidSwift declarationfunc deallocate()Deallocates the previously allocated memory block referenced by this pointer.
static initDataShapeStrideDataType(data: ArrayBuffer, shape: Array<number>, stride: Array<number>, dataType: BNNSDataType): BNNSTensorSwift declarationinit(data: UnsafeMutableRawBufferPointer, shape: [Int], stride: [Int], dataType: BNNSDataType)Creates a `BNNSTensor` that references the same memory as the specified `UnsafeMutableRawBufferPointer`. - Parameter data: A pointer to the source data. - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor.
static initDataShapeStride(data: Float32Array, shape: Array<number>, stride: Array<number>): BNNSTensorSwift declarationinit<T>(data: UnsafeMutableBufferPointer<T>, shape: [Int], stride: [Int]) where T : BNNSScalarCreates a `BNNSTensor` that references the same memory as the specified `UnsafeMutableBufferPointer`. - Parameter data: A pointer to the source data. - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor.
get count(): numberSwift declarationvar count: Int { get }The number of elements in the tensor.
static initShapeStrideDataType(shape: Array<number>, stride: Array<number>, dataType: BNNSDataType): BNNSTensorSwift declarationinit(shape: [Int], stride: [Int], dataType: BNNSDataType)Returns a `BNNSTensor` structure based on the supplied shape and data type. - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor. - Parameter dataType: The data type of the data.
static allocateInitializingFromShapeStride(source: Array<number>, shape: Array<number>, stride: Array<number>): BNNSTensorSwift declarationstatic func allocate<C>(initializingFrom source: C, shape: [Int], stride: [Int]) -> BNNSTensor where C : AccelerateBuffer, C.Element : BNNSScalarCreates a `BNNSTensor` populated with a **copy** of the values in `source`. - Parameter source: The collection that provides the source elements. - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor.
allocateAsCount(scalarType: "Bool" | "Float", count: number): voidSwift declarationmutating func allocate<T>(as scalarType: T.Type, count: Int) where T : BNNSScalarAllocates a tensor with existing size and stride populated by `Context.tensor(forFunction:argument:fillKnownDynamicShapes:)`. - Parameter scalarType: The data type. - Parameter count: The allocation size represented by the count of `scalarType` elements.
static allocateRepeatingShapeStride(repeatedValue: number, shape: Array<number>, stride: Array<number>): BNNSTensorSwift declarationstatic func allocate<T>(repeating repeatedValue: T, shape: [Int], stride: [Int]) -> BNNSTensor where T : BNNSScalarCreates a `BNNSTensor` filled with the specified scalar value. - Parameter repeatedValue: The value that the function uses for a fillable element. - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor.
static initDataTypeShapeStride(dataType: BNNSDataType, shape: Array<number>, stride: Array<number>): BNNSTensorSwift declarationinit(dataType: BNNSDataType, shape: [Int], stride: [Int])Creates an unallocated `BNNSTensor` - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor.
makeArray(scalarType: "Bool" | "Float"): Array<unknown>Swift declarationfunc makeArray<T>(of scalarType: T.Type) -> [T] where T : BNNSScalarReturns an array that contains a copy of this `BNNSTensor`'s elements. - Parameter scalarType: The type that the tensor's memory is bound to.
static initData_typeRankShapeStrideDataData_size_in_bytesName(data_type: BNNSDataType, rank: number, shape: [number, number, number, number, number, number, number, number], stride: [number, number, number, number, number, number, number, number], data: (SDKHandle) | null, data_size_in_bytes: number, name?: (SDKHandle) | null): BNNSTensorSwift declarationinit(data_type: BNNSDataType, rank: UInt8, shape: (Int, Int, Int, Int, Int, Int, Int, Int), stride: (Int, Int, Int, Int, Int, Int, Int, Int), data: UnsafeMutableRawPointer?, data_size_in_bytes: Int, name: UnsafePointer<CChar>?)static init(): BNNSTensorSwift declarationinit()3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
BNNSTensor.allocate(initializingFrom:)
This protocol needs associated types that cannot yet cross the bridge.
BNNSTensor.init(initializingFrom:shape:stride:)
This protocol needs associated types that cannot yet cross the bridge.
BNNSTensor.allocateUninitialized(scalarType:shape:stride:)
Passing a Swift type itself is not supported.