| 2778 | } |
| 2779 | |
| 2780 | const tensorflow::OpDef* GetOpDef(PyObject* py_op_name) { |
| 2781 | const char* op_name = TFE_GetPythonString(py_op_name); |
| 2782 | if (op_name == nullptr) { |
| 2783 | PyErr_SetString(PyExc_TypeError, |
| 2784 | Printf("expected a string for op_name, got %s instead", |
| 2785 | py_op_name->ob_type->tp_name) |
| 2786 | .c_str()); |
| 2787 | return nullptr; |
| 2788 | } |
| 2789 | |
| 2790 | const tensorflow::OpRegistrationData* op_reg_data = nullptr; |
| 2791 | const tensorflow::Status lookup_status = |
| 2792 | tensorflow::OpRegistry::Global()->LookUp(op_name, &op_reg_data); |
| 2793 | if (MaybeRaiseExceptionFromStatus(lookup_status, nullptr)) { |
| 2794 | return nullptr; |
| 2795 | } |
| 2796 | return &op_reg_data->op_def; |
| 2797 | } |
| 2798 | |
| 2799 | const char* GetDeviceName(PyObject* py_device_name) { |
| 2800 | if (py_device_name != Py_None) { |
no test coverage detected