diff options
author | 2017-10-19 16:42:14 -0700 | |
---|---|---|
committer | 2017-10-19 16:46:11 -0700 | |
commit | 2977dccc96c343ca85cb00b50672b36c99656532 (patch) | |
tree | e2431930ecc6850000458becd75bb368cceb9333 /tensorflow/python/pywrap_tfe.i | |
parent | e0e4f693978dcaf5bf4ecbc18e6926bdf33b2870 (diff) |
Context-specific C API to set options other than configproto (still unused)
PiperOrigin-RevId: 172818175
Diffstat (limited to 'tensorflow/python/pywrap_tfe.i')
-rw-r--r-- | tensorflow/python/pywrap_tfe.i | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tensorflow/python/pywrap_tfe.i b/tensorflow/python/pywrap_tfe.i index 5c624a9c12..36c09c20c2 100644 --- a/tensorflow/python/pywrap_tfe.i +++ b/tensorflow/python/pywrap_tfe.i @@ -30,12 +30,25 @@ limitations under the License. %rename("%s") TFE_Py_TapeDeleteTrace; %rename("%s") TFE_Py_TapeRecordOperation; %rename("%s") TFE_Py_TapeExport; - +%rename("%s") TFE_NewContextOptions; +%rename("%s") TFE_ContextOptionsSetConfig; +%rename("%s") TFE_DeleteContextOptions; %{ #include "tensorflow/python/eager/pywrap_tfe.h" %} +%typemap(in) (const void* proto) { + char* c_string; + Py_ssize_t py_size; + // PyBytes_AsStringAndSize() does not copy but simply interprets the input + if (PyBytes_AsStringAndSize($input, &c_string, &py_size) == -1) { + // Python has raised an error (likely TypeError or UnicodeEncodeError). + SWIG_fail; + } + $1 = static_cast<void*>(c_string); +} + %typemap(out) TF_DataType { $result = PyInt_FromLong($1); } @@ -165,3 +178,4 @@ limitations under the License. %typemap(in, numinputs=0) TF_Status *out_status; %typemap(freearg) (TF_Status* out_status); %typemap(argout) (TFE_OutputTensorHandles* outputs, TF_Status* out_status); +%typemap(in) (const void* proto); |