Declare the tensors the file holds.
8{
9 for (size_t i = 0; i < entries.size(); ++i) {
10 const auto& spec = entries[i].spec;
11 if (spec.name.empty()) {
12 return fail(
"every raw tensor needs a name");
13 }
14 if (const auto why = spec.diagnose(); !why.empty()) {
16 }
17 if (!spec.device.is_host_accessible()) {
18 return fail(
"tensor '" + spec.name +
"' is not host memory");
19 }
20 for (size_t j = i + 1; j < entries.size(); ++j) {
21 if (entries[j].spec.name == spec.name) {
22 return fail(
"duplicate tensor name '" + spec.name +
"'");
23 }
24 }
25 }
27 return true;
28}
std::vector< RawTensorEntry > m_layout
bool fail(std::string reason)
Record a failure reason and return false.