diff options
author | Akshay Modi <nareshmodi@google.com> | 2018-04-03 10:04:47 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-04-03 10:09:05 -0700 |
commit | 655b2663e7d2609b0f578b9ef3c1401de22dc5c2 (patch) | |
tree | 61ac9426556a65f99edf99a23fa491d329d70016 /tensorflow/python/client | |
parent | cfc886ac6064a04c71dd6c52e8c21ebec91eae50 (diff) |
Apply "Raise exception in SWIG on bad TF_Status" to base.i
Minor fixes to make this work.
PiperOrigin-RevId: 191457070
Diffstat (limited to 'tensorflow/python/client')
-rw-r--r-- | tensorflow/python/client/tf_session.i | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/tensorflow/python/client/tf_session.i b/tensorflow/python/client/tf_session.i index ee76e29c05..68768f2b4c 100644 --- a/tensorflow/python/client/tf_session.i +++ b/tensorflow/python/client/tf_session.i @@ -23,7 +23,6 @@ limitations under the License. #include "tensorflow/core/lib/strings/stringprintf.h" #include "tensorflow/core/public/version.h" #include "tensorflow/python/client/tf_session_helper.h" -#include "tensorflow/python/lib/core/py_exception_registry.h" // Helper function to convert a Python list of Tensors to a C++ vector of // TF_Outputs. @@ -353,27 +352,6 @@ TF_ImportGraphDefResultsMissingUnusedInputMappings_wrapper{ reinterpret_cast<const char*>($1.data), $1.length); } -// Typemaps to automatically raise a Python exception from bad output TF_Status. -// TODO(b/77295559): expand this to all TF_Status* output params and deprecate -// raise_exception_on_not_ok_status (currently it only affects the C API). -%typemap(in, numinputs=0) TF_Status* status (TF_Status* status) { - status = TF_NewStatus(); - $1 = status; -} - -%typemap(argout) TF_Status* status { - TF_Code code = TF_GetCode($1); - if (code != TF_OK) { - PyObject* exc = tensorflow::PyExceptionRegistry::Lookup(code); - // Arguments to OpError. - PyObject* exc_args = Py_BuildValue("sss", nullptr, nullptr, TF_Message($1)); - TF_DeleteStatus($1); - SWIG_SetErrorObj(exc, exc_args); - SWIG_fail; - } - TF_DeleteStatus($1); -} - // Converts input Python list of wrapped TF_Outputs into a single array %typemap(in) (const TF_Output* inputs, int num_inputs) (std::vector<TF_Output> inputs) { @@ -784,7 +762,3 @@ def TF_Reset(target, containers=None, config=None): %include "tensorflow/python/client/tf_session_helper.h" %unignoreall - -// Clear "TF_Status* status" typemap so it doesn't affect other modules and -// unexpectedly remove the TF_Status* argument from wrappers. -%clear TF_Status* status; |