import tensorflow as tf

        n_row,n_col,n_channel = x.shape
        n_patch = n_row*n_col // (self.size**2)
        patches = tf.image.extract_patches(tf.expand_dims(x,0),sizes=[1,self.size,self.size,1],strides=[1,self.size,self.size,1],rates=[1, 1, 1, 1],padding='VALID')
        patches = tf.reshape(patches,[n_patch,self.size,self.size,n_channel])
        patches = tf.random.shuffle(patches)
        # rand_idx = tf.reshape(tf.random.shuffle(tf.range(0,n_patch)),[n_patch])
