code: def __init__(
      self,
      ofrecord_root: str = "./ofrecord",
      mode: str = "train",  # "val"
      dataset_size: int = 9469,
      batch_size: int = 1,
      total_batch_size: int = 1,
      data_part_num: int = 8,
      placement: flow.placement = None,
      sbp: Union[flow.sbp.sbp, List[flow.sbp.sbp]] = None,
  ):
      super().__init__()
      channel_last = False
      output_layout = "NHWC" if channel_last else "NCHW"
      assert (ofrecord_root, mode)
      self.train_record_reader = flow.nn.OfrecordReader(
          os.path.join(ofrecord_root, mode),
          batch_size=batch_size,
          data_part_num=data_part_num,
          part_name_suffix_length=5,
          random_shuffle=True if mode == "train" else False,
          shuffle_after_epoch=True if mode == "train" else False,
          placement=placement,
          sbp=sbp,
      )
      self.record_label_decoder = flow.nn.OfrecordRawDecoder(
          "label", shape=(), dtype=flow.int32
      )
  
      color_space = "RGB"
      height = 112
      width = 112
  
      self.record_image_decoder = flow.nn.OFRecordImageDecoder(
          "encoded", color_space=color_space
      )
      self.resize = (
          flow.nn.image.Resize(target_size=[height, width])
          if mode == "train"
          else flow.nn.image.Resize(
              resize_side="shorter",
              keep_aspect_ratio=True,
              target_size=112,
          )
      )
  
      self.flip = (
          flow.nn.CoinFlip(
              batch_size=batch_size, placement=placement, sbp=sbp
          )
          if mode == "train"
          else None
      )
  
      rgb_mean = [127.5, 127.5, 127.5]
      rgb_std = [127.5, 127.5, 127.5]
      self.crop_mirror_norm = (
          flow.nn.CropMirrorNormalize(
              color_space=color_space,
              output_layout=output_layout,
              mean=rgb_mean,
              std=rgb_std,
              output_dtype=flow.float,
          )
          if mode == "train"
          else flow.nn.CropMirrorNormalize(
              color_space=color_space,
              output_layout=output_layout,
              crop_h=0,
              crop_w=0,
              crop_pos_y=0.5,
              crop_pos_x=0.5,
              mean=rgb_mean,
              std=rgb_std,
              output_dtype=flow.float,
          )
      )
  
      self.batch_size = batch_size
      self.total_batch_size = total_batch_size
      self.dataset_size = dataset_size
  
file_path: insightface/recognition/arcface_oneflow/utils/ofrecord_data_utils.py
imports: import oneflow
  import oneflow.nn
  import os
  from typing import List, Union
label_desc: Use image node_id 1 to create a new OFRecordDataLoader object from inherited base classes: nn with example: obj = OFRecordDataLoader(ofrecord_root, mode, dataset_size, batch_size, total_batch_size, data_part_num, placement, sbp)