add missing nullptr check (#4773)
authormasahi <masahi129@gmail.com>
Fri, 24 Jan 2020 05:01:47 +0000 (14:01 +0900)
committerGitHub <noreply@github.com>
Fri, 24 Jan 2020 05:01:47 +0000 (14:01 +0900)
src/relay/qnn/op/add.cc
src/relay/qnn/op/dequantize.cc
src/relay/qnn/op/mul.cc
src/relay/qnn/op/quantize.cc
src/relay/qnn/op/requantize.cc

index e970e2b44fa9cc5f6660d17f26c24485c1c4ff92..67ca10d8e11036abe4ae541cafe602474c425bb0 100644 (file)
@@ -55,6 +55,7 @@ Expr QnnAddCanonicalize(const Attrs& attrs, const Array<Expr>& new_args,
   // Get the input dtype and shape.
   CHECK_EQ(arg_types.size(), 9);
   auto tensor_type = arg_types[0].as<TensorTypeNode>();
+  CHECK(tensor_type != nullptr);
   auto input_dtype = tensor_type->dtype;
   auto input_shape = tensor_type->shape;
 
index ee6799799011f1f35b96b6744aa149434859c13d..6233246d7bae8769593ca1364b6a52b4774f4ff3 100644 (file)
@@ -39,6 +39,7 @@ bool DequantizeRel(const Array<Type>& types,
                    const TypeReporter& reporter) {
   CHECK_EQ(types.size(), 4);
   const auto* data = types[0].as<TensorTypeNode>();
+  CHECK(data != nullptr);
   const auto input_dtype = data->dtype;
   CHECK(input_dtype == DataType::Int(8) ||
         input_dtype == DataType::UInt(8) ||
index c8ea3fc025ebfa840cc8e23677120e9c4efb9553..89193ed4556dd2d05c6e0acd77c705e63df7947a 100644 (file)
@@ -55,6 +55,7 @@ Expr QnnMulCanonicalize(const Attrs& attrs, const Array<Expr>& new_args,
   // Get the input dtype and shape.
   CHECK_EQ(arg_types.size(), 9);
   auto tensor_type = arg_types[0].as<TensorTypeNode>();
+  CHECK(tensor_type != nullptr);
   auto input_dtype = tensor_type->dtype;
   auto input_shape = tensor_type->shape;
 
index e2472c6c5453eb245c2a411d11f6bb708461067e..66c40a27c437295d26f9a14c23e37279e79cd272 100644 (file)
@@ -41,6 +41,7 @@ bool QuantizeRel(const Array<Type>& types,
                  const TypeReporter& reporter) {
   CHECK_EQ(types.size(), 4);
   const auto* data = types[0].as<TensorTypeNode>();
+  CHECK(data != nullptr);
   const auto input_dtype = data->dtype;
   CHECK(input_dtype == DataType::Float(32))
     << "Input type should be one of float32 but was " <<  input_dtype;
index cf5b31377784def7cc7298f1624f3ede3aed5839..29c8e3e915cfe92f88a329cc738afb0bdf563f3d 100644 (file)
@@ -169,6 +169,7 @@ bool RequantizeRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
                    const TypeReporter& reporter) {
   CHECK_EQ(types.size(), 6);
   const auto* data = types[0].as<TensorTypeNode>();
+  CHECK(data != nullptr);
   const auto in_dtype = data->dtype;
   CHECK(in_dtype == DataType::Int(8) ||
         in_dtype == DataType::UInt(8) ||