def hessian_times_vector(gradient, parameter, vector, r_op=False):
 if r_op:
  return tensor.Rop(gradient, parameter, vector)
 return tensor.grad(tensor.sum((gradient * vector)), parameter)

def hessian_times_vector ( gradient , parameter , vector , r_op = False ) : if r_op : return tensor . Rop ( gradient , parameter , vector ) return tensor . grad ( tensor . sum ( ( gradient * vector ) ) , parameter )
return an expression for the hessian times a vector .