Neargye / hello_tf_c_api

Neural Network TensorFlow C API
MIT License
468 stars 134 forks source link

TF_INVALID_ARGUMENT #14

Closed eiwqueqie closed 5 years ago

eiwqueqie commented 5 years ago

When I run session_run.cpp, it occurs an error "TF_INVALID_ARGUMENT". What's wrong?

Neargye commented 5 years ago

You change something in example? On what OS and compiler you run?

eiwqueqie commented 5 years ago

Oh, I see. I have 2 GPUs, and want to run 2 sessions at the same time.

I added TF_ImportGraphDefOptionsSetDefaultDevice(opts, "/gpu:1"); before TF_GraphImportGraphDef(graph, buffer, opts, status); in tf_utils.cpp.

When I delete it, it run correctly. Maybe I need to try more in these cases. Thank you.

Neargye commented 5 years ago

Try build for gpu from release page https://github.com/Neargye/tensorflow.

eiwqueqie commented 5 years ago

My OS is Windows 10. I‘m sure it is GPU only lib from this page Install TensorFlow for C. And all input tensors are rechecked to confirm their shapes and data types are right. Finally it is found that only when I specify a device in my own code, it doesn't work.

Neargye commented 5 years ago

Unfortunately, I did not try to run on GPU using this function TF_ImportGraphDefOptionsSetDefaultDevice.