| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b59b69f commit c05ca6b
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,6 +32,13 @@ limitations under the License. | |||
| 32 | 32 | $1 = &temp; | |
| 33 | 33 | } | |
| 34 | 34 | ||
| 35 | + // Handle string input into AddDevices | ||
| 36 | + %typemap(in, numinputs=0) const string& name_prefix ( | ||
| 37 | + string temp) { | ||
| 38 | + // Always pass an empty name_prefix. | ||
| 39 | + $1 = &temp; | ||
| 40 | + } | ||
| 41 | + | ||
| 35 | 42 | %typemap(argout) std::vector<tensorflow::Device*>* devices { | |
| 36 | 43 | std::vector< std::unique_ptr<tensorflow::Device> > safe_devices; | |
| 37 | 44 | for (auto* device : *$1) safe_devices.emplace_back(device); | |
@@ -54,10 +61,10 @@ limitations under the License. | |||
| 54 | 61 | %#if PY_MAJOR_VERSION < 3 | |
| 55 | 62 | PyString_FromStringAndSize( | |
| 56 | 63 | %#else | |
| 57 | - PyUnicode_FromStringAndSize( | ||
| 64 | + PyBytes_FromStringAndSize( | ||
| 58 | 65 | %#endif | |
| 59 | - reinterpret_cast<const char*>( | ||
| 60 | - attr_serialized.data()), attr_serialized.size())); | ||
| 66 | + reinterpret_cast<const char*>( | ||
| 67 | + attr_serialized.data()), attr_serialized.size())); | ||
| 61 | 68 | ||
| 62 | 69 | if (PyList_Append(temp_string_list.get(), safe_attr_string.get()) == -1) { | |
| 63 | 70 | SWIG_fail; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,4 +34,4 @@ def _convert(pb_str): | |||
| 34 | 34 | m = device_attributes_pb2.DeviceAttributes() | |
| 35 | 35 | m.ParseFromString(pb_str) | |
| 36 | 36 | return m | |
| 37 | - return [_convert(s) for s in pywrap_tensorflow.DeviceFactory_AddDevices("")] | ||
| 37 | + return [_convert(s) for s in pywrap_tensorflow.DeviceFactory_AddDevices()] | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments