I am loading the.pb file in tensorflow c++. Now I need to fill the input tensor with my data and get the output tensors.
To fill data, I am using below code:
tensorflow::Tensor points_tensor{tensorflow::DataType::DT_FLOAT, tensorflow::TensorShape({number_of_points,4})};
auto pointsMapped = points_tensor.tensor<float, 2>();
for(int i=0; i<number_of_points; i++){
//to the shifting here only
pointsMapped(i,0) = point_cloud.points[i].x;
pointsMapped(i,1) = point_cloud.points[i].y;
pointsMapped(i,2) = point_cloud.points[i].z;
pointsMapped(i,3) = point_cloud.points[i].intensity;
}
point_cloud is a vector of point object.
But I do not think so, it is better way to do it in c++. Because I need to access my tensor shape so.
Can someone help me with this?
Actually The above mentioned method is the better way to fill the tensor in tensorflow
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.