This is an automated email from the ASF dual-hosted git repository. jxie pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push: new b3ad753 display type string instead of type code in error message (#7730) b3ad753 is described below commit b3ad75311fb7012c17cde3c56425af580db6934a Author: Sheng Zha <s...@users.noreply.github.com> AuthorDate: Tue Sep 5 10:09:30 2017 -0700 display type string instead of type code in error message (#7730) --- src/operator/activation-inl.h | 4 +--- src/operator/batch_norm-inl.h | 8 ++------ src/operator/batch_norm_v1-inl.h | 8 ++------ src/operator/contrib/count_sketch-inl.h | 4 +--- src/operator/contrib/deformable_convolution-inl.h | 4 +--- src/operator/contrib/fft-inl.h | 4 +--- src/operator/contrib/ifft-inl.h | 4 +--- src/operator/convolution-inl.h | 4 +--- src/operator/convolution_v1-inl.h | 4 +--- src/operator/deconvolution-inl.h | 4 +--- src/operator/lrn-inl.h | 4 +--- src/operator/operator_common.h | 13 +++++++++++++ src/operator/rnn-inl.h | 4 +--- src/operator/sequence_last-inl.h | 5 +---- src/operator/sequence_mask-inl.h | 5 +---- src/operator/sequence_reverse-inl.h | 5 +---- src/operator/softmax_output-inl.h | 4 +--- src/operator/svm_output-inl.h | 4 +--- src/operator/upsampling-inl.h | 4 +--- 19 files changed, 33 insertions(+), 63 deletions(-) diff --git a/src/operator/activation-inl.h b/src/operator/activation-inl.h index 6e6222b..8b1a229 100644 --- a/src/operator/activation-inl.h +++ b/src/operator/activation-inl.h @@ -137,9 +137,7 @@ class ActivationProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/batch_norm-inl.h b/src/operator/batch_norm-inl.h index b53acb4..461f702 100644 --- a/src/operator/batch_norm-inl.h +++ b/src/operator/batch_norm-inl.h @@ -274,16 +274,12 @@ class BatchNormProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype_param; } else { - CHECK_EQ((*in_type)[i], dtype_param) << "This layer requires uniform type. " - << "Expected " << dtype_param << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype_param, ListArguments()[i]); } } for (index_t i = 0; i < aux_type->size(); ++i) { if ((*aux_type)[i] != -1) { - CHECK_EQ((*aux_type)[i], dtype_param) << "This layer requires uniform type. " - << "Expected " << dtype_param << " v.s. given " - << (*aux_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*aux_type)[i], dtype_param, ListArguments()[i]); } } const size_t n_aux = this->ListAuxiliaryStates().size(); diff --git a/src/operator/batch_norm_v1-inl.h b/src/operator/batch_norm_v1-inl.h index 092c482..ebfc469 100644 --- a/src/operator/batch_norm_v1-inl.h +++ b/src/operator/batch_norm_v1-inl.h @@ -289,16 +289,12 @@ class BatchNormV1Prop : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype_param; } else { - CHECK_EQ((*in_type)[i], dtype_param) << "This layer requires uniform type. " - << "Expected " << dtype_param << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype_param, ListArguments()[i]); } } for (index_t i = 0; i < aux_type->size(); ++i) { if ((*aux_type)[i] != -1) { - CHECK_EQ((*aux_type)[i], dtype_param) << "This layer requires uniform type. " - << "Expected " << dtype_param << " v.s. given " - << (*aux_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*aux_type)[i], dtype_param, ListArguments()[i]); } } int n_aux = this->ListAuxiliaryStates().size(); diff --git a/src/operator/contrib/count_sketch-inl.h b/src/operator/contrib/count_sketch-inl.h index 5df0096..b736117 100644 --- a/src/operator/contrib/count_sketch-inl.h +++ b/src/operator/contrib/count_sketch-inl.h @@ -188,9 +188,7 @@ class CountSketchProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/contrib/deformable_convolution-inl.h b/src/operator/contrib/deformable_convolution-inl.h index 18c1fa3..cc9a93a 100644 --- a/src/operator/contrib/deformable_convolution-inl.h +++ b/src/operator/contrib/deformable_convolution-inl.h @@ -457,9 +457,7 @@ class DeformableConvolutionProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/contrib/fft-inl.h b/src/operator/contrib/fft-inl.h index afb22d1..129aaa3 100644 --- a/src/operator/contrib/fft-inl.h +++ b/src/operator/contrib/fft-inl.h @@ -261,9 +261,7 @@ class FFTProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/contrib/ifft-inl.h b/src/operator/contrib/ifft-inl.h index 99d2ed7..1b0e5e5 100644 --- a/src/operator/contrib/ifft-inl.h +++ b/src/operator/contrib/ifft-inl.h @@ -253,9 +253,7 @@ class IFFTProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/convolution-inl.h b/src/operator/convolution-inl.h index 6195449..5843293 100644 --- a/src/operator/convolution-inl.h +++ b/src/operator/convolution-inl.h @@ -626,9 +626,7 @@ class ConvolutionProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/convolution_v1-inl.h b/src/operator/convolution_v1-inl.h index 0ac940c..6b31b15 100644 --- a/src/operator/convolution_v1-inl.h +++ b/src/operator/convolution_v1-inl.h @@ -504,9 +504,7 @@ class ConvolutionV1Prop : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/deconvolution-inl.h b/src/operator/deconvolution-inl.h index a968ce4..41fcf9b 100644 --- a/src/operator/deconvolution-inl.h +++ b/src/operator/deconvolution-inl.h @@ -700,9 +700,7 @@ class DeconvolutionProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/lrn-inl.h b/src/operator/lrn-inl.h index a320a26..0087943 100644 --- a/src/operator/lrn-inl.h +++ b/src/operator/lrn-inl.h @@ -152,9 +152,7 @@ class LocalResponseNormProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } int n_out = this->ListOutputs().size(); diff --git a/src/operator/operator_common.h b/src/operator/operator_common.h index dc53e1a..375ecf9 100644 --- a/src/operator/operator_common.h +++ b/src/operator/operator_common.h @@ -218,6 +218,19 @@ inline bool type_assign(int *y, const int& x) { } /*! + * \brief macro check if type is the same as expected. + * \param type the type to be checked + * \param expected the expected type + */ +#define UNIFORM_TYPE_CHECK(type, expected, arg) \ + { \ + CHECK_EQ(type, expected) << "This layer requires uniform type. " \ + << "Expected '" << type_string(expected) \ + << "' v.s. given '" << type_string(type) \ + << "' at '" << arg << "'"; \ + } + +/*! * \brief macro assign type to out if out is unknown (-1) otherwise check consistency * Use macro so we can see the error file more clearly * \param type_array the storage type array to store the result diff --git a/src/operator/rnn-inl.h b/src/operator/rnn-inl.h index 4f09ebe..28c8d61 100644 --- a/src/operator/rnn-inl.h +++ b/src/operator/rnn-inl.h @@ -256,9 +256,7 @@ class RNNProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/sequence_last-inl.h b/src/operator/sequence_last-inl.h index 0551ee9..65d1439 100644 --- a/src/operator/sequence_last-inl.h +++ b/src/operator/sequence_last-inl.h @@ -210,10 +210,7 @@ class SequenceLastProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " - << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/sequence_mask-inl.h b/src/operator/sequence_mask-inl.h index dec1f2a..aacf4a6 100644 --- a/src/operator/sequence_mask-inl.h +++ b/src/operator/sequence_mask-inl.h @@ -191,10 +191,7 @@ class SequenceMaskProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " - << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/sequence_reverse-inl.h b/src/operator/sequence_reverse-inl.h index 0a43138..28daa83 100644 --- a/src/operator/sequence_reverse-inl.h +++ b/src/operator/sequence_reverse-inl.h @@ -243,10 +243,7 @@ class SequenceReverseProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " - << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/softmax_output-inl.h b/src/operator/softmax_output-inl.h index d14193b..5f8203e 100644 --- a/src/operator/softmax_output-inl.h +++ b/src/operator/softmax_output-inl.h @@ -319,9 +319,7 @@ class SoftmaxOutputProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/svm_output-inl.h b/src/operator/svm_output-inl.h index f025461..085d2b9 100644 --- a/src/operator/svm_output-inl.h +++ b/src/operator/svm_output-inl.h @@ -162,9 +162,7 @@ class SVMOutputProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); diff --git a/src/operator/upsampling-inl.h b/src/operator/upsampling-inl.h index fec0f74..77ea13b 100644 --- a/src/operator/upsampling-inl.h +++ b/src/operator/upsampling-inl.h @@ -260,9 +260,7 @@ class UpSamplingProp : public OperatorProperty { if ((*in_type)[i] == -1) { (*in_type)[i] = dtype; } else { - CHECK_EQ((*in_type)[i], dtype) << "This layer requires uniform type. " - << "Expected " << dtype << " v.s. given " - << (*in_type)[i] << " at " << ListArguments()[i]; + UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]); } } out_type->clear(); -- To stop receiving notification emails like this one, please contact ['"comm...@mxnet.apache.org" <comm...@mxnet.apache.org>'].