tensorflow C ++尝试创建图形失败

时间:2018-07-18 08:41:49

标签: c++ tensorflow

编译器提醒函数CreateGraphDef返回不完整的类型tensorflow::graphdef,我该如何解决此问题 像这样的代码:

GraphDef CreateGraphDef()
{
    Scope root = Scope::NewRootScope();

    auto X = ops::Placeholder(root.WithOpName("x"), DT_FLOAT,
        ops::Placeholder::Shape({ -1, 2 }));
    auto A = ops::Const(root, { { 3.f, 2.f },{ -1.f, 0.f } });

    auto Y = ops::MatMul(root.WithOpName("y"), A, X,
        ops::MatMul::TransposeB(true));

    GraphDef def;
    TF_CHECK_OK(root.ToGraphDef(&def));

    return def;
}

Full source image

0 个答案:

没有答案