Commit 325e579a authored by Philipp  Trunschke's avatar Philipp Trunschke
Browse files

make TTOperator picklable

parent 9c39279d
Pipeline #2152 failed with stages
in 4 minutes and 16 seconds
......@@ -79,6 +79,14 @@ void expose_ttnetwork(module& m) {
m.def("dyadic_product", static_cast<TTTensor (*)(const std::vector<TTTensor> &)>(&dyadic_product));
class_<TTOperator, TensorNetwork>(m, "TTOperator")
.def(pickle(
[](const TTTensor &_self) { // __getstate__
return bytes(misc::serialize(_self));
},
[](bytes _bytes) { // __setstate__
return misc::deserialize<TTTensor>(_bytes);
}
))
.def(init<const Tensor&>())
.def(init<const Tensor&, value_t>())
.def(init<const Tensor&, value_t, size_t>())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment