在TensorFlow 1.3.1中,IsFiniteScalarF32测试失败并出现错误:
"expected:false vs actual:true"
。在第100行https://github.com/tensorflow/tensorflow/blob/v1.3.1/tensorflow/compiler/xla/tests/array_elementwise_ops_test.cc#L100,用于命令bazel test -c opt //tensorflow/compiler/xla/tests:array_elementwise_ops_test_cpu_parallel
目前我正在调试失败,并希望检查auto result = builder.IsFinite(builder.ConstantR0<float>(NAN));
尝试使用std::cout << "value is ***** \n" << result;
显示输出,但会出现以下错误:
tensorflow/compiler/xla/tests/array_elementwise_ops_test.cc:67:13: error: cannot bind 'std::basic_ostream<char>' lvalue to 'std::basic_ostream<char>&&'
std::cout << "value is ***** \n" << result;
^
In file included from /usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5/iostream:39:0,
from tensorflow/compiler/xla/tests/array_elementwise_ops_test.cc:21:
/usr/lib/gcc/ppc64le-redhat-linux/4.8.5/../../../../include/c++/4.8.5/ostream:602:5: error: initializing argument 1 of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = xla::ComputationDataHandle]'
operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
如何打印result
变量的值?
答案 0 :(得分:0)
result
的类型是定义的协议缓冲区here。
您看到的错误是因为协议缓冲区没有定义operator<<
。以下是对此类错误的解释:std::vector : cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&'
要打印协议缓冲区的值,您可以使用cout << result.DebugString()
。
话虽如此,该值将是一些随机数 - 可能不是很有用 - 因为它只是在XLA计算图中计算的值的句柄。