[英]Tensorflow Session.Run gives empty Output tensor when run on Android device but works fine when run on Ubuntu
I have a pre trained Tensorflow protobuf that I load from C++ API and build using Bazel. 我有一个经过预训练的Tensorflow原型,可以从C ++ API加载并使用Bazel进行构建。 I get expected output tensors when I run the generated executable on Ubuntu. 在Ubuntu上运行生成的可执行文件时,得到了预期的输出张量。 But when I compile the exact same code for Android using Bazel, I get empty output tensors. 但是,当我使用Bazel编译与Android完全相同的代码时,我得到的输出张量为空。
Code I use to get the output (same code used in both Ubuntu and Android): 我用来获取输出的代码(在Ubuntu和Android中使用的相同代码):
auto statusPred = session->Run(run_options, input, vNames, {}, &answer, &run_metadata);printLog(answer.size());
The answer has size 0 on Android, but has the right expected size when I run the executable, also built using Bazel on UBuntu machine. 答案在Android上的大小为0,但在运行可执行文件时也具有正确的预期大小,该可执行文件也是使用UBuntu计算机上的Bazel构建的。
Am I missing something fundamental here? 我在这里缺少基本的东西吗? Is there a difference between the way computation is done on Ubuntu and Android because of which the output tensor is empty? 由于输出张量为空,因此在Ubuntu和Android上进行计算的方式之间是否有区别?
Fixed it by adding "cwise_op_floor.cc", to file tensorflow/core/kernels/BUILD, under filegroup android_extended_ops_group1. 通过在文件组android_extended_ops_group1下的文件tensorflow / core / kernels / BUILD中添加“ cwise_op_floor.cc”来修复该问题。 I see that the latest version has this Op included under the same filegroup though: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/BUILD#L987 我看到最新版本的Op包含在同一文件组下: https : //github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/BUILD#L987
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.