import tensorflow as tf

FLIPPING_TENSOR = tf.constant([1.0, -1.0, 1.0])

@tf.function
def sample_data(points, labels, num_point):
    if tf.random.uniform(shape=()) >= 0.5:
        return points * FLIPPING_TENSOR, labels

    return points, labels


mock_data = tf.constant([
    [1., 2., 3.],
    [4., 5., 6.],
    [7., 8., 9.]
])

mock_labels = tf.constant([
    [1.], [0.], [1.]
])

sampling_lambda = lambda x, y: sample_data(x, y, 512)

train_data = tf.data.Dataset.from_tensors((mock_data, mock_labels)) \
    .map(sampling_lambda) \
    .unbatch() \
    .batch(1) \
    .repeat(5)

for x, y in train_data:
    print(x)
[((3, 18, 3, 47), 'tensorflow.constant', 'tf.constant', ({(3, 30, 3, 46): '[1.0, -1.0, 1.0]'}, {}), '([1.0, -1.0, 1.0])', True, 'import tensorflow as tf\n'), ((13, 12, 17, 2), 'tensorflow.constant', 'tf.constant', ({(13, 24, 17, 1): '[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]'}, {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]])', True, 'import tensorflow as tf\n'), ((19, 14, 21, 2), 'tensorflow.constant', 'tf.constant', ({(19, 26, 21, 1): '[[1.0], [0.0], [1.0]]'}, {}), '([[1.0], [0.0], [1.0]])', True, 'import tensorflow as tf\n'), ((7, 7, 7, 34), 'tensorflow.random.uniform', 'tf.random.uniform', (), '', True, 'import tensorflow as tf\n'), ((25, 13, 25, 67), 'tensorflow.data.Dataset.from_tensors', 'tf.data.Dataset.from_tensors', ({(25, 42, 25, 66): '(mock_data, mock_labels)'}, {}), '((mock_data, mock_labels))', True, 'import tensorflow as tf\n')]