ModelIOConvertible

public protocol ModelIOConvertible
  • io

    Declaration

    Swift

    var io: Model.IO { get }
  • reciprocal() Extension method

    Compute the reciprocal for a model IO.

    Declaration

    Swift

    public func reciprocal() -> Model.IO
  • squareRoot() Extension method

    Compute the reciprocal for a model IO.

    Declaration

    Swift

    public func squareRoot() -> Model.IO
  • Reshape an IO to a new dimension. You cannot reshape data types.

    Declaration

    Swift

    public func reshaped(
      _ dimensions: TensorShape, offset: TensorShape? = nil, strides: TensorShape? = nil,
      format: TensorFormat? = nil
    )
      -> Model.IO

    Parameters

    dimensions

    The new dimensions for the input.

    offset

    Whether apply certain offset for each dimension.

    strides

    What’s the stride for each dimension.

    format

    What’s the new format of the tensor.

  • reshaped(_:offset:strides:) Extension method

    Reshape an IO to a new dimension. You cannot reshape data types.

    Declaration

    Swift

    public func reshaped(
      _ shape: TensorShapeFormat, offset: TensorShape? = nil, strides: TensorShape? = nil
    )
      -> Model.IO

    Parameters

    shape

    The new dimensions and format for the input.

    offset

    Whether apply certain offset for each dimension.

    strides

    What’s the stride for each dimension.

    format

    What’s the new format of the tensor.

  • padded(_:begin:end:) Extension method

    Pad an IO to a new dimension.

    Declaration

    Swift

    public func padded(_ mode: Pad.Mode, begin: TensorShape, end: TensorShape) -> Model.IO

    Parameters

    begin

    The beginning pad for each dimension.

    end

    The end pad for each dimension.

  • identity() Extension method

    Identity op for a model IO. This doesn’t do anything but to change the order of execution.

    Declaration

    Swift

    public func identity() -> Model.IO
  • permuted(_:) Extension method

    Permute an IO according to the indices.

    Declaration

    Swift

    public func permuted(_ indices: Int...)
      -> Model.IO

    Parameters

    indices

    The dimensions to pick from the input.

  • ReLU() Extension method

    Apply ReLU activation to the said IO.

    Declaration

    Swift

    public func ReLU() -> Model.IO
  • leakyReLU(negativeSlope:) Extension method

    Apply leaky ReLU activation to the said IO.

    Declaration

    Swift

    public func leakyReLU(negativeSlope: Float) -> Model.IO
  • softmax() Extension method

    Apply softmax activation to the said IO.

    Declaration

    Swift

    public func softmax() -> Model.IO
  • sigmoid() Extension method

    Apply sigmoid activation to the said IO.

    Declaration

    Swift

    public func sigmoid() -> Model.IO
  • tanh() Extension method

    Apply tanh activation to the said IO.

    Declaration

    Swift

    public func tanh() -> Model.IO
  • swish() Extension method

    Apply swish activation to the said IO.

    Declaration

    Swift

    public func swish() -> Model.IO
  • GELU(approximate:) Extension method

    Apply GELU activation to the said IO.

    Declaration

    Swift

    public func GELU(approximate: GELU.Approximate = .none) -> Model.IO
  • transposed(_:_:) Extension method

    Declaration

    Swift

    public func transposed(_ axisA: Int, _ axisB: Int) -> Model.IO
  • reduced(_:axis:) Extension method

    Declaration

    Swift

    public func reduced(_ op: ReduceOp, axis: [Int]) -> Model.IO
  • subscript(_:) Extension method

    Declaration

    Swift

    public subscript(index: Int) -> Model.IO { get }
  • argmax(axis:) Extension method

    Declaration

    Swift

    public func argmax(axis: Int) -> Model.IO
  • argmin(axis:) Extension method

    Declaration

    Swift

    public func argmin(axis: Int) -> Model.IO
  • chunked(_:axis:) Extension method

    Declaration

    Swift

    public func chunked(_ numberOfChunks: Int, axis: Int) -> [Model.IO]
  • to(_:) Extension method

    Convert an IO to a new datatype.

    Declaration

    Swift

    public func to(_ dataType: DataType) -> Model.IO

    Parameters

    datatype

    The new datatype for the input.

  • to(of:) Extension method

    Convert an IO to a new datatype.

    Declaration

    Swift

    public func to(of other: ModelIOConvertible) -> Model.IO

    Parameters

    of

    The other ModelIO which will share the same input.

  • contiguous() Extension method

    Make the output contiguous in memory.

    Declaration

    Swift

    public func contiguous() -> Model.IO
  • clamped(_:) Extension method

    Clamp the given model IO between two values.

    Declaration

    Swift

    public func clamped(_ range: ClosedRange<Float>)
      -> Model.IO
  • clamped(_:) Extension method

    Clamp the given model IO with a lower bound.

    Declaration

    Swift

    public func clamped(_ range: PartialRangeFrom<Float>)
      -> Model.IO
  • clamped(_:) Extension method

    Clamp the given model IO with an upper bound.

    Declaration

    Swift

    public func clamped(_ range: PartialRangeThrough<Float>)
      -> Model.IO
  • moved(to:name:) Extension method

    Move the value to another Model.IO. This is a special operation that can perform optimizations violates SSA. Use it with extreme care.

    Declaration

    Swift

    public func moved(to output: ModelIOConvertible, name: String = "")
      -> Model.IO