Paddle UnboundLocalError: local variable 'out' referenced before assignment

ki1q1bka  于 2021-12-07  发布在  Java
关注(0)|答案(2)|浏览(510)

ai studio 版本2.1 项目地址是 [ https://aistudio.baidu.com/aistudio/projectdetail/2097982 ]

6145             out, _ = core.ops.reshape2(x, shape)
   6146 
-> 6147         return dygraph_utils._append_activation_in_dygraph(out, act)
   6148 
   6149     check_variable_and_dtype(x, 'x', [
UnboundLocalError: local variable 'out' referenced before assignment```

貌似是我的什么变量和 out重名了,但是我并没有发现
vyswwuz2

vyswwuz21#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

p4tfgftt

p4tfgftt2#

可以把 .reshape(-1) 修改成 .reshape([-1])
paddle.reshape()shape 参数目前仅支持 list|tuple|Tensor,传入 int 会导致这个问题,我反馈下这个报错信息。
https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/fluid/layers/nn.py#L6156-L6166

相关问题