[Memorize] Add python binding for Memorize
Context
This MR simply adds the Python binding for the Memorize_Op
class and the Memorize()
factory function.
Detailed modifications
Added:
-
pybind_Memorize.cpp
: the binding initialization function
Updated:
-
pybind_core.cpp
: call the initialization function -
Memorize.hpp
: changed inheritedRegistrable
template type to...std::shared_ptr<OperatorImpl>...
instead of...std::unique_ptr<OperatorImpl>...
. See questions below.
Questions to reviewers
I changed the inheritance of Memorize_Op
in Memorize.hpp
to Registrable<Memorize_Op, ..., std::shared_ptr<OperatorImpl>...)
, i.e. a shared_ptr
instead of a unique_ptr
, as it is what I observed for the other python binded operators.
Without this change it is not possible to compile the declare_registrable<Memorize_Op>(m, "MemorizeOp")
call due to type conflicts within the Registrable
templates.
Though, actually I do not understand the implications, can you clarify please?
OK, see answer below.
TODO
-
Should we inherit from Registrable<Memorize_Op, ..., std::shared_ptr<OperatorImpl>...)
or leave as it was:Registrable<Memorize_Op, ..., std::unique_ptr<OperatorImpl>...)
? Yes, see answer below
Edited by Christophe Guillon