-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor tile, transpose, and resize to use indexing view (#274)
* refactor to_string * refactor tile, transpose, resize to use indexing view * fix sycl eval * various utl fixes, add has_dst_size & has_src_size metafunction * update tsets * fix cuda build * try to fix arduino ci * try to fix arduino ci * try to fix gcc-index ci * try to fix bounded_size inference for indexing view * temporarily disable some eval test on no-stl tests * try to fix hipsycl ci * skip resize tests on hipsycl-cuda * try to fix platformio ci * temporarily disable arduino-platformio manip & constexpr ci
- Loading branch information
Showing
131 changed files
with
2,806 additions
and
1,341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef NMTOOLS_ARRAY_AS_STATIC_HPP | ||
#define NMTOOLS_ARRAY_AS_STATIC_HPP | ||
|
||
#include "nmtools/meta.hpp" | ||
#include "nmtools/utility/fwd.hpp" | ||
#include "nmtools/array/shape.hpp" | ||
#include "nmtools/utility/forward.hpp" | ||
#include "nmtools/array/ndarray.hpp" // for nmtools_static_vector | ||
|
||
namespace nmtools::array | ||
{ | ||
template <typename attribute_t, auto max_dim=8> | ||
struct as_static_t | ||
{ | ||
using attribute_type = attribute_t; | ||
|
||
attribute_type attribute; | ||
|
||
auto operator()() const noexcept | ||
{ | ||
if constexpr (meta::is_dynamic_index_array_v<attribute_type>) { | ||
using element_type = meta::get_element_type_t<attribute_t>; | ||
using result_type = nmtools_static_vector<element_type,max_dim>; | ||
auto result = result_type{}; | ||
result.resize(attribute.size()); | ||
for (size_t i=0; i<len(result); i++) { | ||
at(result,i) = at(attribute,i); | ||
} | ||
return result; | ||
} else { | ||
return fwd_attribute(attribute); | ||
} | ||
} | ||
}; | ||
|
||
template <auto max_dim=8, typename attribute_t> | ||
auto as_static(const attribute_t& attribute) | ||
{ | ||
auto mapper = as_static_t<attribute_t,max_dim>{attribute}; | ||
return mapper(); | ||
} // as_static | ||
} // namespace nmtools::array | ||
|
||
#endif // NMTOOLS_ARRAY_AS_STATIC_HPP |
Oops, something went wrong.