Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/core/CL/kernels/CLArgMinMaxLayerKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, 2023 Arm Limited.
* Copyright (c) 2019-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -30,9 +30,9 @@
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/core/Utils.h"
#include "arm_compute/core/utils/helpers/AdjustVecSize.h"
#include "arm_compute/core/Validate.h"

#include "src/core/CL/CLValidate.h"
#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -44,10 +44,12 @@ namespace
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, unsigned int axis, ReductionOperation op)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(input);
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED,
DataType::S32, DataType::F16, DataType::F32);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::S32, DataType::S64);
const size_t one_channel = 1u;
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(
input, one_channel, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::S32, DataType::F16, DataType::F32);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, one_channel, DataType::S32, DataType::S64);

ARM_COMPUTE_RETURN_ERROR_ON_MSG(op != ReductionOperation::ARG_IDX_MAX && op != ReductionOperation::ARG_IDX_MIN,
"Only ARG_IDX_MAX and ARG_IDX_MIN are supported");
Expand All @@ -57,8 +59,13 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, u

if (output->total_size() != 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U32, DataType::S32, DataType::S64,
DataType::U64);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output);
}
else
{
// Assume largest possible data type since we don't know.
const auto output_info = TensorInfo(input->tensor_shape(), one_channel, DataType::S64);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&output_info);
}

return Status{};
Expand Down
16 changes: 14 additions & 2 deletions src/core/CL/kernels/CLBatchNormalizationLayerKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2021, 2023 Arm Limited.
* Copyright (c) 2017-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "arm_compute/core/utils/StringUtils.h"

#include "src/core/CL/CLValidate.h"
#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -52,19 +53,24 @@ Status validate_arguments(const ITensorInfo *input,
ActivationLayerInfo act_info)
{
ARM_COMPUTE_UNUSED(epsilon);
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, mean, var);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(input, mean, var);
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16, DataType::F32);
const size_t one_channel = 1u;
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, one_channel, DataType::F16, DataType::F32);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(mean, var);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, mean, var);
ARM_COMPUTE_RETURN_ERROR_ON(input->dimension(get_data_layout_dimension_index(
input->data_layout(), DataLayoutDimension::CHANNEL)) != mean->dimension(0));
if (beta != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(beta);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(mean, beta);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, beta);
}
if (gamma != nullptr)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(gamma);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(mean, gamma);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, gamma);
}
Expand All @@ -82,10 +88,16 @@ Status validate_arguments(const ITensorInfo *input,

if (output != nullptr && output->total_size() != 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
}
else
{
// No configured output. Since `output` is expected to match `input`,
// there's nothing extra to check in this case.
}

return Status{};
}
Expand Down
26 changes: 22 additions & 4 deletions src/core/CL/kernels/CLBatchToSpaceLayerKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, 2023 Arm Limited.
* Copyright (c) 2018-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -30,6 +30,7 @@
#include "arm_compute/core/utils/StringUtils.h"

#include "src/core/CL/CLValidate.h"
#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -42,16 +43,23 @@ namespace
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *block_info, const ITensorInfo *output)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, block_info, output);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(block_info, 1, DataType::S32);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(input, block_info);
const size_t one_channel = 1u;
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(block_info, one_channel, DataType::S32);
ARM_COMPUTE_RETURN_ERROR_ON(input->num_dimensions() > 4);
ARM_COMPUTE_RETURN_ERROR_ON(input->data_type() == DataType::UNKNOWN);

// Validate output if initialized
if (output->total_size() != 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output);
ARM_COMPUTE_RETURN_ERROR_ON(output->num_dimensions() > 4);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
}
else
{
// Ignored; dynamic block is deprecated.
}

