IO
public class IO
A IO class represent the abstract input / output for a model. It can correspond to one or more tensors when the model is materialized.
-
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 ) -> 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.
-
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.
-
Apply leaky ReLU activation to the said IO.
Declaration
Swift
public func leakyReLU(negativeSlope: Float) -> Model.IO
-
Apply softmax activation to the said IO.
Declaration
Swift
public func softmax() -> Model.IO
-
Apply sigmoid activation to the said IO.
Declaration
Swift
public func sigmoid() -> Model.IO
-
Apply tanh activation to the said IO.
Declaration
Swift
public func tanh() -> Model.IO
-
Apply swish activation to the said IO.
Declaration
Swift
public func swish() -> Model.IO
-
Declaration
Swift
public func transposed(_ axisA: Int, _ axisB: Int) -> Model.IO
-
Clamp the given model IO between two values.
Declaration
Swift
public func clamped(_ range: ClosedRange<Float>) -> Model.IO
-
Clamp the given model IO with a lower bound.
Declaration
Swift
public func clamped(_ range: PartialRangeFrom<Float>) -> Model.IO
-
Clamp the given model IO with an upper bound.
Declaration
Swift
public func clamped(_ range: PartialRangeThrough<Float>) -> Model.IO
-
Add non-functional dependencies between IOs. Normally, dependencies are inferred by usage. However, in some cases you want to hack the dependency such that two unrelated ops can establish a dependency. This is useful to enforce system to share memory for example.
Declaration
Swift
public func add(dependencies: [Model.IO])
Parameters
dependencies
The IOs which will be the dependencies of the current IO.