EngineType

public protocol EngineType

Tensor operation engine for a device

  • Undocumented

    Declaration

    Swift

    associatedtype Device : DeviceType where Self == Self.Device.Engine

Simple operations

Matrix operations

Broadcasting

Reduction

Element-wise functions

Shuffling

Convolution Helpers

  • Performs an img2col transformation that extracts all windows for a convolution into a matrix.

    Declaration

    Swift

    static func img2col<N>(values: ShapedBuffer<N, Device>, result: ShapedBuffer<N, Device>, kernelWidth: Int, kernelHeight: Int, padding: Int, stride: Int) where N : NumericType

    Parameters

    values

    Image buffer, shape [batchSize, channels, height, width]

    result

    Result buffer, shape [channels * kernelWidth * kernelHeight, number of windows]

    kernelWidth

    Width of the convolution kernel

    kernelHeight

    Height of the convolution kernel

    padding

    Zero padding applied around the input image

    stride

    Stride, with which the window is moved over the input image

  • Performs an col2img transformation that aggregates all windows from a convolution matrix into an image tensor.

    Declaration

    Swift

    static func col2img<N>(matrix: ShapedBuffer<N, Device>, image: ShapedBuffer<N, Device>, kernelWidth: Int, kernelHeight: Int, padding: Int, stride: Int) where N : NumericType

    Parameters

    values

    Buffer, shape [channels * kernelWidth * kernelHeight, number of windows]

    result

    Image buffer, shape [batchSize, channels, height, width]

    kernelWidth

    Width of the convolution kernel

    kernelHeight

    Height of the convolution kernel

    padding

    Zero padding applied around the input image

    stride

    Stride, with which the window is moved over the input image