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

#include <Explicit.h>

Collaboration diagram for souschef::ExplicitDataChef< T >:

Public Member Functions

 ExplicitDataChef ()
 
std::vector< uint8_t > generate (int32_t count) const override
 Generate a sequence of 'count' elements as a byte sequence.
 
void insert (const T &value)
 
- Public Member Functions inherited from souschef::DataChef
virtual ~DataChef ()=default
 

Detailed Description

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

Definition at line 28 of file Explicit.h.

Constructor & Destructor Documentation

◆ ExplicitDataChef()

template<typename T >
souschef::ExplicitDataChef< T >::ExplicitDataChef ( )
inline

Definition at line 31 of file Explicit.h.

32 {
33 // DO NOTHING
34 }

Member Function Documentation

◆ generate()

template<typename T >
std::vector< uint8_t > souschef::ExplicitDataChef< T >::generate ( int32_t  count) const
inlineoverridevirtual

Generate a sequence of 'count' elements as a byte sequence.

Let D be the return value of generate(N). Then, D.size() == N * sizeof(T) where T is the element type.

Implements souschef::DataChef.

Definition at line 37 of file Explicit.h.

38 {
39 std::vector<uint8_t> res;
40
41 for (uint32_t n = 0; n < count; ++n)
42 {
43 T const value = (n < _values.size()) ? _values.at(n) : T{};
44 const uint8_t *arr = reinterpret_cast<const uint8_t *>(&value);
45
46 for (uint32_t b = 0; b < sizeof(T); ++b)
47 {
48 res.emplace_back(arr[b]);
49 }
50 }
51
52 return res;
53 }
arr
Definition infer.py:92

◆ insert()

template<typename T >
void souschef::ExplicitDataChef< T >::insert ( const T &  value)
inline

Definition at line 56 of file Explicit.h.

56{ _values.emplace_back(value); }

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