33 #define CHECK_TENSOR_DEVICE(tensor, tensor_device) \
34 if (tensor.device() != tensor_device) { \
35 throw roccv::Exception("Invalid tensor " #tensor \
36 ": Ensure that this tensor is allocated on the proper device.", \
37 eStatusType::INVALID_OPERATION); \
45 #define CHECK_TENSOR_LAYOUT(tensor, ...) \
47 std::vector<eTensorLayout> v{__VA_ARGS__}; \
48 if (std::find(v.begin(), v.end(), tensor.layout().elayout()) == v.end()) { \
49 throw roccv::Exception("Unsupported tensor layout: " #tensor, eStatusType::INVALID_COMBINATION); \
58 #define CHECK_TENSOR_DATATYPES(tensor, ...) \
60 std::vector<eDataType> v{__VA_ARGS__}; \
61 if (std::find(v.begin(), v.end(), tensor.dtype().etype()) == v.end()) { \
62 throw roccv::Exception("Unsupported data type: " #tensor, eStatusType::NOT_IMPLEMENTED); \
71 #define CHECK_TENSOR_COMPARISON(comparison) \
72 if (!(comparison)) { \
73 throw roccv::Exception("Tensor check failed: " #comparison, eStatusType::INVALID_COMBINATION); \
80 #define CHECK_TENSOR_CHANNELS(tensor, ...) \
82 const std::vector<unsigned int> v{__VA_ARGS__}; \
83 if (std::find(v.begin(), v.end(), tensor.shape(tensor.layout().channels_index())) == v.end()) { \
84 throw roccv::Exception("Unsupported channel count: " #tensor, eStatusType::INVALID_COMBINATION); \