import torch


def _relu_3_ramp(x):
    """ Relu(x) ** 3 ramp function
        returns

            f(x)     = relu(x) ** 3
            df/dx(x) = relu(x) ** 2
    """
    rx = torch.relu(x)
    ramp = rx.pow(3)
    grad = rx.pow(2) * 3.0
    return ramp, grad