- paddle.fluid.layers.io. double_buffer ( reader, place=None, name=None )
Wrap a double buffer reader. The class Reader contains DecoratedReader and FileReader. Moreover, the DecoratedReader is inherited by CustomReader and BufferedReader. This function is related to BufferedReader. The data will copy to target place with a double buffer queue. If the target place is None, the place that executor perform on will be used.
reader (Variable) – The Reader Variable need to be wrapped.
place (Place|str, optional) – The place of target data, such as CPU, GPU, and if use GPU, it’s necessary to point out which card is involved. Default is the sample place of executor perform. if
placeis string, It can be
xis the ndex of the GPUs.
name (str, optional) – Variable name. Normally there is no need for user to set this property. For more information, please refer to Name. Default is None.
wrapped reader with double buffer.
- Return type
import paddle.fluid as fluid reader = fluid.layers.py_reader(capacity=64, shapes=[(-1, 1, 28, 28), (-1, 1)], dtypes=['float32', 'int64'], use_double_buffer=False) reader = fluid.layers.double_buffer(reader) image, label = fluid.layers.read_file(reader)