class InferenceEngine::RNNSequenceLayer

Overview

Sequence of recurrent cells. More…

#include <ie_layers.h>

class RNNSequenceLayer: public InferenceEngine::RNNCellBase
{
public:
    // enums

    enum Direction;

    // fields

    unsigned int axis = 1;
    Direction direction = FWD;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CNNLayer> Ptr;

    // enums

    enum CellType;

    // fields

    std::string name;
    std::string type;
    Precision precision;
    std::vector<DataPtr> outData;
    std::vector<DataWeakPtr> insData;
    Ptr _fusedWith;
    UserValue userValue;
    std::string affinity;
    std::map<std::string, std::string> params;
    std::map<std::string, Blob::Ptr> blobs;
    Blob::Ptr _weights;
    Blob::Ptr _biases;
    CellType cellType = LSTM;
    int hidden_size = 0;
    float clip = 0.0f;
    std::vector<std::string> activations;
    std::vector<float> activation_alpha;
    std::vector<float> activation_beta;

    // methods

    std::shared_ptr<ngraph::Node> getNode() const;
    void fuse(Ptr& layer);
    virtual const DataPtr input() const;
    void parseParams();
    float GetParamAsFloat(const char \* param, float def) const;
    float GetParamAsFloat(const char \* param) const;
    std::vector<float> GetParamAsFloats(const char \* param, std::vector<float> def) const;
    std::vector<float> GetParamAsFloats(const char \* param) const;
    int GetParamAsInt(const char \* param, int def) const;
    int GetParamAsInt(const char \* param) const;
    std::vector<int> GetParamAsInts(const char \* param, std::vector<int> def) const;
    std::vector<int> GetParamAsInts(const char \* param) const;
    unsigned int GetParamAsUInt(const char \* param, unsigned int def) const;
    unsigned int GetParamAsUInt(const char \* param) const;
    size_t GetParamAsSizeT(const char \* param, size_t def) const;
    size_t GetParamAsSizeT(const char \* param) const;

    std::vector<unsigned int> GetParamAsUInts(
        const char \* param,
        std::vector<unsigned int> def
        ) const;

    std::vector<unsigned int> GetParamAsUInts(const char \* param) const;
    bool GetParamAsBool(const char \* param, bool def) const;
    bool GetParamAsBool(const char \* param) const;
    std::string GetParamAsString(const char \* param, const char \* def) const;
    bool CheckParamPresence(const char \* param) const;
    std::string GetParamAsString(const char \* param) const;
    std::string getBoolStrParamAsIntStr(const char \* param) const;

    std::vector<std::string> GetParamAsStrings(
        const char \* param,
        std::vector<std::string> def
        ) const;

    static float ie_parse_float(const std::string& str);
    static std::string ie_serialize_float(float value);
    CNNLayer(const LayerParams& prms);
    CNNLayer(const CNNLayer& other);
    WeightableLayer(const LayerParams& prms);

Detailed Documentation

Sequence of recurrent cells.

Deprecated Migrate to IR v10 and work with ngraph::Function directly. The method will be removed in 2021.1

N - batch size T - sequence size S - state size (=hidden_size) NS - num of state tensors (LSTM=2, GRU/RNN=1) ND - num of direction (BDR=2, WFD/BWD=1)

Inputs: [N,T,D] Xt - input data [ND,N,S] Ht-1 - initial hidden state [ND,N,S] Ct-1 - initial cell state // if NS==2 [N] SL - sequence length (optional input)

Outputs: [ND,N,T,S] Xt - input data [ND,N,S] Ht-1 - initial hidden state [ND,N,S] Ct-1 - initial cell state // if NS==2

NB! if axis==0 batch and sequense dimensions are swapped (N <-> T) for input and output tensors

Weights:

  • weights [ND, G,S,D+S]

  • biases [ND, G,S] NB! if ND==2 weights are concatenated cell weights [forward_cell_weights, backward_cell_weights]

Fields

unsigned int axis = 1

An axis by which iteration is performed.

axis=0 means first input/output data blob dimension is sequence axis=1 means first input/output data blob dimension is batch

Direction direction = FWD

Direction of iteration through sequence dimension.