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

#include <Constant.h>

Collaboration diagram for souschef::ConstantInt4DataChef:

Public Member Functions

 ConstantInt4DataChef (const int8_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

Definition at line 67 of file Constant.h.

Constructor & Destructor Documentation

◆ ConstantInt4DataChef()

souschef::ConstantInt4DataChef::ConstantInt4DataChef ( const int8_t &  value)
inline

Definition at line 70 of file Constant.h.

70 : _value{value}
71 {
72 // DO NOTHING
73 }

Member Function Documentation

◆ generate()

std::vector< uint8_t > souschef::ConstantInt4DataChef::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 84 of file Constant.h.

85 {
86 std::vector<uint8_t> res;
87
88 if (_value < -8 || 7 < _value)
89 throw std::runtime_error("Constant value out of range.");
90
91 for (uint32_t n = 0; n < count; ++n)
92 {
93 const uint8_t data = static_cast<const uint8_t>(_value);
94 res.emplace_back(data);
95 }
96
97 return res;
98 }

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