def _wrap_method(cls, attr):
fn = getattr(cls, attr)<EOL>is_property = isinstance(fn, property)<EOL>if is_property:<EOL><INDENT>fn = fn.fget<EOL><DEDENT>@functools.wraps(fn)<EOL>def wrapped(self, *args, **kwargs):<EOL><INDENT>return fn(self._value(), *args, **kwargs)  <EOL><DEDENT>return property(wrapped) if is_property else wrapped<EOL>
Replaces member function's first arg, `self`, to `self._value()`.

    This function is used by `_get_tensor_like_attributes` to take existing
    `Tensor` member functions and make them operate on `self._value()`, i.e., the
    concretization of a `Distribution`.

    Args:
      cls: The `class` from which we will look up the `attr`.
      attr: Python `str` representing the `attr` to inject a new notion of `self`.

    Returns:
      dependency_injected_function: Python `callable` (or `property`)
        corresponding to `cls.attr` with `self` replaced as `self._value()`.