'get autodiff grads from numpy string expression
tensors: numpy tensor vals'

def _get_numerical_grads_and_val(self, f_str, tensors, next_error=None):

    gradients = []
    for tensor in tensors:
        gradients.append(np.zeros(tensor.shape))
    f_val = TestAutodiff._numpy_call(f_str, tensors)
    if (next_error is None):
        next_error = np.ones_like(f_val)
    for (tensor, gradient) in zip(tensors, gradients):
        gradient_flat = np.copy(gradient.reshape(((-1),)))
        ind = 0
        for x in np.nditer(tensor, op_flags=['readwrite']):
            x_backup = np.copy(x)
            x[...] = (x + self.delta)
            f_inc = np.sum((TestAutodiff._numpy_call(f_str, tensors) * next_error))
            x[...] = x_backup
            x[...] = (x - self.delta)
            f_dec = np.sum((TestAutodiff._numpy_call(f_str, tensors) * next_error))
            x[...] = x_backup
            gradient_flat[ind] = ((f_inc - f_dec) / (2.0 * self.delta))
            ind += 1
        gradient[:] = gradient_flat.reshape(gradient.shape)
    return [gradients, f_val]
