tensorflow: transpose expects a vector of size 1. But input(1) is a vector of size 2

回眸只為那壹抹淺笑 提交于 2019-12-06 17:56:24

I had a similar issue on the input tensor to my predictor. I expanded the dimension by one and the issue was resolved. I suggest running the predictor in python, first. This helps to identify the size of the input tensor that you are passing to the predictor. Then, replicate the exact same size in C++. Also, based on your code snippet, I am not sure how you define the inputs to the Run method. I defined is as follows in my code:

std::vector<std::pair<std::string, tensorflow::Tensor>> input = { {"input_1", input_tensor } };

where "input_1" is the name of my input layer. I hope this helps.

I get this error when pass wrong input type into tensorflow model. The model require 3d dimension array, I pass 1d dimension instead of so check your input data first.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!