29 template <
typename LE,
typename RE>
33 }
else if constexpr (all_etl_expr<LE, RE> && !all_fast<LE, RE>) {
34 cpp_assert(
etl::size(lhs) ==
etl::size(rhs),
"Cannot perform element-wise operations on collections of different size");
44 #define validate_expression(lhs, rhs) static_assert(all_etl_expr<decltype(lhs), decltype(rhs)>, "ETL functions are only made for ETL expressions ") 46 #define validate_expression(lhs, rhs) \ 47 static_assert(all_etl_expr<decltype(lhs), decltype(rhs)>, "ETL functions are only made for ETL expressions "); \ 48 validate_expression_impl(lhs, rhs) 51 template <etl_expr LE,
typename RE>
52 void validate_assign([[maybe_unused]]
const LE& lhs, [[maybe_unused]]
const RE& rhs) {
55 }
else if constexpr (is_etl_expr<RE> && all_fast<LE, RE> && !is_wrapper_expr<RE>) {
57 }
else if constexpr (!is_etl_expr<RE> && !is_wrapper_expr<RE>) {
58 cpp_assert(
etl::size(lhs) == rhs.size(),
"Cannot perform element-wise operations on collections of different size");
60 cpp_assert(
etl::size(lhs) ==
etl::size(rhs),
"Cannot perform element-wise operations on collections of different size");
74 if constexpr (is_fast<E>) {
77 cpp_assert(etl::dim<0>(expr) == etl::dim<1>(expr),
"Function undefined for non-square matrix");
93 template <
size_t C1,
size_t C2, dyn_2d E>
95 cpp_assert(etl::template dim<0>(e) % C1 == 0 && etl::template dim<1>(e) % C2 == 0,
"Dimensions not divisible by the pooling ratio");
101 template <
size_t C1,
size_t C2, dyn_3d E>
103 cpp_assert(etl::template dim<1>(e) % C1 == 0 && etl::template dim<2>(e) % C2 == 0,
"Dimensions not divisible by the pooling ratio");
109 template <
size_t C1,
size_t C2, dyn_4d E>
111 cpp_assert(etl::template dim<2>(e) % C1 == 0 && etl::template dim<3>(e) % C2 == 0,
"Dimensions not divisible by the pooling ratio");
117 template <
size_t C1,
size_t C2, fast_2d E>
125 template <
size_t C1,
size_t C2, fast_3d E>
133 template <
size_t C1,
size_t C2, fast_4d E>
150 cpp_assert(etl::template dim<0>(e) % c1 == 0 && etl::template dim<1>(e) % c2 == 0,
"Dimensions not divisible by the pooling ratio");
158 cpp_assert(etl::template dim<1>(e) % c1 == 0 && etl::template dim<2>(e) % c2 == 0,
"Dimensions not divisible by the pooling ratio");
166 cpp_assert(etl::template dim<2>(e) % c1 == 0 && etl::template dim<3>(e) % c2 == 0,
"Dimensions not divisible by the pooling ratio");
181 template <
size_t C1,
size_t C2, dimensions_between<2, 4> E>
183 detail::validate_pmax_pooling_impl<C1, C2>(expr);
196 template <dimensions_between<2, 4> E>
198 detail::validate_pmax_pooling_impl(expr, c1, c2);
void validate_expression_impl([[maybe_unused]] const LE &lhs, [[maybe_unused]] const RE &rhs) noexcept
Make sure the two expressions have the same size.
Definition: checks.hpp:30
void validate_pmax_pooling_impl([[maybe_unused]] const E &e)
Make sure that the pooling ratios are correct and that the expression can be pooled from...
Definition: checks.hpp:94
Traits to get information about ETL types.
Definition: tmp.hpp:68
Root namespace for the ETL library.
Definition: adapter.hpp:15
void validate_pmax_pooling(const E &expr)
Make sure that the pooling ratios are correct and that the expression can be pooled from...
Definition: checks.hpp:182
constexpr size_t size(const E &expr) noexcept
Returns the size of the given ETL expression.
Definition: helpers.hpp:108
void assert_square([[maybe_unused]] E &&expr)
Make sure that the expression is square.
Definition: checks.hpp:73