首页 Paddle框架 帖子详情
paddle安装成功,运行程序出现这个问题
收藏
快速回复
Paddle框架 问答深度学习 993 2
paddle安装成功,运行程序出现这个问题
收藏
快速回复
Paddle框架 问答深度学习 993 2

import paddle.fluid as fluid

data = fluid.layers.fill_constant(shape=[3, 4], value=16, dtype='int64')
data = fluid.layers.Print(data, message="Print data:")

place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())

ret = exe.run()

 

这个示例代码,然后返回错误:

EnforceNotMet Traceback (most recent call last)
in
8 exe.run(fluid.default_startup_program())
9
---> 10 ret = exe.run()

c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\executor.py in run(self, program, feed, fetch_list, feed_var_name, fetch_var_name, scope, return_numpy, use_program_cache, return_merged, use_prune)
1069 warnings.warn(
1070 "The following exception is not an EOF exception.")
-> 1071 six.reraise(*sys.exc_info())
1072
1073 def _run_impl(self, program, feed, fetch_list, feed_var_name,

c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\six.py in reraise(tp, value, tb)
694 if value.__traceback__ is not tb:
695 raise value.with_traceback(tb)
--> 696 raise value
697 finally:
698 value = None

c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\executor.py in run(self, program, feed, fetch_list, feed_var_name, fetch_var_name, scope, return_numpy, use_program_cache, return_merged, use_prune)
1064 use_program_cache=use_program_cache,
1065 use_prune=use_prune,
-> 1066 return_merged=return_merged)
1067 except Exception as e:
1068 if not isinstance(e, core.EOFException):

c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\executor.py in _run_impl(self, program, feed, fetch_list, feed_var_name, fetch_var_name, scope, return_numpy, use_program_cache, return_merged, use_prune)
1152 scope=scope,
1153 return_numpy=return_numpy,
-> 1154 use_program_cache=use_program_cache)
1155
1156 program._compile(scope, self.place)

c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\executor.py in _run_program(self, program, feed, fetch_list, feed_var_name, fetch_var_name, scope, return_numpy, use_program_cache)
1227 if not use_program_cache:
1228 self._default_executor.run(program.desc, scope, 0, True, True,
-> 1229 fetch_var_name)
1230 else:
1231 self._default_executor.run_prepared_ctx(ctx, scope, False, False,

EnforceNotMet:

--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
Windows not support stack backtrace yet.

------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
File "c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\framework.py", line 2610, in append_op
attrs=kwargs.get("attrs", None))
File "c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "c:\users\huan4\appdata\local\programs\python\python37\lib\site-packages\paddle\fluid\layers\nn.py", line 1721, in fc
"y_num_col_dims": 1})
File "", line 2, in
fc = fluid.layers.fc(input=data, size=1000, act="tanh")
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3242, in run_ast_nodes
if (await self.run_code(code, result, async_=asy)):
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3051, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\IPython\core\async_helpers.py", line 68, in _pseudo_sync_runner
coro.send(None)
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2874, in _run_cell
return runner(coro)
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2848, in run_cell
raw_cell, store_history, silent, shell_futures)
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-packages\ipykernel\zmqshell.py", line 536, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "C:\Users\huan4\AppData\Roaming\Python\Python37\site-pack

 

求大佬帮忙解决

0
收藏
回复
全部评论(2)
时间顺序
thinc
#2 回复于2020-10

请问错误信息有完整截取吗?

0
回复
thinc
#3 回复于2020-10

我运行了一遍,代码是可以执行的,下面是他的输出:

1602076123      Print data:     The place is:CPUPlace
Tensor[fill_constant_0.tmp_0]
        shape: [3,4,]
        dtype: __int64
        data: 16,16,16,16,16,16,16,16,16,16,16,16,
0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户