protobuf.cc 19.3 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
2 3 4 5 6 7 8 9 10 11 12 13

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
Y
Yi Wang 已提交
14
#include "paddle/fluid/pybind/protobuf.h"
15

Y
Yu Yang 已提交
16
#include <deque>
Y
Yu Yang 已提交
17
#include <iostream>
L
Luo Tao 已提交
18 19
#include <string>
#include <tuple>
20

21
#include "paddle/fluid/distributed/auto_parallel/dist_attr.h"
Y
Yi Wang 已提交
22
#include "paddle/fluid/framework/block_desc.h"
23
#include "paddle/fluid/framework/ir/graph_helper.h"
Y
Yi Wang 已提交
24 25 26
#include "paddle/fluid/framework/op_desc.h"
#include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/framework/var_desc.h"
27
#include "paddle/fluid/framework/version.h"
28
#include "paddle/fluid/jit/property.h"
29
#include "paddle/fluid/pybind/pybind_variant_caster.h"
Y
Yu Yang 已提交
30

31 32
namespace py = pybind11;

33
namespace paddle {
34
namespace pybind {
35

36 37 38
PyTypeObject *g_vartype_pytype = nullptr;
PyTypeObject *g_blockdesc_pytype = nullptr;

39
namespace pd = paddle::framework;
40
namespace jit = paddle::jit;
F
fengjiayi 已提交
41

42 43 44
using paddle::distributed::auto_parallel::OperatorDistAttr;
using paddle::distributed::auto_parallel::TensorDistAttr;

Y
Yu Yang 已提交
45
template <typename T>
46 47
static pybind11::bytes SerializeMessage(
    T &self) {  // NOLINT due to pybind11 convention.
Y
Yu Yang 已提交
48 49
  // Check IsInitialized in Python
  std::string retv;
50 51
  PADDLE_ENFORCE_EQ(self.Proto()->SerializePartialToString(&retv),
                    true,
52 53
                    platform::errors::InvalidArgument(
                        "Failed to serialize input Desc to string."));
Y
Yu Yang 已提交
54 55 56
  return retv;
}

57 58 59 60 61 62 63 64 65
template <typename T>
static void DeserializeMessage(T *self, const std::string &str) {
  PADDLE_ENFORCE_EQ(
      self->Proto()->ParsePartialFromString(str),
      true,
      platform::errors::InvalidArgument("Failed to parse pb from string"));
  return;
}

Y
Yu Yang 已提交
66
// Bind Methods
67 68 69
void BindProgramDesc(pybind11::module *m) {
  pybind11::class_<pd::ProgramDesc>(*m, "ProgramDesc", "")
      .def(pybind11::init<>())
Y
Yu Yang 已提交
70
      .def("__init__",
71 72
           [](pd::ProgramDesc &self, const pd::ProgramDesc &other) {
             new (&self) pd::ProgramDesc(other);
Y
Yu Yang 已提交
73
           })
74
      .def("__init__",
75
           [](pd::ProgramDesc &self, const pybind11::bytes &binary_str) {
76
             std::string str(binary_str);
77
             new (&self) pd::ProgramDesc(str);
78
           })
79 80
      .def("append_block",
           &pd::ProgramDesc::AppendBlock,
81
           pybind11::return_value_policy::reference)
82 83
      .def("block",
           &pd::ProgramDesc::MutableBlock,
84 85
           pybind11::return_value_policy::reference)
      .def("num_blocks", &pd::ProgramDesc::Size)
86
      .def("flush", &pd::ProgramDesc::Flush)
87 88
      .def("get_feed_target_names", &pd::ProgramDesc::GetFeedTargetNames)
      .def("get_fetch_target_names", &pd::ProgramDesc::GetFetchTargetNames)
89
      .def("serialize_to_string", SerializeMessage<pd::ProgramDesc>)
L
Leo Chen 已提交
90
      .def("need_update", &pd::ProgramDesc::NeedUpdate)
91
      .def("parse_from_string",
92 93
           [](pd::ProgramDesc &program_desc, const std::string &data) {
             pd::proto::ProgramDesc *desc = program_desc.Proto();
94
             PADDLE_ENFORCE_EQ(
95 96
                 desc->ParseFromString(data),
                 true,
97 98
                 platform::errors::InvalidArgument(
                     "Failed to parse ProgramDesc from binary string."));
X
version  
Xin Pan 已提交
99
           })
100 101 102 103 104 105
      .def(
          "_set_version",
          [](pd::ProgramDesc &self, int64_t version) {
            return self.SetVersion(version);
          },
          pybind11::arg("version") = pd::kCurProgramVersion)
106
      .def("_version",
107
           [](pd::ProgramDesc &self) -> int64_t { return self.Version(); })
L
Leo Chen 已提交
108 109 110 111 112 113 114 115
      .def("get_op_deps",
           [](const framework::ProgramDesc &program) {
             return framework::ir::GetOpDependencies(program);
           })
      .def("need_update", &pd::ProgramDesc::NeedUpdate)
      .def("cached_hash_str", [](pd::ProgramDesc &self) {
        return self.CachedHashString();
        // return pybind11::bytes(self.CachedHashString());
116
      });
117 118
}

119
void BindBlockDesc(pybind11::module *m) {
120 121 122
  pybind11::class_<pd::BlockDesc> blockdesc(*m, "BlockDesc", "");
  g_blockdesc_pytype = (PyTypeObject *)blockdesc.ptr();  // NOLINT
  blockdesc.def_property_readonly("id", &pd::BlockDesc::ID)
123 124
      .def_property_readonly("parent", &pd::BlockDesc::Parent)
      .def("get_forward_block_idx", &pd::BlockDesc::ForwardBlockID)
W
Wu Yi 已提交
125
      .def("_set_forward_block_idx", &pd::BlockDesc::SetForwardBlockID)
126 127
      .def("append_op",
           &pd::BlockDesc::AppendOp,
128
           pybind11::return_value_policy::reference)
129 130
      .def("_prepend_op",
           &pd::BlockDesc::PrependOp,
131
           pybind11::return_value_policy::reference)
132 133
      .def("_insert_op",
           &pd::BlockDesc::InsertOp,
134
           pybind11::return_value_policy::reference)
W
Wu Yi 已提交
135
      .def("_remove_op", &pd::BlockDesc::RemoveOp)
136 137 138 139 140 141 142 143 144 145 146 147 148 149
      .def(
          "var",
          [](pd::BlockDesc &self, pybind11::bytes byte_name) {
            std::string name = byte_name;
            return self.Var(name);
          },
          pybind11::return_value_policy::reference)
      .def(
          "has_var",
          [](pd::BlockDesc &self, pybind11::bytes byte_name) {
            std::string name = byte_name;
            return self.HasVar(name);
          },
          pybind11::return_value_policy::reference)
W
Wu Yi 已提交
150
      .def("_rename_var",
151 152
           [](pd::BlockDesc &self,
              const pybind11::bytes &byte_name,
153
              const pybind11::bytes &byte_name_new) {
T
typhoonzero 已提交
154 155
             std::string name = byte_name;
             std::string new_name = byte_name_new;
T
wip  
typhoonzero 已提交
156
             self.RenameVar(name, new_name);
Q
Qiao Longfei 已提交
157
           })
F
fengjiayi 已提交
158
      .def("has_var_recursive",
159
           [](pd::BlockDesc &self, pybind11::bytes byte_name) {
F
fengjiayi 已提交
160 161 162
             std::string name = byte_name;
             return self.HasVarRecursive(name);
           })
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
      .def(
          "find_var",
          [](pd::BlockDesc &self, pybind11::bytes byte_name) {
            std::string name = byte_name;
            return self.FindVar(name);
          },
          pybind11::return_value_policy::reference)
      .def(
          "find_var_recursive",
          [](pd::BlockDesc &self, pybind11::bytes byte_name) {
            std::string name = byte_name;
            return self.FindVarRecursive(name);
          },
          pybind11::return_value_policy::reference)
      .def(
          "_remove_var",
          [](pd::BlockDesc &self, pybind11::bytes byte_name) {
            std::string name = byte_name;
            return self.RemoveVar(name);
          },
          pybind11::return_value_policy::reference)
184 185
      .def("all_vars",
           &pd::BlockDesc::AllVars,
186 187 188
           pybind11::return_value_policy::reference)
      .def("op_size", &pd::BlockDesc::OpSize)
      .def("op", &pd::BlockDesc::Op, pybind11::return_value_policy::reference)
189 190
      .def("serialize_to_string", SerializeMessage<pd::BlockDesc>)
      .def("_move_from", &pd::BlockDesc::MoveFrom);
191 192
}

193 194
void BindVarDsec(pybind11::module *m) {
  pybind11::class_<pd::VarDesc> var_desc(*m, "VarDesc", "");
W
WangZhen 已提交
195
  var_desc.def(pybind11::init<const std::string &>())
M
minqiyang 已提交
196
      .def("name", &pd::VarDesc::Name, pybind11::return_value_policy::reference)
197 198 199
      .def("set_name", &pd::VarDesc::SetName)
      .def("set_shape", &pd::VarDesc::SetShape)
      .def("set_shapes", &pd::VarDesc::SetShapes)
H
hong 已提交
200
      .def("get_shape", &pd::VarDesc::GetShape)
201 202
      .def("set_dtype", &pd::VarDesc::SetDataType)
      .def("set_dtypes", &pd::VarDesc::SetDataTypes)
203 204
      .def("shape",
           &pd::VarDesc::GetShape,
205
           pybind11::return_value_policy::reference)
206 207
      .def("shapes",
           &pd::VarDesc::GetShapes,
208
           pybind11::return_value_policy::reference)
209 210
      .def("dtype",
           &pd::VarDesc::GetDataType,
211
           pybind11::return_value_policy::reference)
212 213
      .def("element_size",
           &pd::VarDesc::ElementSize,
214
           pybind11::return_value_policy::reference)
215 216
      .def("dtypes",
           &pd::VarDesc::GetDataTypes,
217 218
           pybind11::return_value_policy::reference)
      .def("lod_level", &pd::VarDesc::GetLoDLevel)
219 220
      .def("lod_levels",
           &pd::VarDesc::GetLoDLevels,
221 222 223 224 225 226 227
           pybind11::return_value_policy::reference)
      .def("set_lod_level", &pd::VarDesc::SetLoDLevel)
      .def("set_lod_levels", &pd::VarDesc::SetLoDLevels)
      .def("type", &pd::VarDesc::GetType)
      .def("set_type", &pd::VarDesc::SetType)
      .def("serialize_to_string", SerializeMessage<pd::VarDesc>)
      .def("persistable", &pd::VarDesc::Persistable)
H
Huihuang Zheng 已提交
228
      .def("set_persistable", &pd::VarDesc::SetPersistable)
229 230 231 232 233 234 235 236
      .def("is_parameter", &pd::VarDesc::IsParameter)
      .def("set_is_parameter", &pd::VarDesc::SetIsParameter)
      .def("clear_is_parameter", &pd::VarDesc::ClearIsParameter)
      .def("has_is_parameter", &pd::VarDesc::HasIsParameter)
      .def("stop_gradient", &pd::VarDesc::StopGradient)
      .def("set_stop_gradient", &pd::VarDesc::SetStopGradient)
      .def("clear_stop_gradient", &pd::VarDesc::ClearStopGradient)
      .def("has_stop_gradient", &pd::VarDesc::HasStopGradient)
H
Huihuang Zheng 已提交
237
      .def("need_check_feed", &pd::VarDesc::NeedCheckFeed)
238 239 240 241 242
      .def("set_need_check_feed", &pd::VarDesc::SetNeedCheckFeed)
      .def("has_attr", &pd::VarDesc::HasAttr)
      .def("attr_names", &pd::VarDesc::AttrNames)
      .def("_set_attr", &pd::VarDesc::SetAttr)
      .def("remove_attr", &pd::VarDesc::RemoveAttr)
243
      .def("id", &pd::VarDesc::Id)
244 245
      .def("original_id", &pd::VarDesc::OriginalId)
      .def("set_original_id", &pd::VarDesc::SetOriginalId)
246 247 248 249
      .def_property("dist_attr",
                    &pd::VarDesc::MutableDistAttr,
                    &pd::VarDesc::SetDistAttr,
                    pybind11::return_value_policy::reference)
250
      .def("attr", &pd::VarDesc::GetAttr);
Y
Yu Yang 已提交
251

252 253 254
  pybind11::enum_<pd::proto::VarType::Type> vartype(var_desc, "VarType", "");
  g_vartype_pytype = (PyTypeObject *)vartype.ptr();  // NOLINT
  vartype.value("BOOL", pd::proto::VarType::BOOL)
255
      .value("UINT8", pd::proto::VarType::UINT8)
Q
qingqing01 已提交
256
      .value("INT8", pd::proto::VarType::INT8)
257 258 259 260 261 262
      .value("INT16", pd::proto::VarType::INT16)
      .value("INT32", pd::proto::VarType::INT32)
      .value("INT64", pd::proto::VarType::INT64)
      .value("FP16", pd::proto::VarType::FP16)
      .value("FP32", pd::proto::VarType::FP32)
      .value("FP64", pd::proto::VarType::FP64)
263
      .value("BF16", pd::proto::VarType::BF16)
264 265
      .value("COMPLEX64", pd::proto::VarType::COMPLEX64)
      .value("COMPLEX128", pd::proto::VarType::COMPLEX128)
266 267 268 269 270 271 272 273 274
      .value("LOD_TENSOR", pd::proto::VarType::LOD_TENSOR)
      .value("SELECTED_ROWS", pd::proto::VarType::SELECTED_ROWS)
      .value("FEED_MINIBATCH", pd::proto::VarType::FEED_MINIBATCH)
      .value("FETCH_LIST", pd::proto::VarType::FETCH_LIST)
      .value("STEP_SCOPES", pd::proto::VarType::STEP_SCOPES)
      .value("LOD_RANK_TABLE", pd::proto::VarType::LOD_RANK_TABLE)
      .value("LOD_TENSOR_ARRAY", pd::proto::VarType::LOD_TENSOR_ARRAY)
      .value("PLACE_LIST", pd::proto::VarType::PLACE_LIST)
      .value("READER", pd::proto::VarType::READER)
S
Steffy-zxf 已提交
275 276 277 278
      .value("RAW", pd::proto::VarType::RAW)
      .value("STRING", pd::proto::VarType::STRING)
      .value("STRINGS", pd::proto::VarType::STRINGS)
      .value("VOCAB", pd::proto::VarType::VOCAB);
279 280
}

281 282 283 284
void BindOpDesc(pybind11::module *m) {
  pybind11::enum_<pd::proto::AttrType>(*m, "AttrType", "")
      .value("INT", pd::proto::AttrType::INT)
      .value("INTS", pd::proto::AttrType::INTS)
T
tangwei12 已提交
285 286
      .value("LONG", pd::proto::AttrType::LONG)
      .value("LONGS", pd::proto::AttrType::LONGS)
287 288
      .value("FLOAT", pd::proto::AttrType::FLOAT)
      .value("FLOATS", pd::proto::AttrType::FLOATS)
289 290
      //  .value("FLOAT64", pd::proto::AttrType::FLOAT64)
      .value("FLOAT64S", pd::proto::AttrType::FLOAT64S)
291 292 293 294
      .value("STRING", pd::proto::AttrType::STRING)
      .value("STRINGS", pd::proto::AttrType::STRINGS)
      .value("BOOL", pd::proto::AttrType::BOOLEAN)
      .value("BOOLS", pd::proto::AttrType::BOOLEANS)
Y
Yancey1989 已提交
295
      .value("BLOCK", pd::proto::AttrType::BLOCK)
296 297 298
      .value("BLOCKS", pd::proto::AttrType::BLOCKS)
      .value("VAR", pd::proto::AttrType::VAR)
      .value("VARS", pd::proto::AttrType::VARS);
Y
Yu Yang 已提交
299

300
  pybind11::class_<pd::OpDesc> op_desc(*m, "OpDesc", "");
F
fengjiayi 已提交
301
  op_desc
302
      .def(
303 304
          "__init__",
          [](pd::OpDesc &self) { new (&self) pd::OpDesc(); },
305
          pybind11::return_value_policy::reference)
306 307 308
      .def("copy_from", &pd::OpDesc::CopyFrom)
      .def("type", &pd::OpDesc::Type)
      .def("set_type", &pd::OpDesc::SetType)
309 310 311 312 313 314 315 316 317 318
      .def("input",
           [](pd::OpDesc &self, const std::string &name) {
             return self.Input(name);
           })
      .def(
          "input_names",
          [](pd::OpDesc &self, bool with_attr_var) {
            return self.InputNames(with_attr_var);
          },
          py::arg("with_attr_var") = false)
319 320
      .def("output", &pd::OpDesc::Output)
      .def("output_names", &pd::OpDesc::OutputNames)
H
hong 已提交
321
      .def("set_input",
322 323
           [](pd::OpDesc &self,
              const std::string &name,
H
hong 已提交
324 325 326 327
              const std::vector<std::string> &vec_var_name) {
             self.SetInput(name, vec_var_name);
           })
      .def("set_output",
328 329
           [](pd::OpDesc &self,
              const std::string &name,
H
hong 已提交
330 331 332
              const std::vector<std::string> &vec_var_name) {
             self.SetOutput(name, vec_var_name);
           })
333
      .def("remove_output", &pd::OpDesc::RemoveOutput)
334
      .def("remove_input", &pd::OpDesc::RemoveInput)
335 336 337 338 339 340
      .def(
          "input_arg_names",
          [](pd::OpDesc &self, bool with_attr_var) {
            return self.InputArgumentNames(with_attr_var);
          },
          py::arg("with_attr_var") = false)
341
      .def("output_arg_names", &pd::OpDesc::OutputArgumentNames)
W
Wu Yi 已提交
342 343
      .def("_rename_input", &pd::OpDesc::RenameInput)
      .def("_rename_output", &pd::OpDesc::RenameOutput)
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
      .def(
          "has_attr",
          [](pd::OpDesc &self, const std::string &name, bool with_attr_var) {
            return self.HasAttr(name, with_attr_var);
          },
          py::arg("name"),
          py::arg("with_attr_var") = false)
      .def(
          "attr_type",
          [](pd::OpDesc &self, const std::string &name, bool with_attr_var) {
            return self.GetAttrType(name, with_attr_var);
          },
          py::arg("name"),
          py::arg("with_attr_var") = false)
      .def(
          "attr_names",
          [](pd::OpDesc &self, bool with_attr_var) {
            return self.AttrNames(with_attr_var);
          },
          py::arg("with_attr_var") = false)
W
Wu Yi 已提交
364
      .def("_set_attr", &pd::OpDesc::SetAttr)
365
      .def("remove_attr", &pd::OpDesc::RemoveAttr)
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
      .def("_set_bool_attr", &pd::OpDesc::SetPlainAttr<bool>)
      .def("_set_int32_attr", &pd::OpDesc::SetPlainAttr<int>)
      .def("_set_int64_attr", &pd::OpDesc::SetPlainAttr<int64_t>)
      .def("_set_float32_attr", &pd::OpDesc::SetPlainAttr<float>)
      //  .def("_set_float64_attr", &pd::OpDesc::SetPlainAttr<double>)
      .def("_set_str_attr", &pd::OpDesc::SetPlainAttr<std::string>)

      .def("_set_bools_attr", &pd::OpDesc::SetPlainAttr<std::vector<bool>>)
      .def("_set_int32s_attr", &pd::OpDesc::SetPlainAttr<std::vector<int>>)
      .def("_set_int64s_attr", &pd::OpDesc::SetPlainAttr<std::vector<int64_t>>)
      .def("_set_float32s_attr", &pd::OpDesc::SetPlainAttr<std::vector<float>>)
      .def("_set_float64s_attr", &pd::OpDesc::SetPlainAttr<std::vector<double>>)
      .def("_set_strs_attr",
           &pd::OpDesc::SetPlainAttr<std::vector<std::string>>)

381 382 383 384 385 386 387 388 389
      .def(
          "attr",
          [](pd::OpDesc &self, const std::string &name, bool with_attr_var) {
            return self.GetAttr(name, with_attr_var);
          },
          py::arg("name"),
          py::arg("with_attr_var") = false)
      .def("set_var_attr", &pd::OpDesc::SetVarAttr)
      .def("set_vars_attr", &pd::OpDesc::SetVarsAttr)
390
      .def("set_block_attr", &pd::OpDesc::SetBlockAttr)
391
      .def("set_blocks_attr", &pd::OpDesc::SetBlocksAttr)
T
typhoonzero 已提交
392
      .def("set_serialized_attr",
393 394
           [](pd::OpDesc &self,
              const std::string &name,
395
              const pybind11::bytes &seriralized) {
T
typhoonzero 已提交
396 397 398
             std::string ser(seriralized);
             self.SetAttr(name, ser);
           })
W
Wu Yi 已提交
399 400
      .def("_block_attr_id", &pd::OpDesc::GetBlockAttrId)
      .def("_blocks_attr_ids", &pd::OpDesc::GetBlocksAttrIds)
401 402 403
      .def("check_attrs", &pd::OpDesc::CheckAttrs)
      .def("infer_shape", &pd::OpDesc::InferShape)
      .def("infer_var_type", &pd::OpDesc::InferVarType)
404
      .def("set_is_target", &pd::OpDesc::SetIsTarget)
405
      .def("serialize_to_string", SerializeMessage<pd::OpDesc>)
406
      .def(
407 408
          "block",
          [](pd::OpDesc &self) { return self.Block(); },
409
          pybind11::return_value_policy::reference)
410
      .def("id", &pd::OpDesc::Id)
411 412
      .def("original_id", &pd::OpDesc::OriginalId)
      .def("set_original_id", &pd::OpDesc::SetOriginalId)
413 414 415 416
      .def_property("dist_attr",
                    &pd::OpDesc::MutableDistAttr,
                    &pd::OpDesc::SetDistAttr,
                    pybind11::return_value_policy::reference)
417
      .def("inputs", [](pd::OpDesc &self) { return self.Inputs(); })
418
      .def("outputs", &pd::OpDesc::Outputs);
419
}
Y
Yu Yang 已提交
420

421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
// Serialize Class Property
void BindJitProperty(pybind11::module *m) {
  pybind11::class_<jit::Property> property(*m, "Property");
  property
      .def(
          "__init__",
          [](jit::Property &self) { new (&self) jit::Property(); },
          pybind11::return_value_policy::reference)
      .def("size", &jit::Property::Size)
      .def("set_float",
           py::overload_cast<const std::string &, const float &>(
               &jit::Property::SetFloat),
           "set float",
           py::arg("name"),
           py::arg("var"))
      .def("get_float",
           py::overload_cast<const int &>(&jit::Property::GetFloat, py::const_))
      .def("get_float",
           py::overload_cast<const std::string &>(&jit::Property::GetFloat,
                                                  py::const_))
      .def("set_floats",
           py::overload_cast<const std::string &, const std::vector<float> &>(
               &jit::Property::SetFloats),
           "set list of float",
           py::arg("name"),
           py::arg("val"))
      .def("set_int",
           py::overload_cast<const std::string &, const int64_t &>(
               &jit::Property::SetInt64),
           "set int",
           py::arg("name"),
           py::arg("val"))
      .def("set_ints",
           py::overload_cast<const std::string &, const std::vector<int64_t> &>(
               &jit::Property::SetInt64s),
           "set list of int",
           py::arg("name"),
           py::arg("val"))
      .def("set_string",
           py::overload_cast<const std::string &, const std::string &>(
               &jit::Property::SetString),
           "set string",
           py::arg("name"),
           py::arg("val"))
      .def("set_strings",
           py::overload_cast<const std::string &,
                             const std::vector<std::string> &>(
               &jit::Property::SetStrings),
           "set list of string",
           py::arg("name"),
           py::arg("val"))
      .def("serialize_to_string", SerializeMessage<jit::Property>)
      .def("parse_from_string", DeserializeMessage<jit::Property>);
}

476
}  // namespace pybind
477
}  // namespace paddle