From a02a6aab7a955c7c6c7a76cbb64a8262d7d44f80 Mon Sep 17 00:00:00 2001 From: cliffburdick Date: Mon, 19 Aug 2024 08:22:14 -0700 Subject: [PATCH] Fix rank check on reductions --- include/matx/operators/all.h | 2 +- include/matx/operators/any.h | 2 +- include/matx/operators/argmax.h | 2 +- include/matx/operators/argmin.h | 2 +- include/matx/operators/max.h | 4 ++-- include/matx/operators/mean.h | 2 +- include/matx/operators/median.h | 2 +- include/matx/operators/min.h | 4 ++-- include/matx/operators/percentile.h | 2 +- include/matx/operators/prod.h | 2 +- include/matx/operators/stdd.h | 2 +- include/matx/operators/sum.h | 2 +- include/matx/operators/var.h | 2 +- include/matx/transforms/reduce.h | 4 ++-- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/matx/operators/all.h b/include/matx/operators/all.h index 9eed9c6b..c6d243bb 100644 --- a/include/matx/operators/all.h +++ b/include/matx/operators/all.h @@ -135,7 +135,7 @@ namespace detail { template __MATX_INLINE__ auto all(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/any.h b/include/matx/operators/any.h index 2d34f50c..3cd3f2b3 100644 --- a/include/matx/operators/any.h +++ b/include/matx/operators/any.h @@ -135,7 +135,7 @@ namespace detail { template __MATX_INLINE__ auto any(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/argmax.h b/include/matx/operators/argmax.h index 5e57ae8a..176c4ff2 100644 --- a/include/matx/operators/argmax.h +++ b/include/matx/operators/argmax.h @@ -105,7 +105,7 @@ namespace detail { template __MATX_INLINE__ auto argmax(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/argmin.h b/include/matx/operators/argmin.h index 160f040f..1b7b70ce 100644 --- a/include/matx/operators/argmin.h +++ b/include/matx/operators/argmin.h @@ -105,7 +105,7 @@ namespace detail { template __MATX_INLINE__ auto argmin(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/max.h b/include/matx/operators/max.h index 62f66512..8ce23ce1 100644 --- a/include/matx/operators/max.h +++ b/include/matx/operators/max.h @@ -133,7 +133,7 @@ namespace detail { template __MATX_INLINE__ auto max(const InType &in, const int (&dims)[D]) { - static_assert(D <= InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); @@ -144,7 +144,7 @@ template [[deprecated("Use max() instead of rmax() for reductions")]] __MATX_INLINE__ auto rmax(const InType &in, const int (&dims)[D]) { - static_assert(D <= InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/mean.h b/include/matx/operators/mean.h index 0274874e..54a7320d 100644 --- a/include/matx/operators/mean.h +++ b/include/matx/operators/mean.h @@ -137,7 +137,7 @@ namespace detail { template __MATX_INLINE__ auto mean(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/median.h b/include/matx/operators/median.h index 80e79cfd..287d7cf9 100644 --- a/include/matx/operators/median.h +++ b/include/matx/operators/median.h @@ -138,7 +138,7 @@ namespace detail { template __MATX_INLINE__ auto median(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/min.h b/include/matx/operators/min.h index e05aeda5..bd903f49 100644 --- a/include/matx/operators/min.h +++ b/include/matx/operators/min.h @@ -133,7 +133,7 @@ namespace detail { template __MATX_INLINE__ auto min(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); @@ -144,7 +144,7 @@ template [[deprecated("Use min() instead of rmin() for reductions")]] __MATX_INLINE__ auto rmin(const InType &in, const int (&dims)[D]) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/percentile.h b/include/matx/operators/percentile.h index c9b95a4a..2c1224e5 100644 --- a/include/matx/operators/percentile.h +++ b/include/matx/operators/percentile.h @@ -137,7 +137,7 @@ namespace detail { template __MATX_INLINE__ auto percentile(const InType &in, unsigned char q, const int (&dims)[D], PercentileMethod method = PercentileMethod::LINEAR) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); MATX_ASSERT_STR(q < 100, matxInvalidParameter, "Percentile must be < 100"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/prod.h b/include/matx/operators/prod.h index ecbafc98..f649fc1a 100644 --- a/include/matx/operators/prod.h +++ b/include/matx/operators/prod.h @@ -133,7 +133,7 @@ namespace detail { template __MATX_INLINE__ auto prod(const InType &in, const int (&dims)[D]) { - static_assert(D <= InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/stdd.h b/include/matx/operators/stdd.h index 82b904b1..315f4001 100644 --- a/include/matx/operators/stdd.h +++ b/include/matx/operators/stdd.h @@ -133,7 +133,7 @@ namespace detail { template __MATX_INLINE__ auto stdd(const InType &in, const int (&dims)[D]) { - static_assert(D <= InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/sum.h b/include/matx/operators/sum.h index 03545ea5..54d8d0ea 100644 --- a/include/matx/operators/sum.h +++ b/include/matx/operators/sum.h @@ -133,7 +133,7 @@ namespace detail { template __MATX_INLINE__ auto sum(const InType &in, const int (&dims)[D]) { - static_assert(D <= InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/operators/var.h b/include/matx/operators/var.h index c1f04e8e..134103f7 100644 --- a/include/matx/operators/var.h +++ b/include/matx/operators/var.h @@ -138,7 +138,7 @@ namespace detail { template __MATX_INLINE__ auto var(const InType &in, const int (&dims)[D], int ddof = 1) { - static_assert(D < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(D < InType::Rank(), "reduction dimensions must be < Rank of input"); auto perm = detail::getPermuteDims(dims); auto permop = permute(in, perm); diff --git a/include/matx/transforms/reduce.h b/include/matx/transforms/reduce.h index b143b8fd..41ddbf27 100644 --- a/include/matx/transforms/reduce.h +++ b/include/matx/transforms/reduce.h @@ -1486,7 +1486,7 @@ void __MATX_INLINE__ mean_impl(OutType dest, const InType &in, { #ifdef __CUDACC__ MATX_NVTX_START("mean_impl(" + get_type_str(in) + ")", matx::MATX_NVTX_LOG_API) - static_assert(OutType::Rank() < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(OutType::Rank() < InType::Rank(), "reduction dimensions must be < Rank of input"); using inner_type = typename inner_op_type_t::type; inner_type scale = 1; @@ -1534,7 +1534,7 @@ void __MATX_INLINE__ mean_impl(OutType dest, const InType &in, [[maybe_unused]] { MATX_NVTX_START("mean_impl(" + get_type_str(in) + ")", matx::MATX_NVTX_LOG_API) - static_assert(OutType::Rank() < InType::Rank(), "reduction dimensions must be <= Rank of input"); + static_assert(OutType::Rank() < InType::Rank(), "reduction dimensions must be < Rank of input"); using inner_type = typename inner_op_type_t::type; inner_type scale = 1;