def distort_image(image, thread_id):
<EOL>with tf.name_scope("<STR_LIT>"):  <EOL><INDENT>image = tf.image.random_flip_left_right(image)<EOL><DEDENT>color_ordering = thread_id % <NUM_LIT:2><EOL>with tf.name_scope("<STR_LIT>"):  <EOL><INDENT>if color_ordering == <NUM_LIT:0>:<EOL><INDENT>image = tf.image.random_brightness(image, max_delta=<NUM_LIT> / <NUM_LIT>)<EOL>image = tf.image.random_saturation(image, lower=<NUM_LIT:0.5>, upper=<NUM_LIT>)<EOL>image = tf.image.random_hue(image, max_delta=<NUM_LIT>)<EOL>image = tf.image.random_contrast(image, lower=<NUM_LIT:0.5>, upper=<NUM_LIT>)<EOL><DEDENT>elif color_ordering == <NUM_LIT:1>:<EOL><INDENT>image = tf.image.random_brightness(image, max_delta=<NUM_LIT> / <NUM_LIT>)<EOL>image = tf.image.random_contrast(image, lower=<NUM_LIT:0.5>, upper=<NUM_LIT>)<EOL>image = tf.image.random_saturation(image, lower=<NUM_LIT:0.5>, upper=<NUM_LIT>)<EOL>image = tf.image.random_hue(image, max_delta=<NUM_LIT>)<EOL><DEDENT>image = tf.clip_by_value(image, <NUM_LIT:0.0>, <NUM_LIT:1.0>)<EOL><DEDENT>return image<EOL>
Perform random distortions on an image.
    Args:
        image: A float32 Tensor of shape [height, width, 3] with values in [0, 1).
        thread_id: Preprocessing thread id used to select the ordering of color
        distortions. There should be a multiple of 2 preprocessing threads.
    Returns:````
        distorted_image: A float32 Tensor of shape [height, width, 3] with values in
        [0, 1].