Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TensorSpeech
GitHub Repository: TensorSpeech/TensorFlowTTS
Path: blob/master/examples/cppwin/TensorflowTTSCppInference/tfg2p.h
1559 views
1
#ifndef TFG2P_H
2
#define TFG2P_H
3
#include "ext/CppFlow/include/Model.h"
4
#include "VoxCommon.hpp"
5
6
7
class TFG2P
8
{
9
private:
10
Model* G2P;
11
12
public:
13
TFG2P();
14
TFG2P(const std::string& SavedModelFolder);
15
16
/*
17
Initialize and load the model
18
19
-> SavedModelFolder: Folder where the .pb, variables, and other characteristics of the exported SavedModel
20
<- Returns: (bool)Success
21
*/
22
bool Initialize(const std::string& SavedModelFolder);
23
24
/*
25
Do inference on a G2P-TF-RNN model.
26
27
-> InputIDs: Input IDs of tokens for inference
28
-> Temperature: Temperature of the RNN, values higher than 0.1 cause instability.
29
30
<- Returns: TFTensor<int32_t> containing phoneme IDs
31
*/
32
TFTensor<int32_t> DoInference(const std::vector<int32_t>& InputIDs, float Temperature = 0.1f);
33
34
~TFG2P();
35
36
};
37
38
#endif // TFG2P_H
39
40