aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CL/functions/CLStackLayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/CL/functions/CLStackLayer.cpp')
-rw-r--r--src/runtime/CL/functions/CLStackLayer.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/runtime/CL/functions/CLStackLayer.cpp b/src/runtime/CL/functions/CLStackLayer.cpp
index 85adcad90c..71327fead4 100644
--- a/src/runtime/CL/functions/CLStackLayer.cpp
+++ b/src/runtime/CL/functions/CLStackLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -61,15 +61,19 @@ void CLStackLayer::configure(const std::vector<ICLTensor *> &input, int axis, IC
Status CLStackLayer::validate(const std::vector<ITensorInfo *> &input, int axis, const ITensorInfo *output)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(output);
- ARM_COMPUTE_RETURN_ERROR_ON(input.size() < 2);
+ ARM_COMPUTE_RETURN_ERROR_ON(input.empty());
// Wrap around negative values
- const unsigned int axis_u = wrap_around(axis, static_cast<int>(input[0]->num_dimensions() + 1));
+ const size_t rank = input[0]->num_dimensions();
+ const unsigned int axis_u = wrap_around(axis, static_cast<int>(rank + 1));
const unsigned int num_inputs = input.size();
for(unsigned int i = 0; i < num_inputs; i++)
{
+ // All the tensors must have the same rank
+ ARM_COMPUTE_RETURN_ERROR_ON(input[i]->num_dimensions() != rank);
+ // Validate Kernel
ARM_COMPUTE_RETURN_ON_ERROR(CLStackLayerKernel::validate(input[i], axis_u, i, num_inputs, output));
}