demos/TTSArmLinux: Eliminate warnings about datatype mismatches

> Paddle-Lite/lite/api/light_api.cc:462 CheckInputValid]  Error input tensor precision type. Input index (0) Tensor name (text) Require precision type (int64_t) Input precision type (float).
pull/2991/head
彭逸豪 3 years ago
parent 9eb03eef71
commit 3920960fbf

@ -67,7 +67,7 @@ public:
VOC_predictor_ = nullptr;
}
bool RunModel(const std::vector<float> &phones) {
bool RunModel(const std::vector<int64_t> &phones) {
if (!IsLoaded()) {
return false;
}
@ -88,7 +88,7 @@ public:
return true;
}
std::unique_ptr<const Tensor> GetAMOutput(const std::vector<float> &phones) {
std::unique_ptr<const Tensor> GetAMOutput(const std::vector<int64_t> &phones) {
auto phones_handle = AM_predictor_->GetInput(0);
phones_handle->Resize({static_cast<int64_t>(phones.size())});
phones_handle->CopyFromCpu(phones.data());

@ -6,7 +6,7 @@
using namespace paddle::lite_api;
std::vector<std::vector<float>> sentencesToChoose = {
std::vector<std::vector<int64_t>> sentencesToChoose = {
// 009901 昨日,这名“伤者”与医生全部被警方依法刑事拘留。
{261, 231, 175, 116, 179, 262, 44, 154, 126, 177, 19, 262, 42, 241, 72, 177, 56, 174, 245, 37, 186, 37, 49, 151, 127, 69, 19, 179, 72, 69, 4, 260, 126, 177, 116, 151, 239, 153, 141},
// 009902 钱伟长想到上海来办学校是经过深思熟虑的。
@ -54,7 +54,7 @@ int main(int argc, char *argv[]) {
std::cerr << "predictor init failed" << std::endl;
return -1;
}
if (!predictor.RunModel(sentencesToChoose[sentencesIndex])) {
std::cerr << "predictor run model failed" << std::endl;
return -1;

Loading…
Cancel
Save