AnyModel

public protocol AnyModel
  • Whether the existing model is for testing or training.

    Declaration

    Swift

    var testing: Bool { get set }
  • Whether to enable memory reduction for this model. The current supported memory reduction technique is to redo datatype conversion during backward pass if needed.

    Declaration

    Swift

    var memoryReduction: Bool { get set }
  • Specify the maximum number of streams we need to allocate to run this model.

    Declaration

    Swift

    var maxConcurrency: StreamContext.Concurrency { get set }
  • Abstract representation of the stateful components from the model builder.

    Declaration

    Swift

    var parameters: Model.Parameters { get }
  • Shortcut for weight parameter.

    Declaration

    Swift

    var weight: Model.Parameters { get }
  • Shortcut for bias parameter.

    Declaration

    Swift

    var bias: Model.Parameters { get }
  • Broadly speaking, you can have two types of parameters, weight and bias. You can get them in abstract fashion with this method.

    Declaration

    Swift

    func parameters(for type: Model.ParametersType) -> Model.Parameters

    Parameters

    type

    Whether it is weight or bias.

    Return Value

    An abstract representation of parameters.

  • Cancel current evaluation of this model. It only cancels the model that you know is currently in evaluation, if you didn’t get the execution order right, it won’t have effect (you need to make sure this method, if it is called, is strictly after call to callAsFunction and before it returns).

    Declaration

    Swift

    func cancel()