BasicRNN

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

A ‘vanilla’ RNN. In each step, the RNN performs the transformation matMul(x_t, W) + matMul(h_t-1, U) + b

  • 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
  • W

    Undocumented

    Declaration

    Swift

    public var W: Tensor<Element, Device>
  • U

    Undocumented

    Declaration

    Swift

    public var U: Tensor<Element, Device>
  • b

    Undocumented

    Declaration

    Swift

    public var b: Tensor<Element, Device>
  • Undocumented

    Declaration

    Swift

    public var inputSize: Int { get }
  • Undocumented

    Declaration

    Swift

    public var hiddenSize: Int { get }
  • Declaration

    Swift

    public var parameters: [Tensor<Element, Device>] { get }
  • A ‘vanilla’ RNN. In each step, the RNN performs the transformation matMul(x_t, W) + matMul(h_t-1, U) + b.

    Declaration

    Swift

    public init(inputSize: Int, hiddenSize: Int, direction: RNNDirection = .forward)
  • 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>
  • Declaration

    Swift

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

    Swift

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

    Swift

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

    Swift

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