def METHOD_NAME(values):
    constructor = grad.new
    if grad_indices.dim() == 0 or values.dim() == 0:
        return constructor().resize_as_(grad)
    return constructor(grad_indices, values, size)