1

I tried to replicate the solution posted here with tf.data.Dataset.interleave, but not quite sure how to apply the interleave method to already created dataset objects. here is the code:

import tensorflow as tf
import numpy as np

# preparing data
train, test = tf.keras.datasets.fashion_mnist.load_data()
images, labels = train
images = images/255

dataset = tf.data.Dataset.from_tensor_slices((images, labels))

class0=lambda features, label: label==0
class1=lambda features, label: label==1
class2=lambda features, label: label==2

ds_0=dataset.filter(class0)
ds_1=dataset.filter(class1)
ds_2=dataset.filter(class2)

I want to create a dataset by equally sampled from the ds_0, ds_1, and ds_2. what should I pass as map_func?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.