Bidirectional

public struct Bidirectional<RNNLayer> : LayerType where RNNLayer : RNN
extension Bidirectional: Codable where RNNLayer: Codable

A bidirectional RNN

  • Declaration

    Swift

    public typealias Inputs = RNNLayer.Inputs
  • Declaration

    Swift

    public typealias Outputs = (forward: RNNLayer.Outputs, backward: RNNLayer.Outputs)
  • Declaration

    Swift

    public var parameterPaths: [WritableKeyPath<`Self`, Tensor<RNNLayer.Parameter, RNNLayer.Device>>] { get }
  • Declaration

    Swift

    public var parameters: [Tensor<RNNLayer.Parameter, RNNLayer.Device>] { get }
  • RNN for forwards direction

    Declaration

    Swift

    public var forwardLayer: RNNLayer
  • RNN for backwards direction

    Declaration

    Swift

    public var backwardLayer: RNNLayer
  • Creates a bidirectional RNN with the given RNNs for the forward and backward pass.

    Declaration

    Swift

    public init(forward: RNNLayer, backward: RNNLayer)

    Parameters

    forward

    RNN for forward pass. Must have direction == .forward.

    backward

    RNN for backward pass. Must have direction == .backward.

  • Declaration

    Swift

    public func callAsFunction(_ inputs: RNNLayer.Inputs) -> (forward: (RNNLayer.State, () -> RNNLayer.StateSequence), backward: (RNNLayer.State, () -> RNNLayer.StateSequence))