If `op_device` is non-empty, set the created op on that device.
| 206 | |
| 207 | // If `op_device` is non-empty, set the created op on that device. |
| 208 | void BinaryOpHelper(const char* op_name, TF_Operation* l, TF_Operation* r, |
| 209 | TF_Graph* graph, TF_Status* s, const char* name, |
| 210 | TF_Operation** op, const string& op_device, bool check) { |
| 211 | TF_OperationDescription* desc = TF_NewOperation(graph, op_name, name); |
| 212 | if (!op_device.empty()) { |
| 213 | TF_SetDevice(desc, op_device.c_str()); |
| 214 | } |
| 215 | TF_AddInput(desc, {l, 0}); |
| 216 | TF_AddInput(desc, {r, 0}); |
| 217 | *op = TF_FinishOperation(desc, s); |
| 218 | if (check) { |
| 219 | ASSERT_EQ(TF_OK, TF_GetCode(s)) << TF_Message(s); |
| 220 | ASSERT_NE(*op, nullptr); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | TF_Operation* MinWithDevice(TF_Operation* l, TF_Operation* r, TF_Graph* graph, |
| 225 | const string& op_device, TF_Status* s, |
no test coverage detected