SimpleModel.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <utility>
6 #include <vector>
7 
10 
11 namespace tensorflow { class TFHandler; class Tensor; }
12 
14 {
15 private:
17  mutable std::shared_ptr<tensorflow::TFHandler> tfHandler;
18  mutable bool initialized;
19 
20  static tensorflow::Tensor getFakeProngTensor(
21  const std::vector<std::string> &vars, float fillValue = 0.0
22  );
23 
24  static tensorflow::Tensor getSliceTensor(
25  const std::unordered_map<std::string, double> &varMap,
26  const std::vector<std::string> &vars
27  );
28 
29  static tensorflow::Tensor getProngTensor(
30  const std::unordered_map<std::string, std::vector<double>> &varMap,
31  const std::vector<std::string> &vars
32  );
33 
34 public:
36  const std::string &savedir,
37  const std::vector<InputConfigKeys> &scalarInputKeys,
38  const std::vector<InputConfigKeys> &vectorInputKeys,
39  const std::vector<std::string> &outputKeys
40  );
41 
42  void init() const;
43 
44  std::vector<tensorflow::Tensor> predict(const VarDict &varDict) const;
45 };
46 
const std::map< std::pair< std::string, std::string >, Variable > vars
bool initialized
Definition: SimpleModel.h:18
std::shared_ptr< tensorflow::TFHandler > tfHandler
Definition: SimpleModel.h:17
ModelConfig config
Definition: SimpleModel.h:16
Definition: VarDict.h:7
enum BeamMode string