ModelIOConvertible

public protocol ModelIOConvertible
  • io

    Declaration

    Swift

    var io: Model.IO { get }
  • 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.

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

  • 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