diff --git a/tensorflow/python/eager/backprop.py b/tensorflow/python/eager/backprop.py index 4915a5b8fe3..be121bf135e 100644 --- a/tensorflow/python/eager/backprop.py +++ b/tensorflow/python/eager/backprop.py @@ -848,10 +848,6 @@ class GradientTape(object): self._watch_accessed_variables = watch_accessed_variables self._watched_variables = () self._recording = False - self._created_eagerly = context.executing_eagerly() - if self._created_eagerly: - context.ensure_initialized() - context.context().start_step() def __enter__(self): """Enters a context inside which operations are recorded on this tape.""" @@ -882,15 +878,6 @@ class GradientTape(object): tape.pop_tape(self._tape) self._recording = False - def __del__(self): - if self._created_eagerly: - try: - context.context().end_step() - except AttributeError: - pass - except TypeError: - pass - def watch(self, tensor): """Ensures that `tensor` is being traced by this tape. diff --git a/tensorflow/python/eager/context.py b/tensorflow/python/eager/context.py index 56541584c0c..046a09f9638 100644 --- a/tensorflow/python/eager/context.py +++ b/tensorflow/python/eager/context.py @@ -1742,12 +1742,6 @@ class Context(object): """Returns a stack of context switches.""" return self._context_switches - def start_step(self): - pywrap_tfe.TFE_ContextStartStep(self._handle) - - def end_step(self): - pywrap_tfe.TFE_ContextEndStep(self._handle) - class _EagerDeviceContext(object): """Context-manager forcing placement of ops and Tensors on a device.""" diff --git a/tensorflow/python/tfe_wrapper.cc b/tensorflow/python/tfe_wrapper.cc index b694ab9683b..9db8ed1c2ab 100644 --- a/tensorflow/python/tfe_wrapper.cc +++ b/tensorflow/python/tfe_wrapper.cc @@ -1030,12 +1030,6 @@ PYBIND11_MODULE(_pywrap_tfe, m) { m.def("TFE_Py_SetEagerContext", [](const py::handle& o) { return tensorflow::PyoOrThrow(TFE_Py_SetEagerContext(o.ptr())); }); - m.def("TFE_ContextStartStep", [](py::handle& o) { - TFE_ContextStartStep(tensorflow::InputTFE_Context(o.ptr())); - }); - m.def("TFE_ContextEndStep", [](py::handle& o) { - TFE_ContextEndStep(tensorflow::InputTFE_Context(o.ptr())); - }); m.def("TFE_Py_RegisterVSpace", [](const py::handle& o) { return tensorflow::PyoOrThrow(TFE_Py_RegisterVSpace(o.ptr())); });