class_docstr: Randomly flips an image horizontally (left to right).
class_docstr_tok: ["Randomly","flips","an","image","horizontally","(","left","to","right",")","."]
code: def apply_boxes(
      self,
      boxes: tf.Tensor,
      *,
      image_size: transforms.SizeTuple,
      seed: tf.Tensor,
  ) -> tf.Tensor:
      del image_size
      y_min, x_min, y_max, x_max = tf.split(boxes, 4, axis=-1)
      # To flip the boxes, swap the x coordinates and subtract them from 1:
      x_min, x_max = 1.0 - x_max, 1.0 - x_min
      flipped_boxes = tf.concat([y_min, x_min, y_max, x_max], axis=-1)
      return tf.cond(
          _stateless_bernoulli_trial(seed, p=0.5),
          lambda: tf.identity(boxes),
          lambda: flipped_boxes,
      )
  
imports: import abc
  import dataclasses
  from typing import Optional, Sequence, Tuple, Union
  from clu import preprocess_spec
  from scenic.projects.owl_vit.preprocessing import modalities
  from scenic.projects.owl_vit.preprocessing import transforms
  import tensorflow
label_desc: Use image node_id 2 for calling the RandomFlipLeftRight obj's underlying member method code with example usage: obj.apply_boxes(boxes) and returns: tf