From 0b1937a8f45d2f4c617437b53914165b97367a0f Mon Sep 17 00:00:00 2001 From: Wen-Ding Li Date: Sat, 10 Mar 2018 20:57:15 +0800 Subject: [PATCH 1/2] Minor Fix to make the code compile with newer version of tensorflow OP_REQUIRES macro has changed since tensorflow version 1.5 The expression requires a semicolon postfix --- sbnet_tensorflow/sbnet_ops/sparse_gather.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbnet_tensorflow/sbnet_ops/sparse_gather.cc b/sbnet_tensorflow/sbnet_ops/sparse_gather.cc index 3ca68db..83ee7a1 100644 --- a/sbnet_tensorflow/sbnet_ops/sparse_gather.cc +++ b/sbnet_tensorflow/sbnet_ops/sparse_gather.cc @@ -155,7 +155,7 @@ template class SparseGatherOp : public OpKernel { OP_REQUIRES_OK(context, context->GetAttr("boffset", &boffset)); OP_REQUIRES(context, bsize.size() == 2 && bstride.size() == 2 && boffset.size() == 2, - errors::InvalidArgument("All block attributes must have a shape of (2,).")) + errors::InvalidArgument("All block attributes must have a shape of (2,).")); OP_REQUIRES_OK(context, context->GetAttr("transpose", &transpose_)); bSzH_ = bsize[0]; bSzW_ = bsize[1]; @@ -278,7 +278,7 @@ template class SparseScatterOp : publ OP_REQUIRES_OK(context, context->GetAttr("boffset", &boffset)); OP_REQUIRES(context, bsize.size() == 2 && bstride.size() == 2 && boffset.size() == 2, - errors::InvalidArgument("All block attributes must have a shape of (2,).")) + errors::InvalidArgument("All block attributes must have a shape of (2,).")); bSzH_ = bsize[0]; bSzW_ = bsize[1]; bStrH_ = bstride[0]; bStrW_ = bstride[1]; bOffsH0_ = boffset[0]; bOffsW0_ = boffset[1]; From 5787c6cfca70fa1412738c0d395c51e0c767bb05 Mon Sep 17 00:00:00 2001 From: Wen-Ding Li Date: Sat, 10 Mar 2018 21:26:03 +0800 Subject: [PATCH 2/2] Python 3 compatibility fixes The member `message` of `AssertionError` object was deprecated in Python 3 --- sbnet_tensorflow/benchmark/tf_conv_dims_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbnet_tensorflow/benchmark/tf_conv_dims_tests.py b/sbnet_tensorflow/benchmark/tf_conv_dims_tests.py index 1ce5a6a..405cdc9 100644 --- a/sbnet_tensorflow/benchmark/tf_conv_dims_tests.py +++ b/sbnet_tensorflow/benchmark/tf_conv_dims_tests.py @@ -87,7 +87,7 @@ def test_calc_padding_err_ksize_list(self): try: calc_padding_4d(tf.shape(x), [2, 3, 1, 1, 1], [2, 1, 1, 1], 'SAME') except AssertionError as e: - self.assertEqual(e.message, 'Expect `ksize` a list/tuple of length 4.') + self.assertEqual(e.args[0], 'Expect `ksize` a list/tuple of length 4.') err_raised = True self.assertTrue(err_raised) @@ -98,7 +98,7 @@ def test_calc_padding_err_strides_list(self): try: calc_padding_4d(tf.shape(x), [2, 3, 1, 1], [2, 1, 1, 1], 'SAME') except AssertionError as e: - self.assertEqual(e.message, 'Expect first and last dimension of `strides` = 1.') + self.assertEqual(e.args[0], 'Expect first and last dimension of `strides` = 1.') err_raised = True self.assertTrue(err_raised)