其他分享
首页 > 其他分享> > PGL2.0版本运行出现AssertionError: In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and ‘data

PGL2.0版本运行出现AssertionError: In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and ‘data

作者:互联网

1、问题

AssertionError: In PaddlePaddle 2.x, we turn on dynamic graph mode by default, and 'data()' is only supported in static graph mode. So if you want to use this api, please call 'paddle.enable_static()' before this api to enter static graph mode.

2、解决

在运行的代码中添加下面提示的paddle.enable_static()

但是如果

报下面的错

所以正确的应该是

import paddle
paddle.enable_static()

标签:AssertionError,enable,default,PGL2.0,PaddlePaddle,paddle,static,mode,graph
来源: https://blog.csdn.net/lj2048/article/details/112858196