#include <DirectoryIterator.h>
Definition at line 33 of file DirectoryIterator.h.
◆ DirectoryIterator()
record_minmax::DirectoryIterator::DirectoryIterator |
( |
const std::string & |
dir_path, |
|
|
luci::Module * |
module |
|
) |
| |
Definition at line 32 of file DirectoryIterator.cpp.
33 : _dir_path(dir_path)
34{
35 auto dir = opendir(dir_path.c_str());
36 if (not dir)
37 throw std::runtime_error("Cannot open directory. Please check \"" + _dir_path +
38 "\" is a directory.\n");
39
40 dirent *
entry =
nullptr;
41 while ((
entry = readdir(dir)))
42 {
43 if (
entry->d_type != DT_REG)
44 continue;
45
46 _entries.emplace_back(
entry);
47 }
48
51 {
52 const auto cnode = loco::must_cast<const luci::CircleInput *>(input_node);
53 _input_nodes.emplace_back(cnode);
54 }
55}
int entry(const int argc, char **argv)
std::vector< Node * > input_nodes(const Graph *)
References entry(), and loco::input_nodes().
◆ check_type_shape()
bool record_minmax::DirectoryIterator::check_type_shape |
( |
| ) |
const |
|
overridevirtual |
◆ hasNext()
bool record_minmax::DirectoryIterator::hasNext |
( |
| ) |
const |
|
overridevirtual |
◆ next()
std::vector< DataBuffer > record_minmax::DirectoryIterator::next |
( |
| ) |
|
|
overridevirtual |
Implements record_minmax::DataSetIterator.
Definition at line 59 of file DirectoryIterator.cpp.
60{
61 auto entry = _entries.at(_curr_idx++);
63
64
65 uint32_t total_input_size = 0;
66 for (auto input : _input_nodes)
67 {
68 const auto *
input_node = loco::must_cast<const luci::CircleInput *>(input);
70 }
71
72 const std::string filename =
entry->d_name;
73
74
75
76
77 std::vector<char>
input_data(total_input_size);
79
80 std::vector<DataBuffer> res;
81
83 for (auto input_node : _input_nodes)
84 {
86
88
89 buf.data.resize(input_size);
91
93
94 res.emplace_back(buf);
95 }
96
97 return res;
98}
__global uchar * offset(const Image *img, int x, int y)
CircleInput * input_node(loco::Graph *g, const loco::GraphInputIndex &index)
Find a Pull node with a given input index.
size_t getTensorSize(const luci::CircleNode *node)
void readDataFromFile(const std::string &filename, std::vector< char > &data, size_t data_size)
std::vector< char > DataBuffer
References entry(), record_minmax::getTensorSize(), offset(), and record_minmax::readDataFromFile().
The documentation for this class was generated from the following files: