One Logo Pool Ball
CoreML · IOS API REFERENCE

MLTensor

struct · iOS 18.0+ · SDK 27.1

struct MLTensor

A multi-dimensional array of numerical or Boolean scalars tailored to ML use cases, containing methods to perform transformations and mathematical operations efficiently using a ML compute device.

Members (91)

method · iOS 18.0+

reciprocal

TypeScript
reciprocal(): MLTensor
Swift declaration
func reciprocal() -> MLTensor

Computes the reciprocal of the tensor's elements.

method · iOS 18.0+

squareRoot

TypeScript
squareRoot(): MLTensor
Swift declaration
func squareRoot() -> MLTensor

Computes square root of the tensor's elements.

method · iOS 18.0+

transposed

TypeScript
transposedPermutation(permutation: Array<number>): MLTensor
Swift declaration
func transposed(permutation: [Int]) -> MLTensor

Permutes the dimensions of the tensor in the specified order. For example: ```swift let x = MLTensor(shape: [1, 2, 3], scalars: [1, 2, 3, 4, 5, 6], scalarType: Float.self) let y = x.transposed(permutation: [1, 0, 2]) y.shape // is [2, 1, 3] ``` - Parameter permutation: An array of integers defining the permutation, must be of length `rank` and define a valid permutation. - Returns: A permuted tensor.

method · iOS 18.0+

transposed

TypeScript
transposed(): MLTensor
Swift declaration
func transposed() -> MLTensor

Permutes the tensor with dimensions permuted in reverse order. For example: ```swift let x = MLTensor(shape: [1, 2, 3], scalars: [1, 2, 3, 4, 5, 6], scalarType: Float.self) let y = x.transposed() y.shape // is [3, 2, 1] ``` - Returns: A permuted tensor.

get · iOS 18.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.

get · iOS 18.0+

scalarCount

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

The number of scalar elements in the tensor.

method · iOS 18.0+

concatenated

TypeScript
concatenated(other: MLTensor, axis?: number): MLTensor
Swift declaration
func concatenated(with other: MLTensor, alongAxis axis: Int = 0) -> MLTensor

Returns a concatenated tensor along the specified axis. - Parameters: - other: The tensor to concatenate. The tensors must have the same dimensions, except for the specified axis. - axis: The axis along which to concatenate. Negative values wrap around but must be in the range `[-rank, rank)`.

get · iOS 18.0+

customMirror

TypeScript
get customMirror(): SDKHandle
Swift declaration
var customMirror: Mirror { get }

The custom mirror for `MLTensor`.

init · iOS 18.0+

init

TypeScript
static initFloatLiteral(floatLiteral: number): MLTensor
Swift declaration
init(floatLiteral: Float)

Creates an instance initialized to the specified floating-point value. Do not call this initializer directly. Instead, initialize a variable or constant using a floating-point literal. For example: let x = 21.5 In this example, the assignment to the `x` constant calls this floating-point literal initializer behind the scenes. - Parameter value: The value to create.

method · iOS 18.0+

cumulativeSum

TypeScript
cumulativeSum(axis?: number): MLTensor
Swift declaration
func cumulativeSum(alongAxis axis: Int = 0) -> MLTensor

Computes the cumulative sum along the specified axis. The scalar type of the tensor must be numeric. For example: ```swift MLTensor([1, 2, 3]).cumulativeSum() = [1, 1 + 2, 1 + 2 + 3] ``` - Parameter axis: The axis along which to perform the cumulative sum. The default value is `0`. Must be in the range `[-rank, rank)` and have a rank greater than zero. - Returns: The result of the cumulative sum operation.

init · iOS 18.0+

init

TypeScript
static initBooleanLiteral(booleanLiteral: boolean): MLTensor
Swift declaration
init(booleanLiteral: Bool)

Creates an instance initialized to the given Boolean value. Do not call this initializer directly. Instead, initialize a variable or constant using one of the Boolean literals `true` and `false`. For example: let twasBrillig = true In this example, the assignment to the `twasBrillig` constant calls this Boolean literal initializer behind the scenes. - Parameter value: The value of the new instance.

method · iOS 18.0+

expandingShape

TypeScript
expandingShape(axes: Array<number>): MLTensor
Swift declaration
func expandingShape(at axes: [Int]) -> MLTensor

Returns a shape-expanded tensor with a dimension of 1 inserted at the specified shape indices. For example: ```swift let x = MLTensor(shape: [2], scalars: [1, 2], scalarType: Float.self) let y = x.expandingShape(at: [0]) y.shape // is [1, 2] ``` - Parameter axes: The axes at which to expand the shape.

init · iOS 18.0+

init

TypeScript
static initIntegerLiteral(integerLiteral: number): MLTensor
Swift declaration
init(integerLiteral: Int32)

Creates an instance initialized to the specified integer value. Do not call this initializer directly. Instead, initialize a variable or constant using an integer literal. For example: let x = 23 In this example, the assignment to the `x` constant calls this integer literal initializer behind the scenes. - Parameter value: The value to create.

method · iOS 18.0+

squeezingShape

TypeScript
squeezingShapeAt(axes: Array<number>): MLTensor
Swift declaration
func squeezingShape(at axes: [Int]) -> MLTensor

Removes the specified dimensions of size 1 from the shape of the tensor. For example: ```swift let x = MLTensor(shape: [1, 2, 1], scalars: [1, 2], scalarType: Float.self) let y = x.squeezingShape(at: [0]) y.shape // is [2, 1] ``` - Parameter axes: The axes to remove if the size is `1`.

method · iOS 18.0+

