Closed ttdd11 closed 5 years ago
Hi @ttdd11 Try something like
TF_OperationDescription* desc = TF_NewOperation(graph, op_type, op_name);
TF_SetDevice(desc, "/gpu:0");
I have not tried these operations, but I think you can search for information on these functions, it looks like they do what you need
@Neargye Okay i tried this. Here is my code:
TF_Operation* op;
std::size_t pos = 0;
while ((op = TF_GraphNextOperation(graph, &pos)) != nullptr) {
const char* name = TF_OperationName(op);
QString strName = QString(name);
TF_OperationDescription* desc = TF_NewOperation(graph, TF_OperationOpType(op), TF_OperationName(op));
TF_SetDevice(desc, "/gpu:0");
Has no effect of the device being used.
Unfortunately, I did not try to run on GPU using this function TF_ImportGraphDefOptionsSetDefaultDevice
Thanks for this it is very helpful. Is it possible to specify a specific device for the graph (ie. gpu:0) as per the c++ api?