Random

public enum Random

Undocumented

  • Undocumented

    Declaration

    Swift

    @_specialize(exported: false, kind: full, where Element == Float, Device == CPU)
    @_specialize(exported: false, kind: full, where Element == Double, Device == CPU)
    @_specialize(exported: false, kind: full, where Element == Int32, Device == CPU)
    public static func fill<Element, Device>(_ vector: ShapedBuffer<Element, Device>, a: Element, b: Element) where Element : RandomizableType, Device : DeviceType
  • Undocumented

    Declaration

    Swift

    @_specialize(exported: false, kind: full, where Element == Float, Device == CPU)
    @_specialize(exported: false, kind: full, where Element == Double, Device == CPU)
    @_specialize(exported: false, kind: full, where Element == Int32, Device == CPU)
    public static func fillNormal<Element, Device>(_ vector: ShapedBuffer<Element, Device>, mean: Element = 0, stdev: Element = 1) where Element : RandomizableType, Device : DeviceType
  • Samples a random minibatch of tensors from the given data set with shape [sample count, sample_dim1, …, sample_dim_n]

    Declaration

    Swift

    public static func minibatch<Element, Device>(from dataset: Tensor<Element, Device>, count: Int) -> Tensor<Element, Device> where Element : NumericType, Device : DeviceType

    Parameters

    dataset

    Dataset to sample a batch from

    count

    Number of elements to include in the batch

  • Samples a random minibatch of tensors from the given data set with shape [sample count, sample_dim1, …, sample_dim_n] and their corresponding expected output vectors.

    Declaration

    Swift

    public static func minibatch<E1, E2, D1, D2>(from dataset: Tensor<E1, D1>, labels: Tensor<E2, D2>, count: Int) -> (Tensor<E1, D1>, Tensor<E2, D2>) where E1 : NumericType, E2 : NumericType, D1 : DeviceType, D2 : DeviceType

    Parameters

    dataset

    Dataset to sample a batch from

    labels

    Corresponding expected output vectors

    count

    Number of elements to include in the batch

  • Undocumented

    Declaration

    Swift

    @_specialize(exported: false, kind: full, where Element == Float, Device == CPU)
    @_specialize(exported: false, kind: full, where Element == Int32, Device == CPU)
    @_specialize(exported: false, kind: full, where Element == Double, Device == CPU)
    public static func bernoulli<Element, Device>(_ values: ShapedBuffer<Element, Device>, p: Float) where Element : NumericType, Device : DeviceType