24 #ifndef __ARM_COMPUTE_VALIDATE_H__ 25 #define __ARM_COMPUTE_VALIDATE_H__ 54 const Window &full,
const Window &win);
55 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(f, w) ::arm_compute::error_on_mismatching_windows(__func__, __FILE__, __LINE__, f, w) 71 const Window &full,
const Window &sub);
72 #define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s) ::arm_compute::error_on_invalid_subwindow(__func__, __FILE__, __LINE__, f, s) 85 const Coordinates &pos,
unsigned int max_dim);
86 #define ARM_COMPUTE_ERROR_ON_COORDINATES_DIMENSIONS_GTE(p, md) ::arm_compute::error_on_coordinates_dimensions_gte(__func__, __FILE__, __LINE__, p, md) 99 const Window &win,
unsigned int max_dim);
100 #define ARM_COMPUTE_ERROR_ON_WINDOW_DIMENSIONS_GTE(w, md) ::arm_compute::error_on_window_dimensions_gte(__func__, __FILE__, __LINE__, w, md) 131 template <
typename... Ts>
141 const std::array<
const ITensor *,
sizeof...(Ts)> tensors_array{ { std::forward<Ts>(tensors)... } };
148 function, file, line,
"Tensors have different shapes");
150 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_SHAPES(...) ::arm_compute::error_on_mismatching_shapes(__func__, __FILE__, __LINE__, __VA_ARGS__) 161 template <
typename... Ts>
174 const std::array<
const ITensor *,
sizeof...(Ts)> tensors_array{ { std::forward<Ts>(tensors)... } };
179 return tensor->info()->data_type() != first_data_type;
181 function, file, line,
"Tensors have different data types");
184 #define ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(...) ::arm_compute::error_on_mismatching_data_types(__func__, __FILE__, __LINE__, __VA_ARGS__) 195 template <
typename T,
typename F,
typename... Fs>
197 const T *
object, F &&format, Fs &&... formats)
201 Format &&object_format =
object->info()->format();
206 const std::array<F,
sizeof...(Fs)> formats_array{ { std::forward<Fs>(formats)... } };
211 return f == object_format;
213 function, file, line,
"Format %s not supported by this kernel",
string_from_format(object_format).c_str());
215 #define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t, ...) ::arm_compute::error_on_format_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__) 226 template <
typename T,
typename... Ts>
228 const ITensor *tensor, T &&dt, Ts &&... dts)
237 const std::array<T,
sizeof...(Ts)> dts_array{ { std::forward<Ts>(dts)... } };
242 return d == tensor_dt;
244 function, file, line,
"ITensor data type %s not supported by this kernel",
string_from_data_type(tensor_dt).c_str());
246 #define ARM_COMPUTE_ERROR_ON_DATA_TYPE_NOT_IN(t, ...) ::arm_compute::error_on_data_type_not_in(__func__, __FILE__, __LINE__, t, __VA_ARGS__) 258 template <
typename T,
typename... Ts>
260 const ITensor *tensor,
size_t num_channels, T &&dt, Ts &&... dts)
267 ARM_COMPUTE_ERROR_ON_LOC_MSG(tensor_nc != num_channels,
function, file, line,
"Number of channels %d. Required number of channels %d", tensor_nc, num_channels);
269 #define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c, ...) ::arm_compute::error_on_data_type_channel_not_in(__func__, __FILE__, __LINE__, t, c, __VA_ARGS__) 279 const ITensor *tensor);
280 #define ARM_COMPUTE_ERROR_ON_TENSOR_NOT_2D(t) ::arm_compute::error_on_tensor_not_2d(__func__, __FILE__, __LINE__, t) 291 template <
typename T,
typename... Ts>
293 T cn, T &&channel, Ts &&... channels)
297 const std::array<T,
sizeof...(Ts)> channels_array{ { std::forward<Ts>(channels)... } };
299 ARM_COMPUTE_ERROR_ON_LOC(channel != cn && std::none_of(channels_array.begin(), channels_array.end(), [&](
const T & f)
303 function, file, line);
305 #define ARM_COMPUTE_ERROR_ON_CHANNEL_NOT_IN(c, ...) ::arm_compute::error_on_channel_not_in(__func__, __FILE__, __LINE__, c, __VA_ARGS__) 317 #define ARM_COMPUTE_ERROR_ON_CHANNEL_NOT_IN_KNOWN_FORMAT(f, c) ::arm_compute::error_on_channel_not_in_known_format(__func__, __FILE__, __LINE__, f, c) 333 const IMultiHOG *multi_hog);
334 #define ARM_COMPUTE_ERROR_ON_INVALID_MULTI_HOG(m) ::arm_compute::error_on_invalid_multi_hog(__func__, __FILE__, __LINE__, m) 344 const IKernel *kernel);
345 #define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k) ::arm_compute::error_on_unconfigured_kernel(__func__, __FILE__, __LINE__, k) #define ARM_COMPUTE_ERROR_ON_LOC_MSG(cond, func, file, line,...)
void error_on_invalid_subwindow(const char *function, const char *file, const int line, const Window &full, const Window &sub)
Throw an error if the passed subwindow is invalid.
void error_on_window_dimensions_gte(const char *function, const char *file, const int line, const Window &win, unsigned int max_dim)
Throw an error if the passed window has too many dimensions.
DataType data_type() const
Data type used for each element of the tensor.
void error_on_data_type_channel_not_in(const char *function, const char *file, const int line, const ITensor *tensor, size_t num_channels, T &&dt, Ts &&...dts)
Throw an error if the data type or the number of channels of the passed tensor does not match any of ...
bool have_different_shapes(const ITensor *tensor_1, const ITensor *tensor_2)
void error_on_mismatching_shapes(const char *function, const char *file, const int line, const ITensor *tensor_1, const ITensor *tensor_2, Ts...tensors)
Throw an error if the passed two tensors have different shapes.
#define ARM_COMPUTE_UNUSED(var)
To avoid unused variables warnings.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Interface for NEON tensor.
void error_on_data_type_not_in(const char *function, const char *file, const int line, const ITensor *tensor, T &&dt, Ts &&...dts)
Throw an error if the data type of the passed tensor does not match any of the data types provided...
size_t num_channels() const
The number of channels for each tensor element.
virtual TensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
void error_on_unconfigured_kernel(const char *function, const char *file, const int line, const IKernel *kernel)
Throw an error if the kernel is not configured.
size_t dimension(size_t index) const
Return the size of the requested dimension.
Channel
Available channels.
Format
Image colour formats.
void error_on_channel_not_in(const char *function, const char *file, const int line, T cn, T &&channel, Ts &&...channels)
Throw an error if the channel is not in channels.
void error_on_coordinates_dimensions_gte(const char *function, const char *file, const int line, const Coordinates &pos, unsigned int max_dim)
Throw an error if the passed coordinates have too many dimensions.
void error_on_channel_not_in_known_format(const char *function, const char *file, const int line, Format fmt, Channel cn)
Throw an error if the channel is not in format.
#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.
void error_on_invalid_multi_hog(const char *function, const char *file, const int line, const IMultiHOG *multi_hog)
Throw an error if the IMultiHOG container is invalid.
void error_on_tensor_not_2d(const char *function, const char *file, const int line, const ITensor *tensor)
Throw an error if the tensor is not 2D.
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...
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
DataType
Available data types.
const std::string & string_from_format(Format format)
Convert a tensor format into a string.
void error_on_mismatching_data_types(const char *function, const char *file, const int line, const ITensor *tensor_1, const ITensor *tensor_2, Ts...tensors)
Throw an error if the passed two tensors have different data types.
void error_on_mismatching_windows(const char *function, const char *file, const int line, const Window &full, const Window &win)
Throw an error if the passed window is invalid.