MultiArray

@available(iOS 11.0, *)
public struct MultiArray<T> where T : MultiArrayType

Wrapper around MLMultiArray to make it more Swifty.

  • Declaration

    Swift

    public let array: MLMultiArray
  • Declaration

    Swift

    public let pointer: UnsafeMutablePointer<T>
  • Declaration

    Swift

    private(set) public var strides: [Int]
  • Declaration

    Swift

    private(set) public var shape: [Int]
  • Creates a new multi-array filled with all zeros.

    Declaration

    Swift

    public init(shape: [Int])
  • Creates a new multi-array initialized with the specified value.

    Declaration

    Swift

    public init(shape: [Int], initial: T)
  • Creates a multi-array that wraps an existing MLMultiArray.

    Declaration

    Swift

    public init(_ array: MLMultiArray)
  • Returns the number of elements in the entire array.

    Declaration

    Swift

    public var count: Int { get }
  • Declaration

    Swift

    public subscript(a: Int) -> T { get set }
  • Declaration

    Swift

    public subscript(a: Int, b: Int) -> T { get set }
  • Declaration

    Swift

    public subscript(a: Int, b: Int, c: Int) -> T { get set }
  • Declaration

    Swift

    public subscript(a: Int, b: Int, c: Int, d: Int) -> T { get set }
  • Declaration

    Swift

    public subscript(a: Int, b: Int, c: Int, d: Int, e: Int) -> T { get set }
  • Declaration

    Swift

    public subscript(indices: [Int]) -> T { get set }
  • Returns a transposed version of this array. NOTE: The new array still uses the same underlying storage (the same MLMultiArray object).

    Declaration

    Swift

    public func transposed(_ order: [Int]) -> MultiArray
  • Changes the number of dimensions and their sizes.

    Declaration

    Swift

    public func reshaped(_ dimensions: [Int]) -> MultiArray