diff options
author | Sangjung Woo <sangjung.woo@samsung.com> | 2018-08-30 17:17:23 +0900 |
---|---|---|
committer | Sangjung Woo <sangjung.woo@samsung.com> | 2018-09-03 10:35:13 +0900 |
commit | f7d27bc67e5d89e5f4bb6d6a0a198c28fa8af46f (patch) | |
tree | 50021cebb64106a84cd24c4970a239ce274fad58 /tensorflow/cc | |
parent | b7c2e7872c737dd87e48469fc977237819cb8809 (diff) |
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 <sangjung.woo@samsung.com>
Diffstat (limited to 'tensorflow/cc')
-rw-r--r-- | tensorflow/cc/framework/ops.h | 2 |
1 files changed, 1 insertions, 1 deletions
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<T>& v, const TensorShape& shape) { typedef typename RealType<T>::type RealT; Tensor t(DataTypeToEnum<RealT>::v(), shape); - if (t.NumElements() != v.size()) { + if (t.NumElements() != static_cast<int64>(v.size())) { status = errors::InvalidArgument( "Cannot construct a tensor with ", t.NumElements(), " from an initializer list with ", v.size(), " elements"); |