tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
operators_common.h
Go to the documentation of this file.
1#pragma once
2#include "config.h"
3
4template <typename Expr1, typename Expr2>
5void checkDimsMatch(const Expr1 &lhs, const Expr2 &rhs, const char *opName) TESSERACT_CONDITIONAL_NOEXCEPT
6{
7#ifdef RUNTIME_CHECK_DIMENSIONS_COUNT_MISMATCH
8 if (lhs.getNumDims() != rhs.getNumDims()) [[unlikely]]
9 MyErrorHandler::error(opName, ": dimension count mismatch");
10#endif
11
12#ifdef RUNTIME_CHECK_DIMENSIONS_SIZE_MISMATCH
13 for (my_size_t i = 0; i < lhs.getNumDims(); ++i)
14 {
15 if (lhs.getDim(i) != rhs.getDim(i)) [[unlikely]]
16 MyErrorHandler::error(opName, ": dimension size mismatch at dimension ", i);
17 }
18#endif
19}
static void error(const T &msg)
Definition error_handler.h:30
Global configuration for the tesseract tensor library.
#define my_size_t
Size/index type used throughout the library.
Definition config.h:126
#define TESSERACT_CONDITIONAL_NOEXCEPT
Definition config.h:56
void checkDimsMatch(const Expr1 &lhs, const Expr2 &rhs, const char *opName) TESSERACT_CONDITIONAL_NOEXCEPT
Definition operators_common.h:5