executor.run的fetch_list如果直接给Variable。运行会hang住。
Created by: Meiyim
executor.run的fetch_list如果没有指定python list,而是Variable。运行会hang住。用户体验很奇怪。建议给这个函数(包括其他paddle的API)加上更完善的参数类型检查。
另外加一个 feature_request: 希望fetch_list时候能支持 dict, list, tuple, namedtuple, list of dict等复杂结构。参考tf.Session.run的fetches参数。
- 问题描述:请详细描述您的问题,同步贴出报错信息、日志、可复现的代码片段
import numpy as np
import multiprocessing as mp
import paddle
import paddle.fluid as F
import paddle.fluid.layers as L
from time import sleep
train_program = F.Program()
startup_prog = F.Program()
with F.program_guard(train_program, startup_prog):
with F.unique_name.guard():
inputs = L.data(name='in', shape=[-1, 10], dtype='int64')
loss = inputs + 1
place = F.CUDAPlace(0)
start_exe = F.Executor(place)
train_exe = F.Executor(place)
start_exe.run(startup_prog)
print(paddle.__version__)
for _ in range(10):
print(train_exe.run(train_program, fetch_list=loss, feed={inputs.name: np.ones([3,10], dtype=np.int64)}))
output:
W0507 15:32:50.906225 226435 device_context.cc:261] Please NOTE: device: 0, CUDA Capability: 61, Driver API Version: 10.0, Runtime API Version: 9.0
W0507 15:32:50.910995 226435 device_context.cc:269] device: 0, cuDNN Version: 7.0.
1.4.1