c++ - TensorFlow C++等于argmax(axis = -1)

标签 c++ tensorflow

我正在TensorFlow C++中预测PB图形输出。
session-> Run正常运行,并给出浮点值列表作为输出

load_graph_status = session->Run(inputs, { output_layer_name }, {}, &outputs);

我在使用过的Python中做了类似的预测
output = outputs.argmax(axis=-1)

我在C++中找不到与之等效的东西? TensorFlow C++文档中有一个tensorflow::ops::argmax。但是我不知道如何使用它。

最佳答案

要回答我自己的问题,C++中没有直接的方法可以完成这项工作。
解决方法是迭代获取和存储每个输出值,并获取列表的最大值。

关于c++ - TensorFlow C++等于argmax(axis = -1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54854890/

相关文章:

c++ 紧密耦合的模板定义,无限重复的模板参数

c++ - 多线程环境中的延迟加载数据

c++ - 在 for-each 循环中使用 'const' 时是否需要添加 'auto'?

python - 如何让 estimator.predict 预测一个样本

tensorflow - 如何将以下代码从 pytorch 更改为 tensorflow?

tensorflow - keras SpatialDropout2D 在 TimeDistributed 层中的正确使用 - CNN LSTM 网络

tensorflow - 在 slim.stack 中交错 slim.dropout 和 slim.complete_connected ?

c++ - Visual Studio C++ 是否可以在不链接的情况下编译对象

用于在编译时检测对称数组的 C++ 模板编程

tensorflow - Bazel 使用不同的编译器构建