MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / def_rendezvous

Function def_rendezvous

imperative/python/src/graph_rt.cpp:53–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52template <typename T>
53auto def_rendezvous(py::object m, const char* name) {
54 return py::class_<Rendezvous<T>, std::shared_ptr<Rendezvous<T>>>(m, name)
55 .def(py::init([]() { return Rendezvous<T>::make(); }))
56 .def("set", [](Rendezvous<T>& r, T v) { r.set(std::move(v)); })
57 .def(
58 "get", [](Rendezvous<T>& r) { return r.get(); },
59 py::call_guard<py::gil_scoped_release>())
60 .def("drop", &Rendezvous<T>::drop)
61 .def("reset", &Rendezvous<T>::reset)
62 .def("set_exception", [](Rendezvous<T>& r, std::string&& message) {
63 r.set_exception(std::make_exception_ptr(
64 std::runtime_error(std::move(message))));
65 });
66}
67
68using TensorAttr = LogicalTensorDesc;
69using HostNDWithEvent = std::pair<HostTensorND, std::shared_ptr<CompNode::Event>>;

Callers

nothing calls this directly

Calls 5

initFunction · 0.50
makeFunction · 0.50
setMethod · 0.45
getMethod · 0.45
set_exceptionMethod · 0.45

Tested by

no test coverage detected