Let pybind handle deletion of cancellation managers
PiperOrigin-RevId: 355403635 Change-Id: I062d302af282e3f03c369292fffa891e54e254b2
This commit is contained in:
parent
bcc6c99c90
commit
3ef35ee4b3
@ -41,6 +41,3 @@ class CancellationManager(object):
|
||||
def get_cancelable_function(self, concrete_function):
|
||||
# pylint: disable=protected-access
|
||||
return concrete_function._experimental_with_cancellation_manager(self)
|
||||
|
||||
def __del__(self):
|
||||
pywrap_tfe.TFE_DeleteCancellationManager(self._impl)
|
||||
|
@ -1354,16 +1354,12 @@ PYBIND11_MODULE(_pywrap_tfe, m) {
|
||||
py::return_value_policy::reference);
|
||||
|
||||
// TFE_CancellationManager Logic
|
||||
m.def(
|
||||
"TFE_NewCancellationManager",
|
||||
[]() { return new tensorflow::CancellationManager(); },
|
||||
py::return_value_policy::reference);
|
||||
m.def("TFE_NewCancellationManager",
|
||||
[]() { return new tensorflow::CancellationManager(); });
|
||||
m.def("TFE_CancellationManagerIsCancelled",
|
||||
&tensorflow::CancellationManager::IsCancelled);
|
||||
m.def("TFE_CancellationManagerStartCancel",
|
||||
&tensorflow::CancellationManager::StartCancel);
|
||||
m.def("TFE_DeleteCancellationManager",
|
||||
[](tensorflow::CancellationManager* cm) { delete cm; });
|
||||
|
||||
m.def("TFE_ClearScalarCache", &tensorflow::TFE_ClearScalarCache);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user