xmap_readers

paddle.fluid.io.xmap_readers(mapper, reader, process_num, buffer_size, order=False)[source]

Use multi-threads to map samples from reader by a mapper defined by user.

Parameters
  • mapper (callable) – a function to map the data from reader.

  • reader (callable) – a data reader which yields the data.

  • process_num (int) – thread number to handle original sample.

  • buffer_size (int) – size of the queue to read data in.

  • order (bool) – whether to keep the data order from original reader. Default False.

Returns

a decorated reader with data mapping.

Return type

callable