One Logo Pool Ball
Accelerate · IOS API REFERENCE

BNNSTensor

struct · SDK 27.1

struct BNNSTensor

Members (26)

get

data

TypeScript
get data(): (SDKHandle) | null
Swift declaration
var data: UnsafeMutableRawPointer?
set

data

TypeScript
set data(value: (SDKHandle) | null)
Swift declaration
var data: UnsafeMutableRawPointer?
get

data_size_in_bytes

TypeScript
get data_size_in_bytes(): number
Swift declaration
var data_size_in_bytes: Int
set

data_size_in_bytes

TypeScript
set data_size_in_bytes(value: number)
Swift declaration
var data_size_in_bytes: Int
get

data_type

TypeScript
get data_type(): BNNSDataType
Swift declaration
var data_type: BNNSDataType
set

data_type

TypeScript
set data_type(value: BNNSDataType)
Swift declaration
var data_type: BNNSDataType
get

name

TypeScript
get name(): (SDKHandle) | null
Swift declaration
var name: UnsafePointer<CChar>?
set

name

TypeScript
set name(value: (SDKHandle) | null)
Swift declaration
var name: UnsafePointer<CChar>?
get

rank

TypeScript
get rank(): number
Swift declaration
var rank: UInt8
set

rank

TypeScript
set rank(value: number)
Swift declaration
var rank: UInt8
get

shape

TypeScript
get shape(): [number, number, number, number, number, number, number, number]
Swift declaration
var shape: (Int, Int, Int, Int, Int, Int, Int, Int)
set

shape

TypeScript
set shape(value: [number, number, number, number, number, number, number, number])
Swift declaration
var shape: (Int, Int, Int, Int, Int, Int, Int, Int)
get

stride

TypeScript
get stride(): [number, number, number, number, number, number, number, number]
Swift declaration
var stride: (Int, Int, Int, Int, Int, Int, Int, Int)
set

stride

TypeScript
set stride(value: [number, number, number, number, number, number, number, number])
Swift declaration
var stride: (Int, Int, Int, Int, Int, Int, Int, Int)
method · iOS 26.0+

deallocate

TypeScript
deallocate(): void
Swift declaration
func deallocate()

Deallocates the previously allocated memory block referenced by this pointer.

init · iOS 26.0+

init

TypeScript
static initDataShapeStrideDataType(data: ArrayBuffer, shape: Array<number>, stride: Array<number>, dataType: BNNSDataType): BNNSTensor
Swift declaration
init(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.

init · iOS 26.0+

init

TypeScript
static initDataShapeStride(data: Float32Array, shape: Array<number>, stride: Array<number>): BNNSTensor
Swift declaration
init<T>(data: UnsafeMutableBufferPointer<T>, shape: [Int], stride: [Int]) where T : BNNSScalar

Creates 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 · iOS 26.0+

count

TypeScript
get count(): number
Swift declaration
var count: Int { get }

The number of elements in the tensor.

init · iOS 26.0+

init

TypeScript
static initShapeStrideDataType(shape: Array<number>, stride: Array<number>, dataType: BNNSDataType): BNNSTensor
Swift declaration
init(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 · iOS 26.0+

allocate

TypeScript
static allocateInitializingFromShapeStride(source: Array<number>, shape: Array<number>, stride: Array<number>): BNNSTensor
Swift declaration
static func allocate<C>(initializingFrom source: C, shape: [Int], stride: [Int]) -> BNNSTensor where C : AccelerateBuffer, C.Element : BNNSScalar

Creates 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.

method · iOS 26.0+

allocate

TypeScript
allocateAsCount(scalarType: "Bool" | "Float", count: number): void
Swift declaration
mutating func allocate<T>(as scalarType: T.Type, count: Int) where T : BNNSScalar

Allocates 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 · iOS 26.0+

allocate

TypeScript
static allocateRepeatingShapeStride(repeatedValue: number, shape: Array<number>, stride: Array<number>): BNNSTensor
Swift declaration
static func allocate<T>(repeating repeatedValue: T, shape: [Int], stride: [Int]) -> BNNSTensor where T : BNNSScalar

Creates 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.

init · iOS 26.0+

init

TypeScript
static initDataTypeShapeStride(dataType: BNNSDataType, shape: Array<number>, stride: Array<number>): BNNSTensor
Swift declaration
init(dataType: BNNSDataType, shape: [Int], stride: [Int])

Creates an unallocated `BNNSTensor` - Parameter shape: The shape of the tensor. - Parameter stride: The stride of the tensor.

method · iOS 26.0+

makeArray

TypeScript
makeArray(scalarType: "Bool" | "Float"): Array<unknown>
Swift declaration
func makeArray<T>(of scalarType: T.Type) -> [T] where T : BNNSScalar

Returns an array that contains a copy of this `BNNSTensor`'s elements. - Parameter scalarType: The type that the tensor's memory is bound to.

init

init

TypeScript
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): BNNSTensor
Swift declaration
init(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>?)
init

init

TypeScript
static init(): BNNSTensor
Swift declaration
init()

Skipped declarations

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.

All Accelerate types →