ModelIOConvertible
public protocol ModelIOConvertible
-
Declaration
Swift
var io: Model.IO { get } -
reciprocal()Extension methodCompute the reciprocal for a model IO.
Declaration
Swift
public func reciprocal() -> Model.IO -
squareRoot()Extension methodCompute the reciprocal for a model IO.
Declaration
Swift
public func squareRoot() -> Model.IO -
reshaped(_:Extension methodoffset: strides: format: ) 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.IOParameters
dimensionsThe new dimensions for the input.
offsetWhether apply certain offset for each dimension.
stridesWhat’s the stride for each dimension.
formatWhat’s the new format of the tensor.
-
reshaped(_:Extension methodoffset: strides: ) 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.IOParameters
shapeThe new dimensions and format for the input.
offsetWhether apply certain offset for each dimension.
stridesWhat’s the stride for each dimension.
formatWhat’s the new format of the tensor.
-
padded(_:Extension methodbegin: end: ) Pad an IO to a new dimension.
Declaration
Swift
public func padded(_ mode: Pad.Mode, begin: TensorShape, end: TensorShape) -> Model.IOParameters
beginThe beginning pad for each dimension.
endThe end pad for each dimension.
-
identity()Extension methodIdentity 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.IOParameters
indicesThe dimensions to pick from the input.
-
ReLU()Extension method -
leakyReLU(negativeSlope:Extension method) Apply leaky ReLU activation to the said IO.
Declaration
Swift
public func leakyReLU(negativeSlope: Float) -> Model.IO -
softmax()Extension methodApply softmax activation to the said IO.
Declaration
Swift
public func softmax() -> Model.IO -
sigmoid()Extension methodApply sigmoid activation to the said IO.
Declaration
Swift
public func sigmoid() -> Model.IO -
tanh()Extension methodApply tanh activation to the said IO.
Declaration
Swift
public func tanh() -> Model.IO -
swish()Extension methodApply swish activation to the said IO.
Declaration
Swift
public func swish() -> Model.IO -
GELU(approximate:Extension method) -
transposed(_:Extension method_: ) Declaration
Swift
public func transposed(_ axisA: Int, _ axisB: Int) -> Model.IO -
reduced(_:Extension methodaxis: ) -
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(_:Extension methodaxis: ) Declaration
Swift
public func chunked(_ numberOfChunks: Int, axis: Int) -> [Model.IO] -
to(_:Extension method) -
to(of:Extension method) Convert an IO to a new datatype.
Declaration
Swift
public func to(of other: ModelIOConvertible) -> Model.IOParameters
ofThe other ModelIO which will share the same input.
-
contiguous()Extension methodMake the output contiguous in memory.
Declaration
Swift
public func contiguous() -> Model.IO -
copied()Extension methodMake the output contiguous in memory.
Declaration
Swift
public func copied() -> 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:Extension methodname: ) 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 -
debug(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 debug(name: String = "", _ callback: @escaping ([AnyTensor?], StreamContext?) -> Void) -> Model.IO
ModelIOConvertible Protocol Reference