Update assertions for BatchToSpaceND op in compile time. (#3286)
authorPrasanna R/System SW /SRI-Bangalore/Engineer/삼성전자 <prasanna.r@samsung.com>
Wed, 24 Oct 2018 11:03:02 +0000 (16:33 +0530)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 24 Oct 2018 11:03:02 +0000 (20:03 +0900)
This patch updates the assertions required for BatchToSpaceND at compile time in PACL.

Signed-off-by: prasannar <prasanna.r@samsung.com>
runtimes/pure_arm_compute/src/compilation.cc

index 1957d98..e28d879 100644 (file)
@@ -3925,6 +3925,7 @@ void Planner::visit(const ::internal::tflite::op::BatchToSpaceNd::Node &node)
 
   assert(_ctx.at(input_index).shape().rank() == 4);
   assert(_ctx.at(output_index).shape().rank() == 4);
+  assert(_ctx.at(block_size_index).hasData() == true);
 
   const int32_t *block_size =
       reinterpret_cast<const int32_t *>(_ctx.at(block_size_index).data().base());
@@ -3932,7 +3933,8 @@ void Planner::visit(const ::internal::tflite::op::BatchToSpaceNd::Node &node)
   const auto &output_shape = _ctx.at(output_index).shape();
   const auto &input_shape = _ctx.at(input_index).shape();
 
-  assert(block_size[0] > 0 && block_size[1] > 0);
+  assert((_ctx.at(block_size_index).data().size() / sizeof(int32_t)) == 2 && block_size[0] > 0 &&
+         block_size[1] > 0);
   {
     assert(output_shape.dim(3) == input_shape.dim(3));
     assert(output_shape.dim(1) == input_shape.dim(1) * block_size[0]);