Structures

The following structures are available globally.

  • The helper to collect data from the given Envs.

    The policy is intentional to be flexible as a simple closure. We collect both the action and state data the closure provides. There may be some type conversions for what the Env expects and what the policy provides, thus, need to specify both. To make this easier to use, the placeholder type would be useful: Collector<Float, (), _, _>(envs: envs) { ... }

    See more

    Declaration

    Swift

    public struct Collector<Element: TensorNumeric, StateType, EnvType: Env, EnvElement: TensorNumeric>
    where EnvType.ObsType == Tensor<EnvElement>, EnvType.ActType == Tensor<EnvElement>
  • Declaration

    Swift

    public struct CollectedData<Element, StateType>
  • A pandas-inspired dataframe. Dataframe is a tabular data representation. This particular Dataframe implementation is most useful to implement data feeder pipeline. You need some transformations so some text or images can be transformed into tensors for a model to consume. Dataframe can be used to implement that pipeline.

    See more

    Declaration

    Swift

    public struct DataFrame
  • Declaration

    Swift

    public struct DataSeriesIterator<S> : IteratorProtocol where S : DataSeries
  • Declaration

    Swift

    public struct GradScaler
  • Hint are parameters to these operations that changes shape from input to output. It given proper stride / padding parameters for these operations.

    See more

    Declaration

    Swift

    public struct Hint
  • Softmax cross-entropy loss. This combines softmax with cross-entropy loss to maximize numerical stability.

    See more

    Declaration

    Swift

    public struct SoftmaxCrossEntropyLoss : Loss
  • Sigmoid cross-entropy loss. This combines sigmoid with binary cross-entropy loss to maximize numerical stability.

    See more

    Declaration

    Swift

    public struct SigmoidBinaryCrossEntropyLoss : Loss
  • Binary cross-entropy loss.

    See more

    Declaration

    Swift

    public struct BinaryCrossEntropyLoss : Loss
  • Multi-class cross-entropy loss.

    See more

    Declaration

    Swift

    public struct CategoricalCrossEntropyLoss : Loss
  • Smooth L1 loss (for object detection).

    See more

    Declaration

    Swift

    public struct SmoothL1Loss : Loss
  • MSE loss. Currently it does reduce mean.

    See more

    Declaration

    Swift

    public struct MSELoss : Loss
  • Declaration

    Swift

    @resultBuilder
    public struct Sequential
  • Basic tensor type.

    See more

    Declaration

    Swift

    public struct Tensor<Element> : AnyTensor where Element : TensorNumeric
    extension Tensor: ExpressibleByArrayLiteral
    extension Tensor: CustomStringConvertible
    extension Tensor: CustomDebugStringConvertible
    extension Tensor: PythonConvertible where Element: NumpyScalarCompatible
  • A simple helper to compute numerical statistic properties (mean and standard deviations) from a given collection.

    See more

    Declaration

    Swift

    public struct NumericalStatistics
  • Stochastic gradient descent optimizer.

    See more

    Declaration

    Swift

    public struct SGDOptimizer : Optimizer, OptimizerAddons
  • Adam optimizer.

    See more

    Declaration

    Swift

    public struct AdamOptimizer : Optimizer, OptimizerAddons, OptimizerTrackSteps
  • LAMB optimizer.

    See more

    Declaration

    Swift

    public struct LAMBOptimizer : Optimizer, OptimizerAddons, OptimizerTrackSteps
  • AdamW optimizer.

    See more

    Declaration

    Swift

    public struct AdamWOptimizer : Optimizer, OptimizerAddons, OptimizerTrackSteps
  • PPO

    Declaration

    Swift

    public struct PPO
  • Declaration

    Swift

    public struct RunningMeanStd<TensorElement>
  • Declaration

    Swift

    public struct SFMT : RandomNumberGenerator
  • A writer for writing model execution summaries to a tensorboard-readable file; the summaries include scalars for logging statistics, graphs for visualizing model etc.

    See more

    Declaration

    Swift

    public struct SummaryWriter
  • Tensor shape (or dimensions)

    See more

    Declaration

    Swift

    public struct TensorShape
    extension TensorShape: ExpressibleByArrayLiteral
    extension TensorShape: CustomStringConvertible
    extension TensorShape: Equatable
    extension TensorShape: RandomAccessCollection