forked from ZDisket/TensorVox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tfg2p.h
38 lines (27 loc) · 844 Bytes
/
tfg2p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef TFG2P_H
#define TFG2P_H
#include "ext/CppFlow/include/Model.h"
#include "VoxCommon.hpp"
class TFG2P
{
private:
Model* G2P;
public:
TFG2P();
TFG2P(const std::string& SavedModelFolder);
/*
Initialize and load the model
-> SavedModelFolder: Folder where the .pb, variables, and other characteristics of the exported SavedModel
<- Returns: (bool)Success
*/
bool Initialize(const std::string& SavedModelFolder);
/*
Do inference on a G2P-TF-RNN model.
-> InputIDs: Input IDs of tokens for inference
-> Temperature: Temperature of the RNN, values higher than 0.1 cause instability.
<- Returns: TFTensor<int32_t> containing phoneme IDs
*/
TFTensor<int32_t> DoInference(const std::vector<int32_t>& InputIDs, float Temperature = 0.1f);
~TFG2P();
};
#endif // TFG2P_H