see the description of the dataset tensorflow code example
Example: tf.data.Dataset select files with labels filter
dataset = train_data.filter(lambda x,y: tf.reduce_all(tf.not_equal(y, [0,1,2]))).batch(200)
dataset = train_data.filter(lambda x,y: tf.reduce_all(tf.not_equal(y, [0,1,2]))).batch(200)