Classes

The following classes are available globally.

  • A dynamic graph is a workspace for computations. All tensor variables can be tracked from a dynamic graph.

    See more

    Declaration

    Swift

    public final class DynamicGraph
  • A model is a base class for stateful operations on a dynamic graph. It can be use to construct computations statically, thus, more efficient.

    See more

    Declaration

    Swift

    public class Model
    extension Model: Hashable
  • A model builder is a more generic type of model. A model can be quite static, thus, you have to be quite careful to have a model work with dynamic inputs. You cannot use reshape, or anything that can generate fixed tensor outputs from a fixed inputs.

    A model builder on the other hand doesn’t have that restriction. When input changes, it simply calls the given builder closure to construct a new model. In such way, you can continue to use reshape etc to assume fixed inputs and outputs, it will just work for dynamic inputs. The newly built model will carry over stateful components (parameters) from the old models, thus, it doesn’t reset your training. This also means you need to make sure parameter shape won’t change when input changes, otherwise we will fatal.

    See more

    Declaration

    Swift

    public final class ModelBuilder<T> : AnyModelBuilder
  • Sum

    Sum inputs.

    See more

    Declaration

    Swift

    public final class Sum : Model
  • Add

    Add two inputs together. It will do broadcast if needed.

    See more

    Declaration

    Swift

    public final class Add : Model
  • Mul

    Multiply two inputs together. It will do broadcast if needed.

    See more

    Declaration

    Swift

    public final class Mul : Model
  • Matrix-multiplication over two inputs.

    See more

    Declaration

    Swift

    public final class Matmul : Model
  • A linear layer model.

    See more

    Declaration

    Swift

    public final class Dense : Model
  • A reshape model.

    See more

    Declaration

    Swift

    public final class Reshape : Model
  • A ReLU activation model.

    See more

    Declaration

    Swift

    public final class RELU : Model
  • A softmax activation model.

    See more

    Declaration

    Swift

    public final class Softmax : Model
  • A sigmoid activation model.

    See more

    Declaration

    Swift

    public final class Sigmoid : Model
  • A swish activation model.

    See more

    Declaration

    Swift

    public final class Swish : Model
  • Undocumented

    See more

    Declaration

    Swift

    public final class Transpose : Model
  • The masked fill model. If the value equal to a given constant, fill with another constant.

    See more

    Declaration

    Swift

    public final class MaskedFill : Model
  • The dropout model.

    See more

    Declaration

    Swift

    public final class Dropout : Model
  • Multiply all values with a constant.

    See more

    Declaration

    Swift

    public final class Scalmul : Model
  • Batch normalization model.

    See more

    Declaration

    Swift

    public final class BatchNorm : Model
  • Layer normalization model.

    See more

    Declaration

    Swift

    public final class LayerNorm : Model
  • Make the input tensor to be 1-D tensor (respecting N).

    See more

    Declaration

    Swift

    public final class Flatten : Model
  • Convolution model.

    See more

    Declaration

    Swift

    public final class Convolution : Model
  • max pooling model.

    See more

    Declaration

    Swift

    public final class MaxPool : Model
  • average pooling model.

    See more

    Declaration

    Swift

    public final class AveragePool : Model
  • A type-erased model builder.

    See more

    Declaration

    Swift

    public class AnyModelBuilder
  • Model Inputs for Functional Model

    See more

    Declaration

    Swift

    public final class Input : Model.IO
  • A stream context is an object that an execution can be performed upon.

    See more

    Declaration

    Swift

    public final class StreamContext
  • Undocumented

    Declaration

    Swift

    public final class AnyTensorStorage