简体   繁体   中英

What is the TensorFlow C++ equivalent of argmax (axis=-1)

I am predicting pb graph output in TensorFlow C++. The session->Run works fine and it gives a list of float values as output

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

I have done similar prediction in Python where I used

output = outputs.argmax(axis=-1)

I couldn't find the equivalent of this in C++? There is a tensorflow::ops::argmax in TensorFlow C++ documentation. But I couldn't figure out how to use it.

To answer my own question, there is no direct method in C++ that does this job. The work around is to fetch and store each output value iteratively and get the maximum of the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM