ONE - On-device Neural Engine
Loading...
Searching...
No Matches
souschef::Dataset< T > Class Template Reference

#include <Dataset.h>

Public Member Functions

 Dataset (const std::vector< T > &vec)
 
 Dataset (std::vector< T > &&vec)
 
template<typename Func >
auto map (Func f) const -> Dataset< decltype(f(std::declval< T >()))>
 
const std::vector< T > & vectorize (void) const
 

Detailed Description

template<typename T>
class souschef::Dataset< T >

Definition at line 27 of file Dataset.h.

Constructor & Destructor Documentation

◆ Dataset() [1/2]

template<typename T >
souschef::Dataset< T >::Dataset ( const std::vector< T > &  vec)
inline

Definition at line 30 of file Dataset.h.

30 : _vec{vec}
31 {
32 // DO NOTHING
33 }

◆ Dataset() [2/2]

template<typename T >
souschef::Dataset< T >::Dataset ( std::vector< T > &&  vec)
inline

Definition at line 36 of file Dataset.h.

36 : _vec{std::move(vec)}
37 {
38 // DO NOTHING
39 }

Member Function Documentation

◆ map()

template<typename T >
template<typename Func >
auto souschef::Dataset< T >::map ( Func  f) const -> Dataset<decltype(f(std::declval<T>()))>
inline

Definition at line 42 of file Dataset.h.

43 {
44 using U = decltype(f(std::declval<T>()));
45 std::vector<U> res;
46
47 for (const auto &elem : _vec)
48 {
49 res.emplace_back(f(elem));
50 }
51
52 return Dataset<U>(std::move(res));
53 }

◆ vectorize()

template<typename T >
const std::vector< T > & souschef::Dataset< T >::vectorize ( void  ) const
inline

Definition at line 56 of file Dataset.h.

56{ return _vec; }

The documentation for this class was generated from the following file: