1 /* Copyright 2015 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 %include "tensorflow/python/platform/base.i" 17 18 %{ 19 #include "tensorflow/python/framework/python_op_gen.h" 20 %} 21 22 // Input typemap for GetPythonWrappers. 23 // Accepts a python object of 'bytes' type, and converts it to 24 // a const char* pointer and size_t length. The default typemap 25 // going from python bytes to const char* tries to decode the 26 // contents from utf-8 to unicode for Python version >= 3, but 27 // we want the bytes to be uninterpreted. 28 %typemap(in) (const char* op_list_buf, size_t op_list_len) { 29 char* c_string; 30 Py_ssize_t py_size; 31 if (PyBytes_AsStringAndSize($input, &c_string, &py_size) == -1) { 32 SWIG_fail; 33 } 34 $1 = c_string; 35 $2 = static_cast<size_t>(py_size); 36 } 37 38 39 %ignoreall; 40 %unignore tensorflow::GetPythonWrappers; 41 %include "tensorflow/python/framework/python_op_gen.h" 42