Path: blob/master/examples/cppwin/TensorflowTTSCppInference/FastSpeech2.h
1559 views
#pragma once12#include "ext/CppFlow/include/Model.h"3#include "VoxCommon.hpp"4class FastSpeech25{6private:7Model* FastSpeech;89public:10FastSpeech2();11FastSpeech2(const std::string& SavedModelFolder);1213/*14Initialize and load the model1516-> SavedModelFolder: Folder where the .pb, variables, and other characteristics of the exported SavedModel17<- Returns: (bool)Success18*/19bool Initialize(const std::string& SavedModelFolder);2021/*22Do inference on a FastSpeech2 model.2324-> InputIDs: Input IDs of tokens for inference25-> SpeakerID: ID of the speaker in the model to do inference on. If single speaker, always leave at 0. If multispeaker, refer to your model.26-> Speed, Energy, F0: Parameters for FS2 inference. Leave at 1.f for defaults2728<- Returns: TFTensor<float> with shape {1,<len of mel in frames>,80} containing contents of mel spectrogram.29*/30TFTensor<float> DoInference(const std::vector<int32_t>& InputIDs, int32_t SpeakerID = 0, float Speed = 1.f, float Energy = 1.f, float F0 = 1.f,int32_t EmotionID = -1);31323334~FastSpeech2();35};36373839