squeezingShape

TypeScript
squeezingShape(): MLTensor
Swift declaration
func squeezingShape() -> MLTensor

Removes all dimensions of size 1 from the shape of the tensor. For example: ```swift let x = MLTensor(shape: [1, 2, 1], scalars: [1, 2], scalarType: Float.self) let y = x.squeezingShape() y.shape // is [2] ```

init · iOS 18.0+

init

TypeScript
static initLinearSpaceFromThroughCount(start: number, end: number, count: number): MLTensor
Swift declaration
init(linearSpaceFrom start: Float, through end: Float, count: Int)

Creates a one-dimensional tensor representing a sequence from a starting value, up to and including an end value, spaced evenly to generate the number of values specified. - Parameters: - start: The starting value to use for the sequence. If the sequence contains any values, the first one is `start`. - end: An end value to limit the sequence. `end` is the last element of the resulting sequence. - count: The number of values in the resulting sequence. `count` must be positive and greater than `1`.

method · iOS 18.0+

cumulativeProduct

TypeScript
cumulativeProduct(axis?: number): MLTensor
Swift declaration
func cumulativeProduct(alongAxis axis: Int = 0) -> MLTensor

Computes the cumulative product along the specified axis. The scalar type of the tensor must be numeric. For example: ```swift MLTensor([1, 2, 3]).cumulativeProduct() = [1, 1 * 2, 1 * 2 * 3] ``` - Parameter axis: The axis along which to perform the cumulative product. The default value is `0`. Must be in the range `[-rank, rank)` and have a rank greater than zero. - Returns: The result of the cumulative product operation.

method · iOS 18.0+

abs

TypeScript
abs(): MLTensor
Swift declaration
func abs() -> MLTensor

Computes the absolute of the tensor's elements.

method · iOS 18.0+

all

TypeScript
allKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func all(keepRank: Bool = false) -> MLTensor

Computes logical AND on elements across all axes of a tensor where the scalar type of the tensor is expected to be Boolean. - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced Boolean tensor.

method · iOS 18.0+

all

