Closed thomasediolausson closed 1 year ago
If you come up against errors in the model.h
file, do the following changes.
for (int i=0; i<inputs.size(); i++) {
// Operations
const auto[op_name, op_idx] = parse_name(std::get<0>(inputs[i]));
// auto op_name_idx = parse_name(std::get<0>(inputs[i]));
// auto op_name = std::get<0>(op_name_idx);
// auto op_idx = std::get<1>(op_name_idx);
inp_ops[i].oper = TF_GraphOperationByName(this->graph.get(), op_name.c_str());
inp_ops[i].index = op_idx;
if (!inp_ops[i].oper)
throw std::runtime_error("No operation named \"" + op_name + "\" exists");
// Values
inp_val[i] = std::get<1>(inputs[i]).get_tensor().get();
}
std::vector<TF_Output> out_ops(outputs.size());
auto out_val = std::make_unique<TF_Tensor*[]>(outputs.size());
for (int i=0; i<outputs.size(); i++) {
const auto[op_name, op_idx] = parse_name(outputs[i]);
// auto op_name_idx = parse_name(outputs[i]);
// auto op_name = std::get<0>(op_name_idx);
// auto op_idx = std::get<1>(op_name_idx);
out_ops[i].oper = TF_GraphOperationByName(this->graph.get(), op_name.c_str());
out_ops[i].index = op_idx;
if (!out_ops[i].oper)
throw std::runtime_error("No operation named \"" + op_name + "\" exists");
}
In both for loops, replace the structure bindings code with the three lines (commented).
So replace const auto[op_name, op_idx] = parse_name(std::get<0>(inputs[i]));
with:
auto op_name_idx = parse_name(std::get<0>(inputs[i]));
auto op_name = std::get<0>(op_name_idx);
auto op_idx = std::get<1>(op_name_idx);
and in the second for loop
:
Replace const auto[op_name, op_idx] = parse_name(outputs[i]);
with:
auto op_name_idx = parse_name(outputs[i]);
auto op_name = std::get<0>(op_name_idx);
auto op_idx = std::get<1>(op_name_idx);
If auto
is also not recognized, than you are up for some very painstaking work of replacing all of those auto
s.
After writing the above: Saw the below: issue 108
Hi, there is no intention on supporting C++98.
I am closing the issue, but any help to achieve this can be posted or answered here.
Hi!
I'm trying to compile some cppflow libraries with c++98. Has anyone attempted this?