def sg_inject_func(func):
    """Converts the function `func` to a sugar function
    so that it can be used in a chainable manner.

    Args:
      func: A function to inject.

    Returns:
      None
    """
    exec('tf.Variable.%s = func' % func.__name__)
    exec('tf.Tensor.%s = func' % func.__name__)
