Caffe
rnn_layer.hpp
1 #ifndef CAFFE_RNN_LAYER_HPP_
2 #define CAFFE_RNN_LAYER_HPP_
3 
4 #include <string>
5 #include <utility>
6 #include <vector>
7 
8 #include "caffe/blob.hpp"
9 #include "caffe/common.hpp"
10 #include "caffe/layer.hpp"
11 #include "caffe/layers/recurrent_layer.hpp"
12 #include "caffe/net.hpp"
13 #include "caffe/proto/caffe.pb.h"
14 
15 namespace caffe {
16 
17 template <typename Dtype> class RecurrentLayer;
18 
29 template <typename Dtype>
30 class RNNLayer : public RecurrentLayer<Dtype> {
31  public:
32  explicit RNNLayer(const LayerParameter& param)
33  : RecurrentLayer<Dtype>(param) {}
34 
35  virtual inline const char* type() const { return "RNN"; }
36 
37  protected:
38  virtual void FillUnrolledNet(NetParameter* net_param) const;
39  virtual void RecurrentInputBlobNames(vector<string>* names) const;
40  virtual void RecurrentOutputBlobNames(vector<string>* names) const;
41  virtual void RecurrentInputShapes(vector<BlobShape>* shapes) const;
42  virtual void OutputBlobNames(vector<string>* names) const;
43 };
44 
45 } // namespace caffe
46 
47 #endif // CAFFE_RNN_LAYER_HPP_
virtual void OutputBlobNames(vector< string > *names) const
Fills names with the names of the output blobs, concatenated across all timesteps. Should return a name for each top Blob. Subclasses should define this – see RNNLayer and LSTMLayer for examples.
Definition: rnn_layer.cpp:36
virtual void RecurrentInputShapes(vector< BlobShape > *shapes) const
Fills shapes with the shapes of the recurrent input Blob&s. Subclasses should define this – see RNNL...
Definition: rnn_layer.cpp:26
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
An abstract class for implementing recurrent behavior inside of an unrolled network. This Layer type cannot be instantiated – instead, you should use one of its implementations which defines the recurrent architecture, such as RNNLayer or LSTMLayer.
Definition: lstm_layer.hpp:17
virtual void FillUnrolledNet(NetParameter *net_param) const
Fills net_param with the recurrent network architecture. Subclasses should define this – see RNNLaye...
Definition: rnn_layer.cpp:42
virtual const char * type() const
Returns the layer type.
Definition: rnn_layer.hpp:35
virtual void RecurrentOutputBlobNames(vector< string > *names) const
Fills names with the names of the Tth timestep recurrent output Blob&s. Subclasses should define this...
Definition: rnn_layer.cpp:20
Processes time-varying inputs using a simple recurrent neural network (RNN). Implemented as a network...
Definition: rnn_layer.hpp:30
virtual void RecurrentInputBlobNames(vector< string > *names) const
Fills names with the names of the 0th timestep recurrent input Blob&s. Subclasses should define this ...
Definition: rnn_layer.cpp:14