24.02
|
Go to the documentation of this file.
24 #ifndef ARM_COMPUTE_VALIDATE_H
25 #define ARM_COMPUTE_VALIDATE_H
53 for (
unsigned int i = upper_dim; i < arm_compute::Dimensions<T>::num_max_dimensions; ++i)
55 if (dim1[i] != dim2[i])
83 : _dim{dim}, _function{
function}, _file{file}, _line{line}
96 "Objects have different dimensions");
102 const char *
const _function;
103 const char *
const _file;
107 template <
typename F>
113 template <
typename F,
typename T,
typename... Ts>
122 template <
typename T>
150 template <
typename... Ts>
153 const std::array<
const void *,
sizeof...(Ts)> pointers_array{{std::forward<Ts>(pointers)...}};
155 std::any_of(pointers_array.begin(), pointers_array.end(), [&](
const void *ptr) { return (ptr == nullptr); });
159 #define ARM_COMPUTE_ERROR_ON_NULLPTR(...) \
160 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_nullptr(__func__, __FILE__, __LINE__, __VA_ARGS__))
161 #define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...) \
162 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(__func__, __FILE__, __LINE__, __VA_ARGS__))
180 const char *
function,
const char *file,
const int line,
const Window &full,
const Window &win);
181 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(f, w) \
182 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_mismatching_windows(__func__, __FILE__, __LINE__, f, w))
183 #define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_WINDOWS(f, w) \
184 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_mismatching_windows(__func__, __FILE__, __LINE__, f, w))
202 const char *
function,
const char *file,
const int line,
const Window &full,
const Window &sub);
203 #define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s) \
204 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_invalid_subwindow(__func__, __FILE__, __LINE__, f, s))
205 #define ARM_COMPUTE_RETURN_ERROR_ON_INVALID_SUBWINDOW(f, s) \
206 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_invalid_subwindow(__func__, __FILE__, __LINE__, f, s))
222 const char *
function,
const char *file,
const int line,
const Window &full,
const Window &window,
const int dim);
223 #define ARM_COMPUTE_ERROR_ON_WINDOW_NOT_COLLAPSABLE_AT_DIMENSION(f, w, d) \
224 ARM_COMPUTE_ERROR_THROW_ON( \
225 ::arm_compute::error_on_window_not_collapsable_at_dimension(__func__, __FILE__, __LINE__, f, w, d))
226 #define ARM_COMPUTE_RETURN_ERROR_ON_WINDOW_NOT_COLLAPSABLE_AT_DIMENSION(f, w, d) \
227 ARM_COMPUTE_RETURN_ON_ERROR( \
228 ::arm_compute::error_on_window_not_collapsable_at_dimension(__func__, __FILE__, __LINE__, f, w, d))
243 const char *
function,
const char *file,
const int line,
const Coordinates &pos,
unsigned int max_dim);
244 #define ARM_COMPUTE_ERROR_ON_COORDINATES_DIMENSIONS_GTE(p, md) \
245 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_coordinates_dimensions_gte(__func__, __FILE__, __LINE__, p, md))
246 #define ARM_COMPUTE_RETURN_ERROR_ON_COORDINATES_DIMENSIONS_GTE(p, md) \
247 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_coordinates_dimensions_gte(__func__, __FILE__, __LINE__, p, md))
262 const char *
function,
const char *file,
const int line,
const Window &win,
unsigned int max_dim);
263 #define ARM_COMPUTE_ERROR_ON_WINDOW_DIMENSIONS_GTE(w, md) \
264 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_window_dimensions_gte(__func__, __FILE__, __LINE__, w, md))
265 #define ARM_COMPUTE_RETURN_ERROR_ON_WINDOW_DIMENSIONS_GTE(w, md) \
266 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_window_dimensions_gte(__func__, __FILE__, __LINE__, w, md))
279 template <
typename T,
typename... Ts>
288 std::forward<Ts>(dims)...));
291 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_DIMENSIONS(...) \
292 ARM_COMPUTE_ERROR_THROW_ON( \
293 ::arm_compute::error_on_mismatching_dimensions(__func__, __FILE__, __LINE__, __VA_ARGS__))
294 #define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(...) \
295 ARM_COMPUTE_RETURN_ON_ERROR( \
296 ::arm_compute::error_on_mismatching_dimensions(__func__, __FILE__, __LINE__, __VA_ARGS__))
345 output.set(0, (output.x() + 1) & ~1
U);
351 output.set(1, (output.y() + 1) & ~1
U);
368 template <
typename... Ts>
370 const char *
function,
const char *file,
int line,
const Format &
format,
const ITensor *tensor1, Ts... tensors)
374 const std::array<
const ITensor *, 1 +
sizeof...(Ts)> tensors_info_array{{tensor1, std::forward<Ts>(tensors)...}};
376 std::any_of(tensors_info_array.cbegin(), tensors_info_array.cend(),
379 const TensorShape correct_shape = adjust_odd_shape(tensor->info()->tensor_shape(), format);
380 return detail::have_different_dimensions(tensor->info()->tensor_shape(), correct_shape, 2);
382 function, file, line,
"Tensor shape has odd dimensions");
386 #define ARM_COMPUTE_ERROR_ON_TENSORS_NOT_EVEN(...) \
387 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_tensors_not_even(__func__, __FILE__, __LINE__, __VA_ARGS__))
388 #define ARM_COMPUTE_RETURN_ERROR_ON_TENSORS_NOT_EVEN(...) \
389 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_tensors_not_even(__func__, __FILE__, __LINE__, __VA_ARGS__))
410 output.set(0, output.x() / 2
U);
416 output.set(1, output.y() / 2
U);
435 template <
typename... Ts>
447 const std::array<
const ITensor *, 1 +
sizeof...(Ts)> tensors_info_array{{tensor1, std::forward<Ts>(tensors)...}};
449 std::any_of(tensors_info_array.cbegin(), tensors_info_array.cend(),
451 { return detail::have_different_dimensions(tensor->info()->tensor_shape(), sub2_shape, 2); }),
452 function, file, line,
"Tensor shape has mismatch dimensions for sub-sampling");
456 #define ARM_COMPUTE_ERROR_ON_TENSORS_NOT_SUBSAMPLED(...) \
457 ARM_COMPUTE_ERROR_THROW_ON( \
458 ::arm_compute::error_on_tensors_not_subsampled(__func__, __FILE__, __LINE__, __VA_ARGS__))
459 #define ARM_COMPUTE_RETURN_ERROR_ON_TENSORS_NOT_SUBSAMPLED(...) \
460 ARM_COMPUTE_RETURN_ON_ERROR( \
461 ::arm_compute::error_on_tensors_not_subsampled(__func__, __FILE__, __LINE__, __VA_ARGS__))
474 template <
typename... Ts>
483 std::forward<Ts>(tensor_infos)...);
496 template <
typename... Ts>
518 template <
typename... Ts>
522 unsigned int upper_dim,
531 const std::array<
const ITensorInfo *, 2 +
sizeof...(Ts)> tensors_info_array{
532 {tensor_info_1, tensor_info_2, tensor_infos...}};
536 return detail::have_different_dimensions(
537 (*tensors_info_array.cbegin())->tensor_shape(),
538 tensor_info->tensor_shape(), upper_dim);
540 function, file, line,
"Tensors have different shapes");
555 template <
typename... Ts>
559 unsigned int upper_dim,
572 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES(...) \
573 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_mismatching_shapes(__func__, __FILE__, __LINE__, __VA_ARGS__))
574 #define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...) \
575 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_mismatching_shapes(__func__, __FILE__, __LINE__, __VA_ARGS__))
587 template <
typename... Ts>
589 const char *
function,
const char *file,
const int line,
const ITensorInfo *
tensor_info, Ts... tensor_infos)
595 const std::array<
const ITensorInfo *,
sizeof...(Ts)> tensors_infos_array{{tensor_infos...}};
598 { return tensor_info_obj->data_layout() != tensor_data_layout; }),
599 function, file, line,
"Tensors have different data layouts");
612 template <
typename... Ts>
614 const char *
function,
const char *file,
const int line,
const ITensor *
tensor, Ts... tensors)
622 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_LAYOUT(...) \
623 ARM_COMPUTE_ERROR_THROW_ON( \
624 ::arm_compute::error_on_mismatching_data_layouts(__func__, __FILE__, __LINE__, __VA_ARGS__))
625 #define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...) \
626 ARM_COMPUTE_RETURN_ON_ERROR( \
627 ::arm_compute::error_on_mismatching_data_layouts(__func__, __FILE__, __LINE__, __VA_ARGS__))
639 template <
typename... Ts>
641 const char *
function,
const char *file,
const int line,
const ITensorInfo *
tensor_info, Ts... tensor_infos)
647 const std::array<
const ITensorInfo *,
sizeof...(Ts)> tensors_infos_array{{tensor_infos...}};
650 { return tensor_info_obj->data_type() != tensor_data_type; }),
651 function, file, line,
"Tensors have different data types");
664 template <
typename... Ts>
666 const char *
function,
const char *file,
const int line,
const ITensor *
tensor, Ts... tensors)
674 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(...) \
675 ARM_COMPUTE_ERROR_THROW_ON( \
676 ::arm_compute::error_on_mismatching_data_types(__func__, __FILE__, __LINE__, __VA_ARGS__))
677 #define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...) \
678 ARM_COMPUTE_RETURN_ON_ERROR( \
679 ::arm_compute::error_on_mismatching_data_types(__func__, __FILE__, __LINE__, __VA_ARGS__))
694 template <
typename... Ts>
710 const std::array<
const ITensorInfo *, 1 +
sizeof...(Ts)> tensor_infos_array{
711 {tensor_info_2, std::forward<Ts>(tensor_infos)...}};
714 { return tensor_info->data_type() != first_data_type; }),
715 function, file, line,
"Tensors have different asymmetric quantized data types");
717 std::any_of(tensor_infos_array.begin(), tensor_infos_array.end(),
719 { return tensor_info->quantization_info() != first_quantization_info; }),
720 function, file, line,
"Tensors have different quantization information");
737 template <
typename... Ts>
750 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...) \
751 ARM_COMPUTE_ERROR_THROW_ON( \
752 ::arm_compute::error_on_mismatching_quantization_info(__func__, __FILE__, __LINE__, __VA_ARGS__))
753 #define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...) \
754 ARM_COMPUTE_RETURN_ON_ERROR( \
755 ::arm_compute::error_on_mismatching_quantization_info(__func__, __FILE__, __LINE__, __VA_ARGS__))
766 template <
typename T,
typename F,
typename... Fs>
768 const char *
function,
const char *file,
const int line,
const T *
object, F &&
format, Fs &&...formats)
772 Format &&object_format =
object->info()->format();
777 const std::array<F,
sizeof...(Fs)> formats_array{{std::forward<Fs>(formats)...}};
781 object_format !=
format &&
782 std::none_of(formats_array.begin(), formats_array.end(), [&](
const F &f) { return f == object_format; }),
783 function, file, line,
"Format %s not supported by this kernel",
string_from_format(object_format).c_str());
786 #define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t, ...) \
787 ::arm_compute::error_on_format_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__)
800 template <
typename T,
typename... Ts>
809 const std::array<T,
sizeof...(Ts)> dts_array{{std::forward<Ts>(dts)...}};
811 tensor_dt !=
dt && std::none_of(dts_array.begin(), dts_array.end(), [&](
const T &d) { return d == tensor_dt; }),
812 function, file, line,
"ITensor data type %s not supported by this kernel",
827 template <
typename T,
typename... Ts>
829 const char *
function,
const char *file,
const int line,
const ITensor *
tensor, T &&
dt, Ts &&...dts)
833 function, file, line,
tensor->
info(), std::forward<T>(
dt), std::forward<Ts>(dts)...));
836 #define ARM_COMPUTE_ERROR_ON_DATA_TYPE_NOT_IN(t, ...) \
837 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_data_type_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__))
838 #define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(t, ...) \
839 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_data_type_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__))
852 template <
typename T,
typename... Ts>
861 const std::array<T,
sizeof...(Ts)> dls_array{{std::forward<Ts>(dls)...}};
863 tensor_dl !=
dl && std::none_of(dls_array.begin(), dls_array.end(), [&](
const T &l) { return l == tensor_dl; }),
864 function, file, line,
"ITensor data layout %s not supported by this kernel",
879 template <
typename T,
typename... Ts>
881 const char *
function,
const char *file,
const int line,
const ITensor *
tensor, T &&
dl, Ts &&...dls)
885 function, file, line,
tensor->
info(), std::forward<T>(
dl), std::forward<Ts>(dls)...));
888 #define ARM_COMPUTE_ERROR_ON_DATA_LAYOUT_NOT_IN(t, ...) \
889 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_data_layout_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__))
890 #define ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(t, ...) \
891 ARM_COMPUTE_RETURN_ON_ERROR( \
892 ::arm_compute::error_on_data_layout_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__))
906 template <
typename T,
typename... Ts>
916 function, file, line,
tensor_info, std::forward<T>(
dt), std::forward<Ts>(dts)...));
919 "Number of channels %zu. Required number of channels %zu", tensor_nc,
935 template <
typename T,
typename... Ts>
946 std::forward<T>(
dt), std::forward<Ts>(dts)...));
949 #define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c, ...) \
950 ARM_COMPUTE_ERROR_THROW_ON( \
951 ::arm_compute::error_on_data_type_channel_not_in(__func__, __FILE__, __LINE__, t, c, __VA_ARGS__))
952 #define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c, ...) \
953 ARM_COMPUTE_RETURN_ON_ERROR( \
954 ::arm_compute::error_on_data_type_channel_not_in(__func__, __FILE__, __LINE__, t, c, __VA_ARGS__))
967 const char *
function,
const char *file,
const int line,
const ITensorInfo *
tensor_info,
bool is_fp16_supported)
971 file, line,
"FP16 not supported by the device");
986 const char *
function,
const char *file,
const int line,
const ITensor *
tensor,
bool is_fp16_supported)
1018 #define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t) \
1019 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_tensor_not_2d(__func__, __FILE__, __LINE__, t))
1020 #define ARM_COMPUTE_RETURN_ERROR_ON_TENSOR_NOT_2D(t) \
1021 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_tensor_not_2d(__func__, __FILE__, __LINE__, t))
1034 template <
typename T,
typename... Ts>
1040 const std::array<T,
sizeof...(Ts)> channels_array{{std::forward<Ts>(channels)...}};
1042 [&](
const T &f) { return f == cn; }),
1043 function, file, line);
1046 #define ARM_COMPUTE_ERROR_ON_CHANNEL_NOT_IN(c, ...) \
1047 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_channel_not_in(__func__, __FILE__, __LINE__, c, __VA_ARGS__))
1048 #define ARM_COMPUTE_RETURN_ERROR_ON_CHANNEL_NOT_IN(c, ...) \
1049 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_channel_not_in(__func__, __FILE__, __LINE__, c, __VA_ARGS__))
1063 #define ARM_COMPUTE_ERROR_ON_CHANNEL_NOT_IN_KNOWN_FORMAT(f, c) \
1064 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_channel_not_in_known_format(__func__, __FILE__, __LINE__, f, c))
1065 #define ARM_COMPUTE_RETURN_ERROR_ON_CHANNEL_NOT_IN_KNOWN_FORMAT(f, c) \
1066 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_channel_not_in_known_format(__func__, __FILE__, __LINE__, f, c))
1079 #define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k) \
1080 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_unconfigured_kernel(__func__, __FILE__, __LINE__, k))
1081 #define ARM_COMPUTE_RETURN_ERROR_ON_UNCONFIGURED_KERNEL(k) \
1082 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_unconfigured_kernel(__func__, __FILE__, __LINE__, k))
1098 const TensorShape &parent_shape,
1099 const Coordinates &coords,
1100 const TensorShape &
shape);
1101 #define ARM_COMPUTE_ERROR_ON_INVALID_SUBTENSOR(p, c, s) \
1102 ARM_COMPUTE_ERROR_THROW_ON(::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, p, c, s))
1103 #define ARM_COMPUTE_RETURN_ERROR_ON_INVALID_SUBTENSOR(p, c, s) \
1104 ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_invalid_subtensor(__func__, __FILE__, __LINE__, p, c, s))
1119 const ValidRegion &parent_valid_region,
1121 #define ARM_COMPUTE_ERROR_ON_INVALID_SUBTENSOR_VALID_REGION(pv, sv) \
1122 ARM_COMPUTE_ERROR_THROW_ON( \
1123 ::arm_compute::error_on_invalid_subtensor_valid_region(__func__, __FILE__, __LINE__, pv, sv))
1124 #define ARM_COMPUTE_RETURN_ERROR_ON_INVALID_SUBTENSOR_VALID_REGION(pv, sv) \
1125 ARM_COMPUTE_RETURN_ON_ERROR( \
1126 ::arm_compute::error_on_invalid_subtensor_valid_region(__func__, __FILE__, __LINE__, pv, sv))
void error_on_format_not_in(const char *function, const char *file, const int line, const T *object, F &&format, Fs &&...formats)
Throw an error if the format of the passed tensor/multi-image does not match any of the formats provi...
arm_compute::Status error_on_mismatching_data_layouts(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, Ts... tensor_infos)
Return an error if the passed tensor infos have different data layouts.
TensorShape calculate_subsampled_shape(const TensorShape &shape, Format format, Channel channel=Channel::UNKNOWN)
Calculate subsampled shape for a given format and channel.
@ UNKNOWN
Unknown image format.
arm_compute::Status error_on_coordinates_dimensions_gte(const char *function, const char *file, const int line, const Coordinates &pos, unsigned int max_dim)
Return an error if the passed coordinates have too many dimensions.
arm_compute::Status error_on_window_dimensions_gte(const char *function, const char *file, const int line, const Window &win, unsigned int max_dim)
Return an error if the passed window has too many dimensions.
Quantization information.
size_t num_channels() const override
The number of channels for each tensor element.
arm_compute::Status error_on_data_layout_not_in(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dl, Ts &&...dls)
Return an error if the data layout of the passed tensor info does not match any of the data layouts p...
DataLayout
[DataLayout enum definition]
arm_compute::Status error_on_unconfigured_kernel(const char *function, const char *file, const int line, const IKernel *kernel)
Return an error if the kernel is not configured.
arm_compute::Status error_on_invalid_subwindow(const char *function, const char *file, const int line, const Window &full, const Window &sub)
Return an error if the passed subwindow is invalid.
arm_compute::Status error_on_unsupported_fp16(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, bool is_fp16_supported)
Return an error if the data type of the passed tensor info is FP16 and FP16 extension is not supporte...
arm_compute::Status error_on_channel_not_in_known_format(const char *function, const char *file, const int line, Format fmt, Channel cn)
Return an error if the channel is not in format.
const std::string & string_from_format(Format format)
Convert a tensor format into a string.
#define ARM_COMPUTE_ERROR_ON_LOC_MSG(cond, func, file, line,...)
arm_compute::Status operator()(const Dimensions< T > &dim)
Compare the given object against the stored one.
DataLayout data_layout() const override
Get the data layout of the tensor.
bool has_format_vertical_subsampling(Format format)
Return true if the given format has vertical subsampling.
compare_dimension(const Dimensions< T > &dim, const char *function, const char *file, int line)
Construct a comparison function.
Interface for CPU tensor.
arm_compute::Status error_on_mismatching_quantization_info(const char *function, const char *file, const int line, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
Return an error if the passed tensor infos have different asymmetric quantized data types or differen...
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Function to compare two Dimensions objects and throw an error on mismatch.
DataType data_type() const override
Data type used for each element of the tensor.
@ UV88
2 channel, 1 U8 per channel
const ValidRegion valid_region
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
arm_compute::Status error_on_mismatching_dimensions(const char *function, const char *file, int line, const Dimensions< T > &dim1, const Dimensions< T > &dim2, Ts &&...dims)
Return an error if the passed dimension objects differ.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
arm_compute::Status error_on_mismatching_windows(const char *function, const char *file, const int line, const Window &full, const Window &win)
Return an error if the passed window is invalid.
arm_compute::Status error_on_mismatching_shapes(const char *function, const char *file, const int line, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
Return an error if the passed two tensor infos have different shapes from the given dimension.
arm_compute::Status for_each_error(F &&)
arm_compute::Status error_on_tensor_not_2d(const char *function, const char *file, const int line, const ITensor *tensor)
Return an error if the tensor is not 2D.
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
virtual DataType data_type() const =0
Data type used for each element of the tensor.
arm_compute::Status error_on_tensors_not_even(const char *function, const char *file, int line, const Format &format, const ITensor *tensor1, Ts... tensors)
Return an error if the passed tensor objects are not even.
@ IYUV
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
#define ARM_COMPUTE_ERROR_ON_LOC(cond, func, file, line)
If the condition is true then an error message is printed and an exception thrown.
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
CLTensor * tensor
Pointer to the auxiliary tensor.
arm_compute::Status error_on_data_type_not_in(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dt, Ts &&...dts)
Return an error if the data type of the passed tensor info does not match any of the data types provi...
Format
Image colour formats.
Channel
Available channels.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
@ YUYV422
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.
arm_compute::Status error_on_tensors_not_subsampled(const char *function, const char *file, int line, const Format &format, const TensorShape &shape, const ITensor *tensor1, Ts... tensors)
Return an error if the passed tensor objects are not sub-sampled.
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
@ UYVY422
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
Get the info for a tensor.
bool has_format_horizontal_subsampling(Format format)
Return true if the given format has horizontal subsampling.
Copyright (c) 2017-2024 Arm Limited.
@ NV12
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
arm_compute::Status error_on_invalid_subtensor_valid_region(const char *function, const char *file, const int line, const ValidRegion &parent_valid_region, const ValidRegion &valid_region)
Return an error if the valid region of a subtensor is not inside the valid region of the parent tenso...
@ F16
16-bit floating-point number
TensorShape adjust_odd_shape(const TensorShape &shape, Format format)
Adjust tensor shape size if width or height are odd for a given multi-planar format.
arm_compute::Status error_on_mismatching_data_types(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, Ts... tensor_infos)
Return an error if the passed two tensor infos have different data types.
ITensorInfo * operator()(const ITensor *tensor)
Get the info for a tensor.
arm_compute::Status error_on_invalid_subtensor(const char *function, const char *file, const int line, const TensorShape &parent_shape, const Coordinates &coords, const TensorShape &shape)
Return an error if if the coordinates and shape of the subtensor are within the parent tensor.
arm_compute::Status error_on_window_not_collapsable_at_dimension(const char *function, const char *file, const int line, const Window &full, const Window &window, const int dim)
Return an error if the window can't be collapsed at the given dimension.
TensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
@ UNKNOWN
Unknown data layout.
Store the tensor's metadata.
@ UNKNOWN
Unknown data type.
Dimensions with dimensionality.
TensorInfo tensor_info
Associated tensor info.
Get the info for a tensor, dummy struct.
DataType
Available data types.
@ NV21
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&...pointers)
Create an error if one of the pointers is a nullptr.
arm_compute::Status error_on_channel_not_in(const char *function, const char *file, const int line, T cn, T &&channel, Ts &&...channels)
Return an error if the channel is not in channels.
arm_compute::Status error_on_data_type_channel_not_in(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, size_t num_channels, T &&dt, Ts &&...dts)
Return an error if the data type or the number of channels of the passed tensor info does not match a...
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.