return Status{};
}
Expand All @@ -62,6 +70,9 @@ Status validate_arguments_static(const ITensorInfo *input,
const CropInfo &crop_info)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(input);
const size_t one_channel = 1u;
ARM_COMPUTE_RETURN_ERROR_ON(input->num_channels() != one_channel);
ARM_COMPUTE_RETURN_ERROR_ON(input->num_dimensions() > 4);
ARM_COMPUTE_RETURN_ERROR_ON(block_shape_x <= 0);
ARM_COMPUTE_RETURN_ERROR_ON(block_shape_y <= 0);
Expand All @@ -70,16 +81,23 @@ Status validate_arguments_static(const ITensorInfo *input,
const int idx_batch = get_data_layout_dimension_index(data_layout, DataLayoutDimension::BATCHES);
ARM_COMPUTE_RETURN_ERROR_ON(input->tensor_shape()[idx_batch] % (block_shape_x * block_shape_y) != 0);

const TensorShape expected_output_shape = compute_batch_to_space_shape(input->data_layout(), input->tensor_shape(),
block_shape_x, block_shape_y, crop_info);

// Validate output if initialized
if (output->total_size() != 0)
{
const TensorShape expected_output_shape = compute_batch_to_space_shape(
input->data_layout(), input->tensor_shape(), block_shape_x, block_shape_y, crop_info);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output);
const TensorInfo expected_output = output->clone()->set_tensor_shape(expected_output_shape);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(output, &expected_output);
ARM_COMPUTE_RETURN_ERROR_ON(output->num_dimensions() > 4);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
}
else
{
const auto output_info = TensorInfo(expected_output_shape, one_channel, input->data_type());
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&output_info);
}

return Status{};
}
Expand Down
17 changes: 12 additions & 5 deletions src/core/CL/kernels/CLBitwiseKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021, 2023 Arm Limited.
* Copyright (c) 2020-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -31,6 +31,7 @@
#include "arm_compute/core/utils/helpers/AdjustVecSize.h"
#include "arm_compute/core/Validate.h"

#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -49,17 +50,23 @@ void CLBitwiseKernel::configure(const CLCompileContext &compile_context,
BitwiseOperation op)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input1);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input1, 1, DataType::U8);
ARM_COMPUTE_ERROR_ON_SIZE_UNSUPPORTED(input1->info());
#ifdef ARM_COMPUTE_ASSERTS_ENABLED
const size_t one_channel = 1u;
#endif
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input1, one_channel, DataType::U8);
if (op != BitwiseOperation::NOT)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input2);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input2, 1, DataType::U8);
ARM_COMPUTE_ERROR_ON_SIZE_UNSUPPORTED(input2->info());
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input2, one_channel, DataType::U8);
}
ARM_COMPUTE_ERROR_ON_NULLPTR(output);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, 1, DataType::U8);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output, one_channel, DataType::U8);

// Output auto inizialitation if not yet initialized
// Output auto initialization if not yet initialized
auto_init_if_empty(*(output->info()), *(input1->info()));
ARM_COMPUTE_ERROR_ON_SIZE_UNSUPPORTED(output->info());
auto padding_info = get_padding_info({input1, input2, output});

// Configure kernel window
Expand Down
19 changes: 15 additions & 4 deletions src/core/CL/kernels/CLBoundingBoxTransformKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, 2023 Arm Limited.
* Copyright (c) 2018-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -33,6 +33,7 @@
#include "arm_compute/core/utils/StringUtils.h"

