Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 455f2fa

Browse files
authored
Merge pull request #475 from facebookresearch/pr/options-serialize
Add CudaMappingOptions.serialize for python caffe2 TcOp
2 parents ea39df9 + 72e94a6 commit 455f2fa

File tree

1 file changed

+9
-0
lines changed
  • tensor_comprehensions/pybinds

1 file changed

+9
-0
lines changed

tensor_comprehensions/pybinds/tc.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,15 @@ PYBIND11_MODULE(tc, m) {
286286
" 4. conv\n"
287287
" 5. group_conv\n"
288288
" 6. single_thread")
289+
.def(
290+
"serialize",
291+
[](tc::CudaMappingOptions& instance) {
292+
std::string str = instance.toProtobufSerializedString();
293+
return py::bytes(str);
294+
},
295+
"Serialize the options to a protobuf string that can be deserialized later "
296+
"into a CudaMappingOptions. This is needed for Caffe2 who requires string "
297+
"arguments to configure TcOp.")
289298
.def(
290299
"__str__",
291300
[](tc::CudaMappingOptions& instance) {

0 commit comments

Comments
 (0)