diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-09-22 15:53:45 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-09-22 15:53:45 +0200 |
| commit | f398d046ed5ff6e3bf803c3f16d1fb470b464bdb (patch) | |
| tree | 31ea6489cd77ab6169f39a5e25dfded993c3d4b2 /modules/codec/c++/data_math.hpp | |
| parent | a1583da62ea0f7e9affe868cd509557b5e91fae3 (diff) | |
Add sqrt and normalize
Diffstat (limited to 'modules/codec/c++/data_math.hpp')
| -rw-r--r-- | modules/codec/c++/data_math.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/codec/c++/data_math.hpp b/modules/codec/c++/data_math.hpp index efdca7d..51657c7 100644 --- a/modules/codec/c++/data_math.hpp +++ b/modules/codec/c++/data_math.hpp @@ -120,6 +120,17 @@ public: return c; } + + template<typename InnerChange> + data<schema::Tensor<InnerChange, Dims...>, encode::Native> cast_to(){ + data<schema::Tensor<InnerChange, Dims...>, encode::Native> native_change; + rank_iterator<Dims...>::in_fixed_bounds([&](const data<schema::FixedArray<schema::UInt64, sizeof...(Dims)>, encode::Native>& index) -> error_or<void>{ + native_change.at(index) = at(index).template cast_to<InnerChange>(); + return make_void(); + }); + + return inner_change; + } }; } |
