Allow TFE_NewContext to fail more reasonably when SWIG is checking status.
authorAkshay Modi <nareshmodi@google.com>
Fri, 6 Apr 2018 17:28:10 +0000 (10:28 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Fri, 6 Apr 2018 17:31:53 +0000 (10:31 -0700)
commit5f8f0dc7998db78188c083b3c6945191145497a7
tree143a0a08a846aeeb58c37ffd41d5634c7a36232f
parent665e44f612c72d39717b0a5163dca82a07e1c174
Allow TFE_NewContext to fail more reasonably when SWIG is checking status.

Before:
TFE_Context would check nullptr, and the function would fail straight away.

Now:
TFE_Context is nullptr, so it skips down to checking the status, and an error
is raised.

I'm not able to find in SWIG documentation how to order typemaps in the
generated code - ideally, I'd order it to check the status typemap first. This
code makes it not dependent on this ordering either way.

PiperOrigin-RevId: 191905893
tensorflow/python/pywrap_tfe.i