TypeScript
allAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func all(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Computes logical AND on elements across the specified axes of a tensor where the scalar type of the tensor is expected to be Boolean. - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced Boolean tensor.

method · iOS 18.0+

any

TypeScript
anyKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func any(keepRank: Bool = false) -> MLTensor

Computes logical OR on elements across all dimensions of a tensor where the scalar type of the tensor is expected to be Boolean. - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

any

TypeScript
anyAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func any(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Computes logical OR on elements across the specified axes of a tensor where the scalar type of the tensor is expected to be Boolean. - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced Boolean tensor.

method · iOS 18.0+

cos

TypeScript
cos(): MLTensor
Swift declaration
func cos() -> MLTensor

Computes the cosine of the tensor's elements.

method · iOS 18.0+

exp

TypeScript
exp(): MLTensor
Swift declaration
func exp() -> MLTensor

Computes the natural exponent of the tensor's elements.

method · iOS 18.0+

log

TypeScript
log(): MLTensor
Swift declaration
func log() -> MLTensor

Computes the natural logarithm of the tensor's elements.

method · iOS 18.0+

max

TypeScript
maxKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func max(keepRank: Bool = false) -> MLTensor

Returns the maximum value in the array. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.max() y.shape // is [] await y.shapedArray(of: Float.self) // is [7.0] ``` - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

max

TypeScript
maxAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func max(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Returns the maximum values along the specified axes. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.max(alongAxes: [0], keepRank: true) y.shape // is [1, 2] await y.shapedArray(of: Float.self) // is [6.0 7.0] ``` - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

min

TypeScript
minKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func min(keepRank: Bool = false) -> MLTensor

Returns the minimum value in the array. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.min() y.shape // is [] await y.shapedArray(of: Float.self) // is [2.0] ``` - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

min

TypeScript
minAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func min(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Returns the minimum values along the specified axes. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.min(alongAxes: [0]) y.shape // is [1, 2] await y.shapedArray(of: Float.self) // is [2.0 3.0] ``` - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

pow

TypeScript
pow(exponent: MLTensor): MLTensor
Swift declaration
func pow(_ exponent: MLTensor) -> MLTensor

Computes element-wise power of each element with `exponent`. - Parameter exponent: The exponent.

method · iOS 18.0+

sin

TypeScript
sin(): MLTensor
Swift declaration
func sin() -> MLTensor

Computes sine of the tensor's elements.

method · iOS 18.0+

sum

TypeScript
sumKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func sum(keepRank: Bool = false) -> MLTensor

Returns the sum along all axes. For example: ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.sum() y.shape // is [] await y.shapedArray(of: Float.self) // is [27] ``` - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

sum

TypeScript
sumAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func sum(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Returns the sum along the specified axes. For example: ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.sum(alongAxes: [0], keepRank: true) y.shape // is [1, 2] await y.shapedArray(of: Float.self) // is [[12, 15]] ``` - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

tan

TypeScript
tan(): MLTensor
Swift declaration
func tan() -> MLTensor

Computes tangent of the tensor's elements.

method · iOS 18.0+

acos

TypeScript
acos(): MLTensor
Swift declaration
func acos() -> MLTensor

Computes the inverse cosine of the tensor's elements.

method · iOS 18.0+

asin

TypeScript
asin(): MLTensor
Swift declaration
func asin() -> MLTensor

Computes the inverse sine of the tensor's elements.

method · iOS 18.0+

atan

TypeScript
atan(): MLTensor
Swift declaration
func atan() -> MLTensor

Computes the inverse tangent of the tensor's elements.

method · iOS 18.0+

cast

TypeScript
castTo(scalarType: "Bool" | "Float"): MLTensor
Swift declaration
func cast<Scalar>(to scalarType: Scalar.Type) -> MLTensor where Scalar : MLTensorScalar

Casts the elements of the tensor to the given scalar type. For example: ```swift let x = MLTensor([1, 2, 3], scalarType: Int32.self) let y = x.cast(to: Float.self) y.scalarType // is Float ``` - Parameter scalarType: The destination scalar type. - Returns: A new tensor with its contents cast to the given scalar type.

method · iOS 18.0+

cast

TypeScript
castLike(other: MLTensor): MLTensor
Swift declaration
func cast(like other: MLTensor) -> MLTensor

Casts the elements of the tensor to the scalar type of the given array. For example: ```swift let x = MLTensor([1, 2, 3], scalarType: Float.self) let y = MLTensor([1, 2, 3], scalarType: Int32.self) let z = y.cast(like: x) z.scalarType // is Float ``` - Parameter other: The other tensor whose scalar type is used for the cast. - Returns: A new tensor with its contents cast to the scalar type of `other`.

method · iOS 18.0+

ceil

TypeScript
ceil(): MLTensor
Swift declaration
func ceil() -> MLTensor

Computes the ceiling of the tensor's elements.

method · iOS 18.0+

cosh

TypeScript
cosh(): MLTensor
Swift declaration
func cosh() -> MLTensor

Computes the hyperbolic cosine of the tensor's elements.

method · iOS 18.0+

exp2

TypeScript
exp2(): MLTensor
Swift declaration
func exp2() -> MLTensor

Computes the exponent with base two of the tensor's elements.

method · iOS 18.0+

mean

TypeScript
meanKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func mean(keepRank: Bool = false) -> MLTensor

Returns the mean along all axes. For example: ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.mean() y.shape // is [] await y.shapedArray(of: Float.self) // is [4.5] ``` - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

mean

TypeScript
meanAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func mean(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Returns the mean along the specified axes. For example: ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.mean(alongAxes: [0], keepRank: true) y.shape // is [1, 2] await y.shapedArray(of: Float.self) // is [4.0 5.0] ``` - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

get · iOS 18.0+

rank

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

The number of dimensions of the tensor. Rank is equal to the number of dimensions of the shape, i.e., `tensor.rank == tensor.shape.count`.

method · iOS 18.0+

sign

TypeScript
sign(): MLTensor
Swift declaration
func sign() -> MLTensor

Returns the sign of the tensor's elements. This operation returns `1.0` if the correspnding element is greater than `0`, `-1.0` if it is less than `0`, `-0.0` if it is equal to `-0.0`, and `+0.0` if it is equal to `+0.0`.

method · iOS 18.0+

sinh

TypeScript
sinh(): MLTensor
Swift declaration
func sinh() -> MLTensor

Computes hyperbolic sine of the tensor's elements.

method · iOS 18.0+

tanh

TypeScript
tanh(): MLTensor
Swift declaration
func tanh() -> MLTensor

Computes hyperbolic tangent of the tensor's elements.

method · iOS 18.0+

topK

TypeScript
topK(k: number): { "values": MLTensor; "indices": MLTensor }
Swift declaration
func topK(_ k: Int) -> (values: MLTensor, indices: MLTensor)

Returns the *k* largest values along the last axis of the tensor. - Note: The tensor must have at least k elements along its last axis and order returned by largest values which are equal is not deterministic. For example: ```swift let x = MLTensor(shape: [1, 5], scalars: [1.0, 2.0, 3.0, 4.0, 5.0]) let (values, indices) = x.topK(3) // values = [[5.0, 4.0, 3.0]] // indices = [[4, 3, 2]] ``` - Parameter k: The number of largest values to return. - Returns: A tuple of (values, indices) with values containing the top k values along the last axis and indices, a `Int32` tensor, containing the indices to the corresponding values.

method · iOS 18.0+

acosh

TypeScript
acosh(): MLTensor
Swift declaration
func acosh() -> MLTensor

Computes the inverse hyperbolic cosine of the tensor's elements.

method · iOS 18.0+

asinh

TypeScript
asinh(): MLTensor
Swift declaration
func asinh() -> MLTensor

Computes the inverse hyperbolic sine of the tensor's elements.

method · iOS 18.0+

atanh

TypeScript
atanh(): MLTensor
Swift declaration
func atanh() -> MLTensor

Computes the inverse hyperbolic tangent of the tensor's elements.

method · iOS 18.0+

floor

TypeScript
floor(): MLTensor
Swift declaration
func floor() -> MLTensor

Computes the floor of the tensor's elements.

method · iOS 18.0+

round

TypeScript
round(): MLTensor
Swift declaration
func round() -> MLTensor

Rounds the tensor's elements.

method · iOS 18.0+

rsqrt

TypeScript
rsqrt(): MLTensor
Swift declaration
func rsqrt() -> MLTensor

Computes reverse square root of the tensor's elements. The reverse square root operation is the reciprocal of the square root.

get · iOS 18.0+

shape

TypeScript
get shape(): Array<number>
Swift declaration
var shape: [Int] { get }

The shape of the tensor. For example, 2 x 3 matrix may be represented as a tensor with the shape of `[2, 3]`.

method · iOS 18.0+

split

TypeScript
splitCountAlongAxis(count: number, axis?: number): Array<MLTensor>
Swift declaration
func split(count: Int, alongAxis axis: Int = 0) -> [MLTensor]

Splits a tensor into multiple tensors. The tensor is split along dimension `axis` into `count` smaller tensors. For example: ``` // 'value' is a tensor with shape [5, 30] // Split 'value' into 3 tensors along dimension 1: let parts = value.split(count: 3, alongAxis: 1) parts[0] // has shape [5, 10] parts[1] // has shape [5, 10] parts[2] // has shape [5, 10] ``` - Parameters: - count: The number of splits to create, must divide the size of dimension `axis` evenly. - axis: The dimension along which to split this tensor. The `axis` must be in the range `[-rank, rank)`. - Returns: An array containing the tensor parts.

method · iOS 18.0+

split

TypeScript
splitSizesAlongAxis(sizes: Array<number>, axis?: number): Array<MLTensor>
Swift declaration
func split(sizes: [Int], alongAxis axis: Int = 0) -> [MLTensor]

Splits a tensor into multiple tensors. The tensor is split into `sizes.shape[0]` parts. For example: ``` // 'value' is a tensor with shape [5, 30] // Split 'value' into 3 tensors with sizes [4, 15, 11] along dimension 1: let parts = value.split(sizes: [4, 15, 11], alongAxis: 1) parts[0] // has shape [5, 4] parts[1] // has shape [5, 15] parts[2] // has shape [5, 11] ``` - Parameters: - sizes: A one-dimensional tensor containing the size of each split, must add up to the size of dimension `axis`. - axis: The dimension along which to split this tensor. Must be in the range `[-rank, rank)`. - Returns: Array containing the tensors parts.

method · iOS 18.0+

tiled

TypeScript
tiled(multiples: Array<number>): MLTensor
Swift declaration
func tiled(multiples: [Int]) -> MLTensor

Returns a tensor by replicating its elements multiple times. The `multiples` argument specifies the multiplier across each dimensions, i.e., the output dimension at index `i` is equal to `shape[i] * multiples[i]`. For example: ```swift let x = MLTensor(shape: [2, 2], scalars: [1, 2, 3, 4], scalarType: Float.self) let y = x.tiled(multiples: [1, 2]) y.shape // is [2, 4] ``` If `multiples` specifies fewer dimensions than the tensor, then ones are prepended to `multiples` until all the dimensions are specified. If tensor has fewer dimensions than `multiples`, then the tensor is reshaped by prepending ones to the dimensions until all the dimensions are specified. - Parameter multiples: The multiplier across each dimension. All values must be greater than zero. - Returns: The replicated tensor.

method · iOS 18.0+

argmax

TypeScript
argmaxAlongAxisKeepRank(axis: number, keepRank?: boolean): MLTensor
Swift declaration
func argmax(alongAxis axis: Int, keepRank: Bool = false) -> MLTensor

Returns the indices of the maximum values along the specified axis. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.argmax(alongAxis: 0) y.shape // is [2] y.scalarType // is Int32 await y.shapedArray(of: Int32.self) // is 2 2 ``` - Parameters: - axis: The axis to reduce. - keepRank: A Boolean indicating whether to keep the reduced axis or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

argmax

TypeScript
argmax(): MLTensor
Swift declaration
func argmax() -> MLTensor

Returns the index of the maximum value of the flattened scalars. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.argmax() y.shape // is [] y.scalarType // is Int32 await y.shapedArray(of: Int32.self) // is 5 ```

method · iOS 18.0+

argmin

TypeScript
argminAlongAxisKeepRank(axis: number, keepRank?: boolean): MLTensor
Swift declaration
func argmin(alongAxis axis: Int, keepRank: Bool = false) -> MLTensor

Returns the indices of the minimum values along the specified axis. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.argmin(alongAxis: 0) y.shape // is [2] y.scalarType // is Int32 await y.shapedArray(of: Int32.self) // is 0 0 ``` - Parameters: - axis: The axis to reduce. - keepRank: A Boolean indicating whether to keep the reduced axis or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

argmin

TypeScript
argmin(): MLTensor
Swift declaration
func argmin() -> MLTensor

Returns the index of the minimum value of the flattened scalars. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.argmin() y.shape // is [] y.scalarType // is Int32 await y.shapedArray(of: Int32.self) // is 0 ```

method · iOS 18.0+

matmul

TypeScript
matmul(other: MLTensor): MLTensor
Swift declaration
func matmul(_ other: MLTensor) -> MLTensor

Multiplies two tensors together using matrix multiplication. The specific behaviour is determined by the dimensionality of the inputs, as described below: - If both tensors are 1-dimensional, the dot-product is returned. - If the first is 2-dimensional and other 1-dimensional, the matrix-vector product is returned. - If both have a rank of 2, the matrix-matrix product is returned and when the rank is greater than 2, the batched matrix multiply is returned For example: ```swift let v1 = MLTensor([1.0, 2.0, 3.0, 4.0]) let v2 = MLTensor([5.0, 6.0, 7.0, 8.0]) let v3 = v1.matmul(v2) v3.shape // is [] await v3.shapedArray(of: Float.self) // is 70.0 let m1 = MLTensor(shape: [2, 3], scalars: [ 1, 2, 3, 4, 5, 6 ], scalarType: Float.self) let m2 = MLTensor(shape: [3, 2], scalars: [ 7, 8, 9, 10, 11, 12 ], scalarType: Float.self) let m3 = t1.matmul(r2) m3.shape // is [2, 2] await m3.shapedArray(of: Float.self) // is [[58, 64], [139, 154]] // Supports broadcasting let m4 = MLTensor(randomNormal: [3, 1, 1, 4], scalarType: Float.self) let m5 = MLTensor(randomNormal: [4, 2], scalarType: Float.self) let m6 = t4.matmul(t5) m6.shape // is [3, 1, 1, 2] ``` - Parameter other: The right-hand side tensor to be multiplied. - Returns: The result of the matrix multiplication.

method · iOS 18.0+

padded

TypeScript
paddedForSizesMode(sizes: Array<{ "before": number; "after": number }>, mode: MLTensor_PaddingMode): MLTensor
Swift declaration
func padded(forSizes sizes: [(before: Int, after: Int)], mode: MLTensor.PaddingMode) -> MLTensor

Returns a padded tensor according to the specified padding sizes and mode. For example: ```swift let x = MLTensor(shape: [2, 3], scalars: [ 1, 2, 3, 4, 5, 6 ], scalarType: Float32.self) let constantPadding = x.padded(forSizes: [(0, 0), (2, 2)], mode: .constant(Float(0))) // [[0, 0, 1, 2, 3, 0, 0], // [0, 0, 4, 5, 6, 0, 0]] let reflectionPadding = x.padded(forSizes: [(0, 0), (2, 2)], mode: .reflection) // [[3, 2, 1, 2, 3, 2, 1], // [6, 5, 4, 5, 6, 5, 4]] let symmetricPadding = x.padded(forSizes: [(0, 0), (2, 2)], mode: .symmetric) // [[2, 1, 1, 2, 3, 3, 2], // [5, 4, 4, 5, 6, 6, 5]] ``` - Parameters: - sizes: An array of tuples describing the size to be inserted before and after each dimension. - mode: The mode of padding, etiher constant, reflection, or symmetric. - Returns: The padded tensor.

method · iOS 18.0+

padded

TypeScript
paddedForSizesWith(sizes: Array<{ "before": number; "after": number }>, value: number): MLTensor
Swift declaration
func padded(forSizes sizes: [(before: Int, after: Int)], with value: Float) -> MLTensor

Returns a tensor padded with the given constant according to the specified padding sizes. For example: ```swift let x = MLTensor(shape: [2, 3], scalars: [ 1, 2, 3, 4, 5, 6 ], scalarType: Float32.self) let y = x.padded(forSizes: [(0, 0), (2, 2)], with: 0.0) // [[0, 0, 1, 2, 3, 0, 0], // [0, 0, 4, 5, 6, 0, 0]] ``` - Parameters: - sizes: An array of tuples describing the size to be inserted before and after each dimension. - value: The constant value used for padding. - Returns: The padded tensor.

method · iOS 18.0+

argsort

TypeScript
argsort(axis?: number, descendingOrder?: boolean): MLTensor
Swift declaration
func argsort(alongAxis axis: Int = -1, descendingOrder: Bool = false) -> MLTensor

Returns the indices (or arguments) of a tensor that give its sorted order along the specified axis. For example: ```swift let x = MLTensor([1.0, 3.0, 2.0]) let y = x.argSort() await y.shapedArray(of: Int32.self) // is [0, 2, 1] ``` - Parameters: - axis: The axis along which to sort. The default is `-1`, which sorts the last axis. - descendingOrder: A Boolean value that determines the sort order. The default is `false` which sorts from largest to least. - Returns: A `Int32` tensor of sorted indices.

method · iOS 18.0+

clamped

TypeScript
clampedTo(bounds: SDKHandle): MLTensor
Swift declaration
func clamped(to bounds: ClosedRange<Float>) -> MLTensor

Clamps all elements to the given lower and upper bounds, inclusively. For example: ```swift let x = MLTensor([-1.0, 1.0, 2.0]) let y = x.clamped(to: 0...1) await y.shapedArray(of: Float.self) // is [0.0, 1.0, 1.0] ```

method · iOS 18.0+

clamped

TypeScript
clampedTo84394(bounds: SDKHandle): MLTensor
Swift declaration
func clamped(to bounds: PartialRangeFrom<Float>) -> MLTensor

Clamps all elements to the given lower bound, inclusively. For example: ```swift let x = MLTensor([-1.0, 1.0, 2.0]) let y = x.clamped(to: 0...) await y.shapedArray(of: Float.self) // is [0.0, 1.0, 2.0] ```

method · iOS 18.0+

clamped

TypeScript
clampedTo17076(bounds: SDKHandle): MLTensor
Swift declaration
func clamped(to bounds: PartialRangeThrough<Float>) -> MLTensor

Clamps all elements to the given upper bound, inclusively. For example: ```swift let x = MLTensor([-1.0, 1.0, 2.0]) let y = x.clamped(to: ...1) await y.shapedArray(of: Float.self) // is [-1.0, 1.0, 1.0] ```

method · iOS 18.0+

product

TypeScript
productKeepRank(keepRank?: boolean): MLTensor
Swift declaration
func product(keepRank: Bool = false) -> MLTensor

Returns the product along all axes. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.product() y.shape // is [] await y.shapedArray(of: Float.self) // is [5040.0] ``` - Parameter keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

product

TypeScript
productAlongAxesKeepRank(axes: Array<number>, keepRank?: boolean): MLTensor
Swift declaration
func product(alongAxes axes: [Int], keepRank: Bool = false) -> MLTensor

Returns the product along the specified axes. ```swift let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.product(alongAxes: [0], keepRank: true) y.shape // is [1, 2] await y.shapedArray(of: Float.self) // is [48.0 105.0] ``` - Parameters: - axes: The axes to reduce. - keepRank: A Boolean indicating whether to keep the reduced axes or not. The default value is `false`. - Returns: The reduced tensor.

method · iOS 18.0+

resized

TypeScript
resized(size: { "newHeight": number; "newWidth": number }, method?: MLTensor_ResizeMethod): MLTensor
Swift declaration
func resized(to size: (newHeight: Int, newWidth: Int), method: MLTensor.ResizeMethod = .nearestNeighbor) -> MLTensor

Resize the tensor's spatial dimensions to size using the specified method. For example: ```swift let image = MLTensor(shape: [1, 1, 2, 2], scalars: [ 1, 0, 0, 1 ], scalarType: Float.self) let resizedImage = image.resized(to: (4, 4), method: .nearest) // [[[[1, 1, 0, 0], // [1, 1, 0, 0], // [0, 0, 1, 1], // [0, 0, 1, 1]]]] ``` The tensor must be either a 4-dimensional float tensor of shape `[batch, channels, height, width]` or 3-dimensional float tensor of shape `[channel, height, width]`. - Parameters: - size: The new size for the spatial dimensions of the tensor. The size must be positive. - method: The resize method. The default value is `.nearest`.

method · iOS 18.0+

softmax

TypeScript
softmax(axis?: number): MLTensor
Swift declaration
func softmax(alongAxis axis: Int = -1) -> MLTensor

Computes the softmax of the specified tensor along the specified axis. - Parameter axis: The axis along which softmax will be computed. - Returns: A new tensor with the same shape and scalar type.

method · iOS 18.0+

squared

TypeScript
squared(): MLTensor
Swift declaration
func squared() -> MLTensor

Computes square of the tensor's elements.

method · iOS 18.0+

bandPart

TypeScript
bandPart(lowerBandCount: number, upperBandCount: number): MLTensor
Swift declaration
func bandPart(lowerBandCount: Int, upperBandCount: Int) -> MLTensor

Returns a new tensor with the same shape where everything outside a central band in each innermost matrix is set to zero. The framework copies a diagonal band of values from the tensor to the result tensor of the same size. A coordinate `[..., i, j]` is considered in band if ```md (lowerBandCount < 0 || (i-j) <= lowerBandCount) && (upperBandCount < 0 || (j-i) <= upperBandCount) ``` Values outside of the band are set to `0`. For example: ```swift let t = Tensor([ [ 5, 1, 2, 3], [-1, 5, 1, 2], [-2, -1, 5, 1], [-3, -2, -1, 5] ], scalarType: Float.self) t.bandPart(lowerBandCount: 0, upperBandCount: 0) // [[ 5, 0, 0, 0] // [ 0, 5, 0, 0] // [ 0, 0, 5, 0] // [ 0, 0, 0, 5]] t.bandPart(lowerBandCount: 0, upperBandCount: -1) // [[ 5, 1, 2, 3] // [ 0, 5, 1, 2] // [ 0, 0, 5, 1] // [ 0, 0, 0, 5]] t.bandPart(lowerBandCount: -1, upperBandCount: 0) // [[ 5, 0, 0, 0] // [-1, 5, 0, 0] // [-2, -1, 5, 0] // [-3, -2, -1, 5]] ``` - Parameters: - lowerBandCount: The number of diagonals in the lower triangle to keep. If `-1`, keep the entire lower triangle. - upperBandCount: The number of diagonals in the upper triangle to keep. If `-1`, keep the entire upper triangle. - Returns: The band part of the tensor.

get · iOS 18.0+

isScalar

TypeScript
get isScalar(): boolean
Swift declaration
var isScalar: Bool { get }

A Boolean value indicating whether the tensor is a scalar (when the `rank` is equal to `0`) or not.

method · iOS 18.0+

reshaped

TypeScript
reshaped(newShape: Array<number>): MLTensor
Swift declaration
func reshaped(to newShape: [Int]) -> MLTensor

Reshape to the specified shape. For example: ```swift let x = MLTensor(shape: [2], scalars: [1, 2], scalarType: Float.self) let y = x.reshaped(at: [1, 2, 1]) y.shape // is [1, 2, 1] ``` - Parameter newShape: The new shape of the array. The number of scalars matches the new shape.

method · iOS 18.0+

reversed

TypeScript
reversed(axes: Array<number>): MLTensor
Swift declaration
func reversed(alongAxes axes: [Int]) -> MLTensor

Returns a new tensor with the specified dimensions reversed. For example: ```swift let x = MLTensor(shape: [4], scalars: [0, 1, 2, 3], scalarType: Float.self) let y = x.reversed(alongAxes: [0]) // [3, 2, 1, 0] ``` - Parameter axes: Axis or axes to reverse the elements of the tensor. Must be in the range `[-rank, rank)`. If no axis is specified, the tensor will be reversed along all axes. - Returns: A new tensor with the same shape and scalar type with the specified dimensions reversed.

method · iOS 18.0+

flattened

TypeScript
flattened(): MLTensor
Swift declaration
func flattened() -> MLTensor

Reshape to a one-dimensional tensor. - Note: Flattening a zero-dimensional tensor will return a one-dimensional tensor. For example: ```swift let x = MLTensor(shape: [2, 2], scalars: [1, 2, 3, 4], scalarType: Float.self) let y = x.flattened() y.shape // is [4] ```

method · iOS 18.0+

gathering

TypeScript
gatheringAtIndicesAlongAxis(indices: MLTensor, axis: number): MLTensor
Swift declaration
func gathering(atIndices indices: MLTensor, alongAxis axis: Int) -> MLTensor

Returns a tensor by gathering slices along the given axis at the specified indices. For example: ```swift let x = MLTensor(shape: [3, 3], scalars: [ 0, 1, 2, 10, 11, 12, 20, 21, 22 ], scalarType: Float.self) let i = MLTensor([2, 1], scalarType: Int32.self) let y0 = x.gathering(atIndices: i) // [[20, 21, 22], // [10, 11, 12]] let y1 = x.gathering(atIndices: i, alongAxis: 1) // [[ 2, 1], // [12, 11], // [22, 21]] ``` - Parameters: - indices: A 32-bit integer tensor containing indices to gather at. - axis: The dimension to gather along. Must be in the range `[-rank, rank)`. - Returns: The gathered tensor.

method · iOS 18.0+

gathering

TypeScript
gatheringAtIndices(indices: MLTensor): MLTensor
Swift declaration
func gathering(atIndices indices: MLTensor) -> MLTensor

Returns a tensor by gathering slices at the specified indices. The `indices` tensor is interpreted as a `(rank-1)` dimensional set of one-dimensional lookup vectors, for example: ```swift let x = MLTensor(shape: [2, 2], scalars: [ 0, 1, 10, 11 ], scalarType: Float.self) let i = MLTensor(shape: [2, 2], scalars: [ 0, 0, 1, 1 ], scalarType: Int32.self) let y = x.gathering(atIndices: i) // [ 0, 11] ``` If the one-dimensional lookup vectors do not give a full set of indices, the remaining indices are treated as a slice, for example: ```swift let x = MLTensor(shape: [3, 3], scalars: [ 0, 1, 2, 10, 11, 12, 20, 21, 22 ], scalarType: Float.self) let i = MLTensor(shape: [3, 1], scalars: [ 2, 1 ], scalarType: Int32.self) let y = x.gathering(atIndices: i) // [[20 21 22] // [10 11 12]] ``` - Parameter indices: A 32-bit integer tensor containing indices to gather at. - Returns: The gathered tensor.

init · iOS 18.0+

init

TypeScript
static initRangeFromToBy(start: number, end: number, stride: SDKHandle): MLTensor
Swift declaration
init(rangeFrom start: Float, to end: Float, by stride: Float.Stride)

Creates a one-dimensional tensor representing a sequence from a starting value to, but not including, an end value, stepping by the specified amount. - Parameters: - start: The starting value to use for the sequence. If the sequence contains any values, the first one is `start`. - end: An end value to limit the sequence. `end` is never an element of the resulting sequence. - stride: The amount to step by with each iteration. `stride` must be positive. - scalarType: The scalar type.

init · iOS 18.0+

init

TypeScript
static initRepeatingShape(repeatedValue: number, shape: Array<number>): MLTensor
Swift declaration
init<Scalar>(repeating repeatedValue: Scalar, shape: [Int], scalarType: Scalar.Type = Scalar.self) where Scalar : MLTensorScalar

Creates a tensor with the specified shape and a single, repeated scalar value. - Parameters: - repeatedValue: The scalar value to repeat. - shape: The shape of the tensor. - scalarType: The scalar type.

init · iOS 18.0+

init

TypeScript
static initRepeatingShape31494(repeatedValue: number, shape: Array<number>): MLTensor
Swift declaration
init(repeating repeatedValue: Float, shape: [Int])

Creates a tensor with the specified shape and a single, repeated scalar value. - Parameters: - repeatedValue: The float value to repeat. - shape: The shape of the tensor.

method · iOS 18.0+

replacing

TypeScript
replacingWithWhere(replacement: MLTensor, mask: MLTensor): MLTensor
Swift declaration
func replacing(with replacement: MLTensor, where mask: MLTensor) -> MLTensor

Returns a new tensor replacing values from `other` with the corresponding element in `self` where the associated element in `mask` is `true`. For example: ```swift let x = MLTensor([1, 2, 3], scalarType: Float.self) let y = MLTensor([4, 5, 6], scalarType: Float.self) let mask = MLTensor([false, true, false]) let z = x.replacing(with: y, where: mask) await z.shapedArray(of: Float.self) // is [1, 5, 3] ``` - Parameters: - replacement: The replacement values where `mask` is `true`. - mask: The Boolean mask that determines whether the corresponding element / row should be taken from `self` (if the element in `mask` is `false`) or `other` (if `true`). - Returns: A new tensor of the same shape and type as `self`.

method · iOS 18.0+

replacing

TypeScript
replacingWithWhere75710(replacement: Implements<MLTensorScalar> | SDKHandle, mask: MLTensor): MLTensor
Swift declaration
func replacing(with replacement: some MLTensorScalar, where mask: MLTensor) -> MLTensor

Returns a new tensor replacing the value of `other` with the corresponding element in `self` where the associated element in `mask` is `true`. For example: ```swift let x = MLTensor([1, 2, 3], scalarType: Float.self) let mask = MLTensor([false, true, false]) let z = x.replacing(with: 5, where: mask) await z.shapedArray(of: Float.self) // is [1, 5, 3] ``` - Parameters: - replacement: The replacement value where `mask` is `true`. - mask: The Boolean mask that determines whether the corresponding element / row should be taken from `self` (if the element in `mask` is `false`) or `other` (if `true`). - Returns: A new tensor of the same shape and type as `self`.

method · iOS 18.0+

replacing

TypeScript
replacingWithAtIndicesAlongAxis(replacement: MLTensor, indices: MLTensor, axis: number): MLTensor
Swift declaration
func replacing(with replacement: MLTensor, atIndices indices: MLTensor, alongAxis axis: Int) -> MLTensor

Replaces slices along the specified indices with the given replacement values. For example: ```swift let x = MLTensor(shape: [2, 3], scalars: [ 10, 30, 20, 60, 40, 50 ], scalarType: Float.self) let i = MLTensor(shape: [2, 1], scalars: [ 1, 0 ], scalarType: Int32.self) let updates = MLTensor(shape: [2, 1], scalars: [ 99, 99 ], scalarType: Float.self) let y = x.replacing(atIndices: i, with: updates, alongAxis: 1) // [[10, 99, 20], // [99, 40, 50]] ``` - Parameters: - indices: A 32-bit integer tensor containing indices to scatter values from `replacement`. Must have the same shape as `replacement`. Must have the same shape as `self` except at `axis`. - replacement: The replacement values. - axis: The axis to scatter to. Must be in the range `[-rank, rank)`. - Returns: The updated tensor.

method · iOS 18.0+

replacing

TypeScript
replacingAtIndicesWithAlongAxis(indices: MLTensor, replacement: Implements<MLTensorScalar> | SDKHandle, axis: number): MLTensor
Swift declaration
func replacing(atIndices indices: MLTensor, with replacement: some MLTensorScalar, alongAxis axis: Int) -> MLTensor

Replaces slices along the specified indices with the given replacement values. For example: ```swift let x = MLTensor(shape: [2, 3], scalars: [ 10, 30, 20, 60, 40, 50 ], scalarType: Float.self) let i = MLTensor(shape: [2, 1], scalars: [ 1, 0 ], scalarType: Int32.self) let y = x.replacing(with: 99, atIndices: i, alongAxis: 1) // [[10, 99, 20], // [99, 40, 50]] ``` - Parameters: - indices: A 32-bit integer tensor containing indices to scatter values from `replacement`. `indices` must have the same shape as `self` except at `axis`. Must be in the range `[-rank, rank)`. - replacement: The replacement value. - axis: The axis to scatter to. - Returns: The updated tensor.

method · iOS 18.0+

unstacked

TypeScript
unstacked(axis?: number): Array<MLTensor>
Swift declaration
func unstacked(alongAxis axis: Int = 0) -> [MLTensor]

Unpacks the given dimension of a rank-`R` tensor into multiple rank-`(R-1)` tensors. Unpacks `N` tensors from this tensor by chipping it along the `axis` dimension, where `N` is inferred from this tensor's shape. For example, given a tensor with shape `[A, B, C, D]`: - If `axis == 0` then the `i`-th tensor in the returned array is the slice `self[i, nil, nil, nil]` and each tensor in that array will have shape `[B, C, D]`. - If `axis == 1` then the `i`-th tensor in the returned array is the slice `value[:, i, :, :]` and each tensor in that array will have shape `[A, C, D]`. - Etc. This is the opposite of `MLTensor.init(stacking:alongAxis:)`. - Parameter axis: The dimension along which to unstack. The `axis` must be in the range `[-rank, rank)`. - Returns: An array containing the unstacked tensors.

init · iOS 18.0+

init

TypeScript
static init(value: number): MLTensor
Swift declaration
init<Scalar>(_ value: Scalar, scalarType: Scalar.Type = Scalar.self) where Scalar : MLTensorScalar

Creates a zero-dimensional tensor from a scalar value. - Parameters: - value: The value. - scalarType: The scalar type.

Skipped declarations

41 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

MLTensor.all(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.any(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.squeezingShape(at:)

A variable number of Swift arguments is not supported.

MLTensor.expandingShape(at:)

A variable number of Swift arguments is not supported.

MLTensor.transposed(permutation:)

A variable number of Swift arguments is not supported.

MLTensor.init(concatenating:alongAxis:)

This parameter hides a concrete Swift type.

MLTensor.init(stacking:alongAxis:)

This parameter hides a concrete Swift type.

MLTensor.init(arrayLiteral:)

A variable number of Swift arguments is not supported.

MLTensor.init(_:alongAxis:)

This parameter hides a concrete Swift type.

MLTensor.reversed(alongAxes:)

A variable number of Swift arguments is not supported.

MLTensor.pow(_:)

This parameter hides a concrete Swift type.

MLTensor.subscript(_:_:)

A variable number of Swift arguments is not supported.

MLTensor.subscript(_:_:_:)

A variable number of Swift arguments is not supported.

MLTensor.subscript(_:_:_:_:)

A variable number of Swift arguments is not supported.

MLTensor.subscript(_:_:_:_:_:)

A variable number of Swift arguments is not supported.

MLTensor.subscript(_:)

A variable number of Swift arguments is not supported.

MLTensor.sum(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.mean(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.min(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.max(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.product(alongAxes:keepRank:)

A variable number of Swift arguments is not supported.

MLTensor.init(randomNormal:mean:standardDeviation:seed:scalarType:)

This declaration needs Swift generic type arguments. (no canonical witness for Scalar)

MLTensor.init(randomUniform:in:seed:scalarType:)

Passing a Swift type itself is not supported.

MLTensor.init(randomUniform:in:seed:scalarType:)

This declaration needs Swift generic type arguments. (no canonical witness for Scalar)

MLTensor.init(unsafeUninitializedShape:scalarType:initializingWith:)

Passing a Swift type itself is not supported.

MLTensor.init(shape:scalars:)

This parameter hides a concrete Swift type.

MLTensor.init(shape:scalars:scalarType:)

This declaration needs Swift generic type arguments. (no canonical witness for Scalar)

MLTensor.init(_:scalarType:)

This declaration needs Swift generic type arguments. (no canonical witness for Scalar)

MLTensor.init(_:)

This parameter hides a concrete Swift type.

MLTensor.init(_:)

This parameter hides a concrete Swift type.

All CoreML types →