diff --git a/include/etl/expr/batch_k_minus_scale_expr.hpp b/include/etl/expr/batch_k_minus_scale_expr.hpp index 19999ec2..cc03f665 100644 --- a/include/etl/expr/batch_k_minus_scale_expr.hpp +++ b/include/etl/expr/batch_k_minus_scale_expr.hpp @@ -11,7 +11,7 @@ namespace etl { -template +template struct batch_k_minus_scale_expr : base_temporary_expr_tern, A, B, C> { using value_type = value_t; ///< The type of value of the expression using this_type = batch_k_minus_scale_expr; ///< The type of this expression @@ -96,10 +96,8 @@ struct batch_k_minus_scale_expr : base_temporary_expr_tern + template void assign_to(L&& lhs) const { - static_assert(all_etl_expr, "batch_k_minus_scale only supported for ETL expressions"); - inc_counter("temp:assign"); auto& a = this->a(); @@ -366,10 +364,8 @@ struct batch_k_minus_scale_expr : base_temporary_expr_tern + template void assign_add_to(L&& lhs) const { - static_assert(all_etl_expr, "batch_k_minus_scale only supported for ETL expressions"); - auto& a = this->a(); auto& b = this->b(); auto& c = this->c(); @@ -630,10 +626,8 @@ struct batch_k_minus_scale_expr : base_temporary_expr_tern + template void assign_sub_to(L&& lhs) const { - static_assert(all_etl_expr, "batch_k_minus_scale only supported for ETL expressions"); - auto& a = this->a(); auto& b = this->b(); auto& c = this->c(); @@ -894,10 +888,8 @@ struct batch_k_minus_scale_expr : base_temporary_expr_tern + template void assign_mul_to(L&& lhs) const { - static_assert(all_etl_expr, "batch_k_minus_scale only supported for ETL expressions"); - auto& a = this->a(); auto& b = this->b(); auto& c = this->c(); @@ -1158,10 +1150,8 @@ struct batch_k_minus_scale_expr : base_temporary_expr_tern + template void assign_div_to(L&& lhs) const { - static_assert(all_etl_expr, "batch_k_minus_scale only supported for ETL expressions"); - auto& a = this->a(); auto& b = this->b(); auto& c = this->c(); @@ -1422,10 +1412,8 @@ struct batch_k_minus_scale_expr : base_temporary_expr_tern + template void assign_mod_to(L&& lhs) const { - static_assert(all_etl_expr, "batch_k_minus_scale only supported for ETL expressions"); - auto& a = this->a(); auto& b = this->b(); auto& c = this->c(); @@ -1593,12 +1581,9 @@ struct etl_traits> { * \param value The expression * \return The transpose of the given expression. */ -template +template batch_k_minus_scale_expr, detail::build_type, detail::build_type> batch_k_minus_scale(const A& a, const B& b, const C& c) { - static_assert(all_etl_expr, "etl::batch_k_minus_scale can only be used on ETL expressions"); - static_assert(is_1d, "etl::batch_k_minus_scale is only defined for 1D LHS"); static_assert(is_4d || is_2d, "etl::batch_k_minus_scale is only defined for 2D/4D RHS"); - static_assert(is_1d, "etl::batch_k_minus_scale is only defined for 1D LHS"); return {a, b, c}; } diff --git a/include/etl/expr/bias_batch_mean_2d_expr.hpp b/include/etl/expr/bias_batch_mean_2d_expr.hpp index 20e84885..1d6207df 100644 --- a/include/etl/expr/bias_batch_mean_2d_expr.hpp +++ b/include/etl/expr/bias_batch_mean_2d_expr.hpp @@ -18,7 +18,7 @@ namespace etl { * \brief A transposition expression. * \tparam A The transposed type */ -template +template struct bias_batch_mean_2d_expr : base_temporary_expr_un, A> { using value_type = value_t; ///< The type of value of the expression using this_type = bias_batch_mean_2d_expr; ///< The type of this expression @@ -66,10 +66,8 @@ struct bias_batch_mean_2d_expr : base_temporary_expr_un + template void assign_to(L&& lhs) const { - static_assert(all_etl_expr, "bias_batch_mean_2d only supported for ETL expressions"); - inc_counter("temp:assign"); auto& a = this->a(); @@ -136,10 +134,8 @@ struct bias_batch_mean_2d_expr : base_temporary_expr_un + template void assign_add_to(L&& lhs) const { - static_assert(all_etl_expr, "bias_batch_mean_2d only supported for ETL expressions"); - if constexpr (all_floating && ((!Mean && cudnn_enabled) || (all_row_major && impl::egblas::has_sbias_batch_sum))) { std_add_evaluate(*this, lhs); } else { @@ -178,10 +174,8 @@ struct bias_batch_mean_2d_expr : base_temporary_expr_un + template void assign_sub_to(L&& lhs) const { - static_assert(all_etl_expr, "bias_batch_mean_2d only supported for ETL expressions"); - if constexpr (all_floating && ((!Mean && cudnn_enabled) || (all_row_major && impl::egblas::has_sbias_batch_sum))) { std_sub_evaluate(*this, lhs); } else { @@ -220,10 +214,8 @@ struct bias_batch_mean_2d_expr : base_temporary_expr_un + template void assign_mul_to(L&& lhs) const { - static_assert(all_etl_expr, "bias_batch_mean_2d only supported for ETL expressions"); - if constexpr (all_floating && ((!Mean && cudnn_enabled) || (all_row_major && impl::egblas::has_sbias_batch_sum))) { std_mul_evaluate(*this, lhs); } else { @@ -262,10 +254,8 @@ struct bias_batch_mean_2d_expr : base_temporary_expr_un + template void assign_div_to(L&& lhs) const { - static_assert(all_etl_expr, "bias_batch_mean_2d only supported for ETL expressions"); - if constexpr (all_floating && ((!Mean && cudnn_enabled) || (all_row_major && impl::egblas::has_sbias_batch_sum))) { std_div_evaluate(*this, lhs); } else { @@ -304,10 +294,8 @@ struct bias_batch_mean_2d_expr : base_temporary_expr_un + template void assign_mod_to(L&& lhs) const { - static_assert(all_etl_expr, "bias_batch_mean_2d only supported for ETL expressions"); - if constexpr (all_floating && ((!Mean && cudnn_enabled) || (all_row_major && impl::egblas::has_sbias_batch_sum))) { std_mod_evaluate(*this, lhs); } else { @@ -453,11 +441,8 @@ struct etl_traits> { * \param value The expression * \return The transpose of the given expression. */ -template +template bias_batch_mean_2d_expr, true> bias_batch_mean_2d(const E& value) { - static_assert(is_etl_expr, "etl::bias_batch_mean_2d can only be used on ETL expressions"); - static_assert(is_2d, "etl::bias_batch_mean_2d is only defined for 2d input"); - return bias_batch_mean_2d_expr, true>{value}; } @@ -466,11 +451,8 @@ bias_batch_mean_2d_expr, true> bias_batch_mean_2d(const E& * \param value The expression * \return The transpose of the given expression. */ -template +template bias_batch_mean_2d_expr, false> bias_batch_sum_2d(const E& value) { - static_assert(is_etl_expr, "etl::bias_batch_sum_2d can only be used on ETL expressions"); - static_assert(is_2d, "etl::bias_batch_sum_2d is only defined for 2d input"); - return bias_batch_mean_2d_expr, false>{value}; } diff --git a/include/etl/expr/conv_2d_valid_multi_multi_expr.hpp b/include/etl/expr/conv_2d_valid_multi_multi_expr.hpp index 58c20f33..22c10c1c 100644 --- a/include/etl/expr/conv_2d_valid_multi_multi_expr.hpp +++ b/include/etl/expr/conv_2d_valid_multi_multi_expr.hpp @@ -22,7 +22,7 @@ namespace etl { * \tparam B The kernel type * \tparam Flipped Indicates if the kernels are already flipped */ -template +template struct conv_2d_valid_multi_multi_expr : base_temporary_expr_bin, A, B> { using value_type = value_t; ///< The type of value of the expression using this_type = conv_2d_valid_multi_multi_expr; ///< The type of this expression @@ -74,10 +74,8 @@ struct conv_2d_valid_multi_multi_expr : base_temporary_expr_bin + template void assign_to(C&& c) const { - static_assert(all_etl_expr, "conv2_valid only supported for ETL expressions"); - inc_counter("temp:assign"); auto& a = this->a(); @@ -258,10 +256,8 @@ struct etl_traits +template conv_2d_valid_multi_multi_expr, detail::build_type, S1, S2, P1, P2, false> conv_2d_valid_multi_multi(A&& a, B&& b) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - return conv_2d_valid_multi_multi_expr, detail::build_type, S1, S2, P1, P2, false>{a, b}; } @@ -274,10 +270,8 @@ conv_2d_valid_multi_multi_expr, detail::build_type, S1, * * \return an expression representing the 'valid' 2D convolution of a and b */ -template +template auto conv_2d_valid_multi_multi(A&& a, B&& b, C&& c) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - c = conv_2d_valid_multi_multi(a, b); return c; @@ -291,10 +285,8 @@ auto conv_2d_valid_multi_multi(A&& a, B&& b, C&& c) { * * \return an expression representing the 'valid' 2D convolution of a and b */ -template +template conv_2d_valid_multi_multi_expr, detail::build_type, S1, S2, P1, P2, true> conv_2d_valid_multi_multi_flipped(A&& a, B&& b) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - return conv_2d_valid_multi_multi_expr, detail::build_type, S1, S2, P1, P2, true>{a, b}; } @@ -307,10 +299,8 @@ conv_2d_valid_multi_multi_expr, detail::build_type, S1, * * \return an expression representing the 'valid' 2D convolution of a and b */ -template +template auto conv_2d_valid_multi_multi_flipped(A&& a, B&& b, C&& c) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - c = conv_2d_valid_multi_multi_flipped(a, b); return c; diff --git a/include/etl/expr/dyn_conv_2d_valid_multi_multi_expr.hpp b/include/etl/expr/dyn_conv_2d_valid_multi_multi_expr.hpp index 097af151..14067faa 100644 --- a/include/etl/expr/dyn_conv_2d_valid_multi_multi_expr.hpp +++ b/include/etl/expr/dyn_conv_2d_valid_multi_multi_expr.hpp @@ -22,7 +22,7 @@ namespace etl { * \tparam B The kernel type * \tparam Flipped Indicates if the kernels are already flipped */ -template +template struct dyn_conv_2d_valid_multi_multi_expr : base_temporary_expr_bin, A, B> { using value_type = value_t; ///< The type of value of the expression using this_type = dyn_conv_2d_valid_multi_multi_expr; ///< The type of this expression @@ -71,10 +71,8 @@ struct dyn_conv_2d_valid_multi_multi_expr : base_temporary_expr_bin + template void assign_to(C&& c) const { - static_assert(all_etl_expr, "conv_2d_valid_multi_multi only supported for ETL expressions"); - inc_counter("temp:assign"); auto& a = this->a(); @@ -237,11 +235,9 @@ struct etl_traits> { * \param p2 The second dimension padding (top and bottom) * \return an expression representing the valid 2D convolution of a and b */ -template +template dyn_conv_2d_valid_multi_multi_expr, detail::build_type, false> conv_2d_valid_multi_multi( A&& a, B&& b, size_t s1, size_t s2, size_t p1 = 0, size_t p2 = 0) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - return dyn_conv_2d_valid_multi_multi_expr, detail::build_type, false>{a, b, s1, s2, p1, p2}; } @@ -256,10 +252,8 @@ dyn_conv_2d_valid_multi_multi_expr, detail::build_type, * \param p2 The second dimension padding (top and bottom) * \return an expression representing the valid 2D convolution of a and b */ -template +template auto conv_2d_valid_multi_multi(A&& a, B&& b, C&& c, size_t s1, size_t s2, size_t p1, size_t p2) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - c = conv_2d_valid_multi_multi(a, b, s1, s2, p1, p2); return c; @@ -275,11 +269,9 @@ auto conv_2d_valid_multi_multi(A&& a, B&& b, C&& c, size_t s1, size_t s2, size_t * \param p2 The second dimension padding (top and bottom) * \return an expression representing the valid 2D convolution of a and b */ -template +template dyn_conv_2d_valid_multi_multi_expr, detail::build_type, true> conv_2d_valid_multi_multi_flipped( A&& a, B&& b, size_t s1, size_t s2, size_t p1 = 0, size_t p2 = 0) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - return dyn_conv_2d_valid_multi_multi_expr, detail::build_type, true>{a, b, s1, s2, p1, p2}; } @@ -294,10 +286,8 @@ dyn_conv_2d_valid_multi_multi_expr, detail::build_type, * \param p2 The second dimension padding (top and bottom) * \return an expression representing the valid 2D convolution of a and b */ -template +template auto conv_2d_valid_multi_multi_flipped(A&& a, B&& b, C&& c, size_t s1, size_t s2, size_t p1, size_t p2) { - static_assert(all_etl_expr, "Convolution only supported for ETL expressions"); - c = conv_2d_valid_multi_multi_flipped(a, b, s1, s2, p1, p2); return c; diff --git a/include/etl/expr/gemv_expr.hpp b/include/etl/expr/gemv_expr.hpp index 0fa29c90..8a0e6cdd 100644 --- a/include/etl/expr/gemv_expr.hpp +++ b/include/etl/expr/gemv_expr.hpp @@ -22,7 +22,7 @@ namespace etl { * \brief A transposition expression. * \tparam A The transposed type */ -template +template struct gemv_expr : base_temporary_expr_bin, A, B> { using value_type = value_t; ///< The type of value of the expression using this_type = gemv_expr; ///< The type of this expression @@ -205,10 +205,8 @@ struct gemv_expr : base_temporary_expr_bin, A, B> { * \brief Assign to a matrix of the same storage order * \param c The expression to which assign */ - template + template void assign_to(C&& c) const { - static_assert(all_etl_expr, "gemm only supported for ETL expressions"); - inc_counter("temp:assign"); check(this->a(), this->b(), c);