def value_and_grad(fun, argnum=0):
    def double_val_fun(*args, **kwargs):
        val = fun(*args, **kwargs)
        return val, getval(val)
    gradval_and_val = grad_and_aux(double_val_fun, argnum)
    flip = lambda x, y: (y, x)
    return lambda *args, **kwargs: flip(*gradval_and_val(*args, **kwargs))
**SUMMARY**
dataset/ETHPy150Open HIPS/autograd/autograd/convenience_wrappers.py/value_and_grad--crossover with--dataset/ETHPy150Open sightmachine/SimpleCV/SimpleCV/LineScan.py/LineScan.applyLUT