GRU

public struct GRU<Element, Device> : RNN, Codable where Element : RandomizableType, Device : DeviceType

Undocumented

  • Declaration

    Swift

    public typealias Inputs = Tensor<Element, Device>
  • Declaration

    Swift

    public typealias Outputs = (Tensor<Element, Device>, () -> Tensor<Element, Device>)
  • Declaration

    Swift

    public var parameterPaths: [WritableKeyPath<`Self`, Tensor<Element, Device>>] { get }
  • Undocumented

    Declaration

    Swift

    public let direction: RNNDirection
  • Wz

    Undocumented

    Declaration

    Swift

    public var Wz: Tensor<Element, Device>
  • Wr

    Undocumented

    Declaration

    Swift

    public var Wr: Tensor<Element, Device>
  • Wh

    Undocumented

    Declaration

    Swift

    public var Wh: Tensor<Element, Device>
  • Uz

    Undocumented

    Declaration

    Swift

    public var Uz: Tensor<Element, Device>
  • Ur

    Undocumented

    Declaration

    Swift

    public var Ur: Tensor<Element, Device>
  • Uh

    Undocumented

    Declaration

    Swift

    public var Uh: Tensor<Element, Device>
  • bz

    Undocumented

    Declaration

    Swift

    public var bz: Tensor<Element, Device>
  • br

    Undocumented

    Declaration

    Swift

    public var br: Tensor<Element, Device>
  • bh

    Undocumented

    Declaration

    Swift

    public var bh: Tensor<Element, Device>
  • Size of inputs of the layer

    Declaration

    Swift

    public var inputSize: Int { get }
  • Size of outputs of the layer

    Declaration

    Swift

    public var hiddenSize: Int { get }
  • Declaration

    Swift

    public var parameters: [Tensor<Element, Device>] { get }
  • Creates a Gated Recurrent Unit layer.

    The RNN expects inputs to have a shape of [sequence length, batch size, input size].

    Declaration

    Swift

    public init(inputSize: Int, hiddenSize: Int, direction: RNNDirection = .forward)

    Parameters

    inputSize

    Number of elements at each timestep of the input

    hiddenSize

    Number of elements at each timestep in the output

    direction

    Direction, in which the RNN consumes the input sequence.

  • Declaration

    Swift

    public func numberOfSteps(for inputs: Tensor<Element, Device>) -> Int
  • Declaration

    Swift

    public func initialState(for inputs: Tensor<Element, Device>) -> Tensor<Element, Device>
  • Declaration

    Swift

    public func prepare(inputs: Tensor<Element, Device>) -> (Tensor<Element, Device>, Tensor<Element, Device>, Tensor<Element, Device>)
  • Declaration

    Swift

    public func input(at step: Int, using preparedInput: (Tensor<Element, Device>, Tensor<Element, Device>, Tensor<Element, Device>)) -> (Tensor<Element, Device>, Tensor<Element, Device>, Tensor<Element, Device>)
  • Declaration

    Swift

    public func step(_ preparedInput: (Tensor<Element, Device>, Tensor<Element, Device>, Tensor<Element, Device>), previousState: Tensor<Element, Device>) -> Tensor<Element, Device>
  • Declaration

    Swift

    public func concatenate(_ states: [Tensor<Element, Device>]) -> Tensor<Element, Device>