ONE - On-device Neural Engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
souschef::ConstantDataChef< T > Class Template Referencefinal

#include <Constant.h>

Collaboration diagram for souschef::ConstantDataChef< T >:

Public Member Functions

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

Detailed Description

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

Definition at line 28 of file Constant.h.

Constructor & Destructor Documentation

◆ ConstantDataChef()

template<typename T >
souschef::ConstantDataChef< T >::ConstantDataChef ( const T &  value)
inline

Definition at line 31 of file Constant.h.

31 : _value{value}
32 {
33 // DO NOTHING
34 }

Member Function Documentation

◆ generate()

template<typename T >
std::vector< uint8_t > souschef::ConstantDataChef< 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 Constant.h.

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

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