From f7d27bc67e5d89e5f4bb6d6a0a198c28fa8af46f Mon Sep 17 00:00:00 2001 From: Sangjung Woo Date: Thu, 30 Aug 2018 17:17:23 +0900 Subject: fix the comparison error when building a CPP API application When building a CPP API application with "-Wall -Werror" option , `error: comparison between signed and unsigned integer expressions' occurs since return type of num_elements() is 'int64' instead of 'size_t' in ops.h to express -1. This patch fixes this bug by explicit type casting. * related issue: https://github.com/tensorflow/tensorflow/issues/20428 Signed-off-by: Sangjung Woo --- tensorflow/cc/framework/ops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tensorflow/cc') diff --git a/tensorflow/cc/framework/ops.h b/tensorflow/cc/framework/ops.h index a085e1d6e2..0717e7dd4b 100644 --- a/tensorflow/cc/framework/ops.h +++ b/tensorflow/cc/framework/ops.h @@ -150,7 +150,7 @@ class Input { Initializer(const std::initializer_list& v, const TensorShape& shape) { typedef typename RealType::type RealT; Tensor t(DataTypeToEnum::v(), shape); - if (t.NumElements() != v.size()) { + if (t.NumElements() != static_cast(v.size())) { status = errors::InvalidArgument( "Cannot construct a tensor with ", t.NumElements(), " from an initializer list with ", v.size(), " elements"); -- cgit v1.2.3