ONE - On-device Neural Engine
Loading...
Searching...
No Matches
souschef::ExplicitInt4DataChef Class Referencefinal

#include <Explicit.h>

Collaboration diagram for souschef::ExplicitInt4DataChef:

Public Member Functions

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

Detailed Description

Definition at line 134 of file Explicit.h.

Constructor & Destructor Documentation

◆ ExplicitInt4DataChef()

souschef::ExplicitInt4DataChef::ExplicitInt4DataChef ( )
inline

Definition at line 137 of file Explicit.h.

138 {
139 // DO NOTHING
140 }

Member Function Documentation

◆ generate()

std::vector< uint8_t > souschef::ExplicitInt4DataChef::generate ( int32_t  count) const
overridevirtual

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 99 of file Explicit.cpp.

100{
101 std::vector<uint8_t> res;
102
103 for (uint32_t n = 0; n < count; ++n)
104 {
105 int8_t const value = (n < _values.size()) ? _values.at(n) : 0;
106 if (value < -8 || 7 < value)
107 throw std::runtime_error("Explicit value out of range.");
108
109 const uint8_t data = static_cast<const uint8_t>(value);
110 res.emplace_back(data);
111 }
112
113 return res;
114}

◆ insert()

void souschef::ExplicitInt4DataChef::insert ( const int8_t &  value)
inline

Definition at line 146 of file Explicit.h.

146{ _values.emplace_back(value); }

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