11/*
2- * Copyright (c) 2018-2021, 2023 Arm Limited.
2+ * Copyright (c) 2018-2021, 2023, 2026 Arm Limited.
33 *
44 * SPDX-License-Identifier: MIT
55 *
3030#include " arm_compute/core/utils/StringUtils.h"
3131
3232#include " src/core/CL/CLValidate.h"
33+ #include " src/core/CPP/Validate.h"
3334#include " src/core/helpers/AutoConfiguration.h"
3435#include " src/core/helpers/WindowHelpers.h"
3536#include " support/StringSupport.h"
@@ -42,16 +43,22 @@ namespace
4243Status validate_arguments (const ITensorInfo *input, const ITensorInfo *block_info, const ITensorInfo *output)
4344{
4445 ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR (input, block_info, output);
45- ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN (block_info, 1 , DataType::S32);
46+ ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED (input, block_info);
47+ ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN (block_info, ITensorInfo::one_channel, DataType::S32);
4648 ARM_COMPUTE_RETURN_ERROR_ON (input->num_dimensions () > 4 );
4749 ARM_COMPUTE_RETURN_ERROR_ON (input->data_type () == DataType::UNKNOWN);
4850
4951 // Validate output if initialized
5052 if (output->total_size () != 0 )
5153 {
54+ ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED (output);
5255 ARM_COMPUTE_RETURN_ERROR_ON (output->num_dimensions () > 4 );
5356 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES (input, output);
5457 }
58+ else
59+ {
60+ // Ignored; dynamic block is deprecated.
61+ }
5562
5663 return Status{};
5764}
@@ -62,6 +69,8 @@ Status validate_arguments_static(const ITensorInfo *input,
6269 const CropInfo &crop_info)
6370{
6471 ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR (input, output);
72+ ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED (input);
73+ ARM_COMPUTE_RETURN_ERROR_ON (input->num_channels () != ITensorInfo::one_channel);
6574 ARM_COMPUTE_RETURN_ERROR_ON (input->num_dimensions () > 4 );
6675 ARM_COMPUTE_RETURN_ERROR_ON (block_shape_x <= 0 );
6776 ARM_COMPUTE_RETURN_ERROR_ON (block_shape_y <= 0 );
@@ -70,16 +79,23 @@ Status validate_arguments_static(const ITensorInfo *input,
7079 const int idx_batch = get_data_layout_dimension_index (data_layout, DataLayoutDimension::BATCHES);
7180 ARM_COMPUTE_RETURN_ERROR_ON (input->tensor_shape ()[idx_batch] % (block_shape_x * block_shape_y) != 0 );
7281
82+ const TensorShape expected_output_shape = compute_batch_to_space_shape (input->data_layout (), input->tensor_shape (),
83+ block_shape_x, block_shape_y, crop_info);
84+
7385 // Validate output if initialized
7486 if (output->total_size () != 0 )
7587 {
76- const TensorShape expected_output_shape = compute_batch_to_space_shape (
77- input->data_layout (), input->tensor_shape (), block_shape_x, block_shape_y, crop_info);
88+ ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED (output);
7889 const TensorInfo expected_output = output->clone ()->set_tensor_shape (expected_output_shape);
7990 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES (output, &expected_output);
8091 ARM_COMPUTE_RETURN_ERROR_ON (output->num_dimensions () > 4 );
8192 ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES (input, output);
8293 }
94+ else
95+ {
96+ const auto output_info = TensorInfo (expected_output_shape, ITensorInfo::one_channel, input->data_type ());
97+ ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED (&output_info);
98+ }
8399
84100 return Status{};
85101}
0 commit comments