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

#include <Explicit.h>

Collaboration diagram for souschef::ExplicitDataChef< std::string >:

Public Member Functions

 ExplicitDataChef ()
 
std::vector< uint8_t > generate (int32_t count) const override
 
void insert (const std::string &value)
 
- Public Member Functions inherited from souschef::DataChef
virtual ~DataChef ()=default
 

Detailed Description

Definition at line 62 of file Explicit.h.

Constructor & Destructor Documentation

◆ ExplicitDataChef()

souschef::ExplicitDataChef< std::string >::ExplicitDataChef ( )
inline

Definition at line 65 of file Explicit.h.

66 {
67 // DO NOTHING
68 }

Member Function Documentation

◆ generate()

std::vector< uint8_t > souschef::ExplicitDataChef< std::string >::generate ( int32_t  count) const
overridevirtual
Note
This emulates TensorFlow int DynamicBuffer::WriteToBuffer(char** buffer) method Memory structure: int32_t count int32_t offsets[count + 1] string values[count] where string is like std::string without ending null byte

Implements souschef::DataChef.

Definition at line 36 of file Explicit.cpp.

37{
38 std::vector<uint8_t> res;
39
40 // write count
41 write_value(res, count);
42
43 // write first item offset
44 int32_t start = sizeof(int32_t) * (count + 2);
45 write_value(res, start);
46
47 // write succeeding items offset (or the end)
48 int32_t offset = start;
49 for (uint32_t n = 0; n < count; ++n)
50 {
51 std::string const value = (n < _values.size()) ? _values.at(n) : std::string{};
52 offset += value.length();
53 write_value(res, offset);
54 }
55
56 for (uint32_t n = 0; n < count; ++n)
57 {
58 std::string const value = (n < _values.size()) ? _values.at(n) : std::string{};
59 const uint8_t *arr = reinterpret_cast<const uint8_t *>(value.c_str());
60
61 for (uint32_t b = 0; b < value.length(); ++b)
62 {
63 res.emplace_back(arr[b]);
64 }
65 }
66
67 return res;
68}
__global uchar * offset(const Image *img, int x, int y)
Definition helpers.h:540
arr
Definition infer.py:92

References offset().

◆ insert()

void souschef::ExplicitDataChef< std::string >::insert ( const std::string &  value)
inline

Definition at line 74 of file Explicit.h.

74{ _values.emplace_back(value); }

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