message: Manually pass `self` to converted functions, which are as of yet come back unbound after conversion.
diff: @@ -35,6 +35,7 @@ from tensorflow.python.ops import variable_scope
  from tensorflow.python.util import compat
  from tensorflow.python.util import nest
  from tensorflow.python.util import tf_decorator
  +from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.lazy_loader import LazyLoader
  # This is to avoid a circular dependency:
  @@ -390,6 +391,16 @@ def func_graph_from_py_func(name,
  if experimental_autograph:
  from tensorflow.python import autograph # pylint: disable=g-import-not-at-top
  _, original_func = tf_decorator.unwrap(python_func)
  +
  + # AutoGraph does not yet rebind the returned method, and must receive
  + # `self` explicitly.
  + # TODO(mdan): Have the result automatically bind it instead.
  + if (tf_inspect.ismethod(original_func) and
  + hasattr(original_func, "__self__")):
  + effective_func_args = (original_func.__self__,) + func_args
  + else:
  + effective_func_args = func_args
  +
  func_outputs = autograph.converted_call(
  original_func, None,
  autograph.ConversionOptions(
  @@ -397,7 +408,7 @@ def func_graph_from_py_func(name,
  recursive=True,
  strip_decorators=(function.defun, def_function.function),
  optional_features=(),
  - ), *func_args, **func_kwargs)
  + ), *effective_func_args, **func_kwargs)
  else:
  func_outputs = python_func(*func_args, **func_kwargs)
  # invariant: `func_outputs` contains only Tensors and `None`s.
  