#include "src/core/CL/CLValidate.h"
#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -47,9 +48,13 @@ Status validate_arguments(const ITensorInfo *boxes,
const BoundingBoxTransformInfo &info)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(boxes, pred_boxes, deltas);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(boxes, deltas);
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(boxes);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(boxes, DataType::QASYMM16, DataType::F32, DataType::F16);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(deltas, DataType::QASYMM8, DataType::F32, DataType::F16);
const size_t one_channel = 1u;
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(boxes, one_channel, DataType::QASYMM16, DataType::F32,
DataType::F16);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(deltas, one_channel, DataType::QASYMM8, DataType::F32,
DataType::F16);
ARM_COMPUTE_RETURN_ERROR_ON(deltas->tensor_shape()[1] != boxes->tensor_shape()[1]);
ARM_COMPUTE_RETURN_ERROR_ON(deltas->tensor_shape()[0] % 4 != 0);
ARM_COMPUTE_RETURN_ERROR_ON(boxes->tensor_shape()[0] != 4);
Expand All @@ -62,7 +67,7 @@ Status validate_arguments(const ITensorInfo *boxes,
const UniformQuantizationInfo boxes_qinfo = boxes->quantization_info().uniform();
ARM_COMPUTE_RETURN_ERROR_ON(boxes_qinfo.scale != 0.125f);
ARM_COMPUTE_RETURN_ERROR_ON(boxes_qinfo.offset != 0);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(deltas, DataType::QASYMM8);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(deltas, one_channel, DataType::QASYMM8);
}
else
{
Expand All @@ -71,6 +76,7 @@ Status validate_arguments(const ITensorInfo *boxes,

if (pred_boxes->total_size() > 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(pred_boxes);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(pred_boxes->tensor_shape(), deltas->tensor_shape());
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(pred_boxes, boxes);
ARM_COMPUTE_RETURN_ERROR_ON(pred_boxes->num_dimensions() > 2);
Expand All @@ -81,6 +87,11 @@ Status validate_arguments(const ITensorInfo *boxes,
ARM_COMPUTE_RETURN_ERROR_ON(pred_boxes_qinfo.offset != 0);
}
}
else
{
const auto pred_boxes_info = TensorInfo(deltas->tensor_shape(), one_channel, boxes->data_type());
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&pred_boxes_info);
}
ARM_COMPUTE_RETURN_ERROR_ON(info.scale() <= 0);

return Status{};
Expand Down
11 changes: 10 additions & 1 deletion src/core/CL/kernels/CLChannelShuffleLayerKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, 2023 Arm Limited.
* Copyright (c) 2018-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand Down Expand Up @@ -33,6 +33,7 @@
#include "arm_compute/core/utils/StringUtils.h"

#include "src/core/CL/CLValidate.h"
#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -43,6 +44,8 @@ namespace
{
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, unsigned int num_groups)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(input);
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(input);
ARM_COMPUTE_RETURN_ERROR_ON(input->data_type() == DataType::UNKNOWN);
ARM_COMPUTE_RETURN_ERROR_ON_MSG(num_groups < 2, "Channel shuffling with less than 2 groups would be inefficient");
Expand All @@ -61,10 +64,16 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, u
// Checks performed when output is configured
if (output->total_size() != 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(input, output);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output);
}
else
{
// No configured output. Since `output` is expected to match `input`,
// there's nothing extra to check in this case.
}

return Status{};
}
Expand Down
15 changes: 13 additions & 2 deletions src/core/CL/kernels/CLComparisonKernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021, 2023 Arm Limited.
* Copyright (c) 2018-2021, 2023, 2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
Expand All @@ -25,10 +25,12 @@

#include "arm_compute/core/CL/CLHelpers.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/TensorInfo.h"
#include "arm_compute/core/utils/helpers/AdjustVecSize.h"
#include "arm_compute/core/utils/StringUtils.h"

#include "src/core/CL/CLValidate.h"
#include "src/core/CPP/Validate.h"
#include "src/core/helpers/AutoConfiguration.h"
#include "src/core/helpers/WindowHelpers.h"
#include "support/StringSupport.h"
Expand All @@ -51,6 +53,7 @@ Status validate_arguments(const ITensorInfo &input1,
const ITensorInfo &output,
ComparisonOperation operation)
{
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&input1, &input2);
ARM_COMPUTE_RETURN_ERROR_ON_F16_UNSUPPORTED(&input1);
ARM_COMPUTE_RETURN_ERROR_ON(input1.data_type() == DataType::UNKNOWN);
ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(&input1, &input2);
Expand All @@ -59,13 +62,21 @@ Status validate_arguments(const ITensorInfo &input1,
const TensorShape out_shape = TensorShape::broadcast_shape(input1.tensor_shape(), input2.tensor_shape());
ARM_COMPUTE_RETURN_ERROR_ON_MSG(out_shape.total_size() == 0, "Inputs are not broadcast compatible");

const size_t one_channel = 1u;

// Validate in case of configured output
if (output.total_size() > 0)
{
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&output, 1, DataType::U8);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&output);
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&output, one_channel, DataType::U8);
ARM_COMPUTE_RETURN_ERROR_ON_MSG(detail::have_different_dimensions(out_shape, output.tensor_shape(), 0),
"Wrong shape for output");
}
else
{
const auto output_info = TensorInfo(out_shape, one_channel, DataType::U8);
ARM_COMPUTE_RETURN_ERROR_ON_SIZE_UNSUPPORTED(&output_info);
}

return Status{};
}
Expand Down
Loading