RawInputModule.hpp 797 Bytes
Newer Older
1
2
#ifndef RAWINPUTMODULE__H
#define RAWINPUTMODULE__H
Franck Dary's avatar
Franck Dary committed
3
4
5

#include <torch/torch.h>
#include "Submodule.hpp"
6
#include "MyModule.hpp"
Franck Dary's avatar
Franck Dary committed
7
#include "LSTM.hpp"
8
#include "GRU.hpp"
Franck Dary's avatar
Franck Dary committed
9
#include "Concat.hpp"
10
#include "WordEmbeddings.hpp"
Franck Dary's avatar
Franck Dary committed
11

Franck Dary's avatar
Franck Dary committed
12
class RawInputModuleImpl : public Submodule
Franck Dary's avatar
Franck Dary committed
13
14
15
{
  private :

16
  WordEmbeddings wordEmbeddings{nullptr};
17
  std::shared_ptr<MyModule> myModule{nullptr};
Franck Dary's avatar
Franck Dary committed
18
  int leftWindow, rightWindow;
19
  int inSize;
Franck Dary's avatar
Franck Dary committed
20
21
22

  public :

Franck Dary's avatar
Franck Dary committed
23
  RawInputModuleImpl(std::string name, const std::string & definition);
Franck Dary's avatar
Franck Dary committed
24
25
26
  torch::Tensor forward(torch::Tensor input);
  std::size_t getOutputSize() override;
  std::size_t getInputSize() override;
Franck Dary's avatar
Franck Dary committed
27
  void addToContext(std::vector<std::vector<long>> & context, const Config & config) override;
28
  void registerEmbeddings() override;
Franck Dary's avatar
Franck Dary committed
29
};
Franck Dary's avatar
Franck Dary committed
30
TORCH_MODULE(RawInputModule);
Franck Dary's avatar
Franck Dary committed
31
32
33

#endif