Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++98 support #158

Closed
thomasediolausson opened this issue Oct 22, 2021 · 3 comments
Closed

C++98 support #158

thomasediolausson opened this issue Oct 22, 2021 · 3 comments

Comments

@thomasediolausson
Copy link

Hi!

I'm trying to compile some cppflow libraries with c++98. Has anyone attempted this?

@yochananscharf
Copy link

yochananscharf commented Oct 28, 2021

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 autos.

@yochananscharf
Copy link

After writing the above:
Saw the below:
issue 108

@serizba
Copy link
Owner

serizba commented Sep 23, 2022

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.

@serizba serizba closed this as completed Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants