def infer_from_dataset(self, program=None, dataset=None, scope=None, thread=0, debug=False, fetch_list=None, fetch_info=None, print_period=100):
    '\n        The document of infer_from_dataset is almost the same as\n        train_from_dataset, except that in distributed training,\n        push gradients will be disabled in infer_from_dataset.\n        infer_from_dataset() can be used for evaluation in multi-thread\n        very easily.\n\n        Args:\n            program(Program|CompiledProgram): the program that needs to be run,\n               if not provided, then default_main_program (not compiled) will be used.\n            dataset(paddle.fluid.Dataset): dataset created outside this function,\n               a user should provide a well-defined dataset before calling this function.\n               Please check the document of Dataset if needed. default is None\n            scope(Scope): the scope used to run this program, you can switch it to different scope\n               for each run. default is global_scope\n            thread(int): number of thread a user wants to run in this function. The actual number\n               of thread will be min(Dataset.thread_num, thread) if thread > 0, default is 0\n            debug(bool): whether a user wants to run infer_from_dataset, default is False\n            fetch_list(Variable List): fetch variable list, each variable\n                                       will be printed during training, default is None\n            fetch_info(String List): print information for each variable, default is None\n            print_period(int): the number of mini-batches for each print, default is 100\n\n        Returns:\n            None\n\n        Examples:\n\n            .. code-block:: python\n\n                import paddle.fluid as fluid\n\n                place = fluid.CPUPlace() # you can set place = fluid.CUDAPlace(0) to use gpu\n                exe = fluid.Executor(place)\n                x = fluid.layers.data(name="x", shape=[10, 10], dtype="int64")\n                y = fluid.layers.data(name="y", shape=[1], dtype="int64", lod_level=1)\n                dataset = fluid.DatasetFactory().create_dataset()\n                dataset.set_use_var([x, y])\n                dataset.set_thread(1)\n                filelist = [] # you should set your own filelist, e.g. filelist = ["dataA.txt"]\n                dataset.set_filelist(filelist)\n                exe.run(fluid.default_startup_program())\n                exe.infer_from_dataset(program=fluid.default_main_program(),\n                                       dataset=dataset)        \n\n        '
    if (dataset == None):
        raise RuntimeError('dataset is needed and should be initialized')
    dataset._prepare_to_run()
    (scope, trainer) = self._prepare_trainer(program=program, dataset=dataset, scope=scope, thread=thread, debug=debug, fetch_list=fetch_list, fetch_info=fetch_info, print_period=print_period)
    trainer._set_infer(True)
    trainer._gen_trainer_desc()
    self._dump_debug_info(program=program, trainer=trainer)
    self._default_executor.run_from_dataset(program.desc, scope, dataset.dataset, trainer._desc())
    dataset._finish_to_run()
    return None
The document of infer_from_dataset is almost the same as
train_from_dataset, except that in distributed training,
push gradients will be disabled in infer_from_dataset.
infer_from_dataset() can be used for evaluation in multi-thread
very easily.

Args:
    program(Program|CompiledProgram): the program that needs to be run,
       if not provided, then default_main_program (not compiled) will be used.
    dataset(paddle.fluid.Dataset): dataset created outside this function,
       a user should provide a well-defined dataset before calling this function.
       Please check the document of Dataset if needed. default is None
    scope(Scope): the scope used to run this program, you can switch it to different scope
       for each run. default is global_scope
    thread(int): number of thread a user wants to run in this function. The actual number
       of thread will be min(Dataset.thread_num, thread) if thread > 0, default is 0
    debug(bool): whether a user wants to run infer_from_dataset, default is False
    fetch_list(Variable List): fetch variable list, each variable
                               will be printed during training, default is None
    fetch_info(String List): print information for each variable, default is None
    print_period(int): the number of mini-batches for each print, default is 100

Returns:
    None

Examples:

    .. code-block:: python

        import paddle.fluid as fluid

        place = fluid.CPUPlace() # you can set place = fluid.CUDAPlace(0) to use gpu
        exe = fluid.Executor(place)
        x = fluid.layers.data(name="x", shape=[10, 10], dtype="int64")
        y = fluid.layers.data(name="y", shape=[1], dtype="int64", lod_level=1)
        dataset = fluid.DatasetFactory().create_dataset()
        dataset.set_use_var([x, y])
        dataset.set_thread(1)
        filelist = [] # you should set your own filelist, e.g. filelist = ["dataA.txt"]
        dataset.set_filelist(filelist)
        exe.run(fluid.default_startup_program())
        exe.infer_from_dataset(program=fluid.default_main_program(),
                               dataset=dataset)
def infer_from_dataset(self, program=None, dataset=None, scope=None, thread=0, debug=False, fetch_list=None, fetch_info=None, print_period=100):
    '\n        The document of infer_from_dataset is almost the same as\n        train_from_dataset, except that in distributed training,\n        push gradients will be disabled in infer_from_dataset.\n        infer_from_dataset() can be used for evaluation in multi-thread\n        very easily.\n\n        Args:\n            program(Program|CompiledProgram): the program that needs to be run,\n               if not provided, then default_main_program (not compiled) will be used.\n            dataset(paddle.fluid.Dataset): dataset created outside this function,\n               a user should provide a well-defined dataset before calling this function.\n               Please check the document of Dataset if needed. default is None\n            scope(Scope): the scope used to run this program, you can switch it to different scope\n               for each run. default is global_scope\n            thread(int): number of thread a user wants to run in this function. The actual number\n               of thread will be min(Dataset.thread_num, thread) if thread > 0, default is 0\n            debug(bool): whether a user wants to run infer_from_dataset, default is False\n            fetch_list(Variable List): fetch variable list, each variable\n                                       will be printed during training, default is None\n            fetch_info(String List): print information for each variable, default is None\n            print_period(int): the number of mini-batches for each print, default is 100\n\n        Returns:\n            None\n\n        Examples:\n\n            .. code-block:: python\n\n                import paddle.fluid as fluid\n\n                place = fluid.CPUPlace() # you can set place = fluid.CUDAPlace(0) to use gpu\n                exe = fluid.Executor(place)\n                x = fluid.layers.data(name="x", shape=[10, 10], dtype="int64")\n                y = fluid.layers.data(name="y", shape=[1], dtype="int64", lod_level=1)\n                dataset = fluid.DatasetFactory().create_dataset()\n                dataset.set_use_var([x, y])\n                dataset.set_thread(1)\n                filelist = [] # you should set your own filelist, e.g. filelist = ["dataA.txt"]\n                dataset.set_filelist(filelist)\n                exe.run(fluid.default_startup_program())\n                exe.infer_from_dataset(program=fluid.default_main_program(),\n                                       dataset=dataset)        \n\n        '
    if (dataset == None):
        raise RuntimeError('dataset is needed and should be initialized')
    dataset._prepare_to_run()
    (scope, trainer) = self._prepare_trainer(program=program, dataset=dataset, scope=scope, thread=thread, debug=debug, fetch_list=fetch_list, fetch_info=fetch_info, print_period=print_period)
    trainer._set_infer(True)
    trainer._gen_trainer_desc()
    self._dump_debug_info(program=program, trainer=trainer)
    self._default_executor.run_from_dataset(program.desc, scope, dataset.dataset, trainer._desc())
    dataset._finish_to_run()
    return None