diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-12-06 23:14:18 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-12-06 23:18:04 -0800 |
commit | b9df87ffc4a53566320e2baf17f0daeca25fdde9 (patch) | |
tree | d384f0063178404b88ef4fb322fc9463a8435339 /tensorflow/contrib/nearest_neighbor | |
parent | 10197197fd43af6027c62e57bd3be375075e90e3 (diff) |
Wrap macro bodies in do{}while(0) to prevent capture of else-clauses.
PiperOrigin-RevId: 178202725
Diffstat (limited to 'tensorflow/contrib/nearest_neighbor')
-rw-r--r-- | tensorflow/contrib/nearest_neighbor/kernels/hyperplane_lsh_probes.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tensorflow/contrib/nearest_neighbor/kernels/hyperplane_lsh_probes.cc b/tensorflow/contrib/nearest_neighbor/kernels/hyperplane_lsh_probes.cc index 62ee6630ac..2b412fac9a 100644 --- a/tensorflow/contrib/nearest_neighbor/kernels/hyperplane_lsh_probes.cc +++ b/tensorflow/contrib/nearest_neighbor/kernels/hyperplane_lsh_probes.cc @@ -45,16 +45,16 @@ class HyperplaneLSHProbesOp : public OpKernel { const Tensor& products_tensor = context->input(0); OP_REQUIRES(context, products_tensor.dims() == 2, InvalidArgument("Need a two-dimensional products tensor, got ", - products_tensor.dims(), " dimensions.")) + products_tensor.dims(), " dimensions.")); const Tensor& num_tables_tensor = context->input(1); OP_REQUIRES(context, num_tables_tensor.dims() == 0, InvalidArgument("Need a scalar num_tables tensor, got ", - num_tables_tensor.dims(), " dimensions.")) + num_tables_tensor.dims(), " dimensions.")); int num_tables = num_tables_tensor.scalar<int32>()(); OP_REQUIRES(context, num_tables >= 1, InvalidArgument("num_tables must be at least 1 but got ", - num_tables, ".")) + num_tables, ".")); OP_REQUIRES(context, num_tables <= 1000, InvalidArgument("Need num_tables <= 1000, got ", num_tables, ". This is mostly to protect against incorrect " @@ -66,12 +66,13 @@ class HyperplaneLSHProbesOp : public OpKernel { InvalidArgument("Need a scalar num_hyperplanes_per_table " "tensor, got ", num_hyperplanes_per_table_tensor.dims(), - " dimensions.")) + " dimensions.")); int num_hyperplanes_per_table = num_hyperplanes_per_table_tensor.scalar<int32>()(); OP_REQUIRES(context, num_hyperplanes_per_table >= 1, InvalidArgument("num_hyperplanes_per_table must be at least 1 " - "but got ", num_hyperplanes_per_table, ".")) + "but got ", + num_hyperplanes_per_table, ".")); OP_REQUIRES(context, num_hyperplanes_per_table <= 30, InvalidArgument("Need num_hyperplanes_per_table <= 30, got ", num_hyperplanes_per_table, ". " @@ -81,10 +82,10 @@ class HyperplaneLSHProbesOp : public OpKernel { const Tensor& num_probes_tensor = context->input(3); OP_REQUIRES(context, num_probes_tensor.dims() == 0, InvalidArgument("Need a scalar num_probes tensor, got ", - num_probes_tensor.dims(), " dimensions.")) + num_probes_tensor.dims(), " dimensions.")); int num_probes = num_probes_tensor.scalar<int32>()(); OP_REQUIRES(context, num_probes >= 1, - InvalidArgument("num_probes must be at least 1.")) + InvalidArgument("num_probes must be at least 1.")); int expected_num_hyperplanes = num_tables * num_hyperplanes_per_table; OP_REQUIRES( |