MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ set_layout()

bool MayaFlux::IO::RawTensorReader::set_layout ( std::vector< RawTensorEntry > entries)

Declare the tensors the file holds.

Returns
False, with get_last_error() set, for an invalid spec, a duplicate or empty name, or device memory.

Definition at line 7 of file RawTensorReader.cpp.

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()) {
15 return fail(why);
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 }
26 m_layout = std::move(entries);
27 return true;
28}
std::vector< RawTensorEntry > m_layout
bool fail(std::string reason)
Record a failure reason and return false.

References MayaFlux::IO::TensorReader::fail(), and m_layout.

Here is the call graph for this function: