Hello,
I am trying to replicate the approach to create a VAE as described here 2.
However, I don’t understand the following piece of code and how to translate it from images (as per example) to the data I have, which is a big csv file with lots of columns and rows.
def _preprocess(sample):
  image = tf.cast(sample['image'], tf.float32) / 255.  # Scale to unit interval.
  image = image < tf.random.uniform(tf.shape(image))   # Randomly binarize.
  return image, image

train_dataset = (datasets['train']
                 .map(_preprocess)
                 .batch(256)
                 .prefetch(tf.data.AUTOTUNE)
                 .shuffle(int(10e3)))
eval_dataset = (datasets['test']
                .map(_preprocess)
                .batch(256)
                .prefetch(tf.data.AUTOTUNE))

I don’t understand what the _preprocess function is exactly doing and why this is required for the model to work. This prevents me to adapt this solution for my csv dataset.
I hope this is the correct category to ask for help.