MCPcopy Create free account
hub / github.com/Samsung/ONE / readDataFromFile

Function readDataFromFile

compiler/record-minmax/src/RecordMinMax.cpp:106–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106void readDataFromFile(const std::string &filename, std::vector<char> &data, size_t data_size)
107{
108 assert(data.size() == data_size); // FIX_CALLER_UNLESS
109
110 std::ifstream fs(filename, std::ifstream::binary);
111 if (fs.fail())
112 throw std::runtime_error("Cannot open file \"" + filename + "\".\n");
113 if (fs.read(data.data(), data_size).fail())
114 throw std::runtime_error("Failed to read data from file \"" + filename + "\".\n");
115 if (fs.peek() != EOF)
116 throw std::runtime_error("Input tensor size mismatches with \"" + filename + "\".\n");
117}
118
119std::vector<uint8_t> genRandomBoolData(std::mt19937 &gen, uint32_t num_elements)
120{

Callers 2

profileRawDataMethod · 0.70

Calls 4

sizeMethod · 0.45
failMethod · 0.45
readMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected