def nudge_images(X, y):
    shift = (lambda x: ndimage.shift(x.reshape((8, 8)), (0.3 * np.random.normal(size=2)), mode='constant').ravel())
    X = np.concatenate([X, np.apply_along_axis(shift, 1, X)])
    Y = np.concatenate([y, y], axis=0)
    return (X, Y)
def nudge_images(X, y):
    shift = (lambda x: ndimage.shift(x.reshape((8, 8)), (0.3 * np.random.normal(size=2)), mode='constant').ravel())
    X = np.concatenate([X, np.apply_along_axis(shift, 1, X)])
    Y = np.concatenate([y, y], axis=0)
    return (X, Y)