0

In TensorFlow 1.3.1, IsFiniteScalarF32 test is failing with error : "expected:false vs actual:true". at line 100 https://github.com/tensorflow/tensorflow/blob/v1.3.1/tensorflow/compiler/xla/tests/array_elementwise_ops_test.cc#L100, for command bazel test -c opt //tensorflow/compiler/xla/tests:array_elementwise_ops_test_cpu_parallel

Currently I am debugging the failure, and want to check the output of auto result = builder.IsFinite(builder.ConstantR0<float>(NAN));

Tried to display the output using std::cout << "value is ***** \n" << result;, however getting following error :

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)

How can I print the value of result variable?

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

The type of result is a protocol buffer defined here. The error you are seeing is because there is no operator<< defined for protocol buffers. Here is an explanation for such an error: std::vector : cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&'

To print the value of the protocol buffer you can use cout << result.DebugString().

Having said this, the value will be some random number - probably not very useful - because it is simply a handle to a value to be computed in XLA computation graph.

iga
  • 3,571
  • 1
  • 12
  • 22