Paddle ValueError: (InvalidArgument) GradOp is only callable when is_test is false

8yoxcaq7  于 2021-11-30  发布在  Java
关注(0)|答案(2)|浏览(512)

为使您的问题得到快速解决,在建立Issues前,请您先通过如下方式搜索是否有相似问题:【搜索issue关键字】【使用labels筛选】【官方文档】

如果您没有查询到相似问题,为快速解决您的提问,建立issue时请提供如下细节信息:

  • 标题:简洁、精准概括您的问题,例如“Insufficient Memory xxx" ”
  • 版本、环境信息:

   1)PaddlePaddle版本:请提供您的PaddlePaddle版本号,例如1.1或CommitID
   2)CPU:预测若用CPU,请提供CPU型号,MKL/OpenBlas/MKLDNN/等数学库使用情况
   3)GPU:预测若用GPU,请提供GPU型号、CUDA和CUDNN版本号
   4)系统环境:请您描述系统类型、版本,例如Mac OS 10.14,Python版本
注:您可以通过执行summary_env.py获取以上信息。

  • 训练信息

   1)单机/多机,单卡/多卡
   2)显存信息
   3)Operator信息

  • 复现信息:如为报错,请给出复现环境、复现步骤
  • 问题描述:请详细描述您的问题,同步贴出报错信息、日志、可复现的代码片段

C:\Users\NING MEI.conda\envs\torch1.7\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp, sys, os
W0906 15:48:02.696318 18436 device_context.cc:404] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.4, Runtime API Version: 11.0
W0906 15:48:02.713272 18436 device_context.cc:422] device: 0, cuDNN Version: 8.0.
C:\Users\NING MEI.conda\envs\torch1.7\lib\site-packages\paddle\nn\layer\norm.py:641: UserWarning: When training, we now always track global mean and variance.
"When training, we now always track global mean and variance.")
epoch:0 error:15.627627765559353 min_mae:15.627627765559353 min_epoch:0
Traceback (most recent call last):
File "m:/Ghostcount-paddle/Ghostcount-paddle/N_train.py", line 64, in
loss.backward()
File "C:\Users\NING MEI.conda\envs\torch1.7\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args),**kw)
File "C:\Users\NING MEI.conda\envs\torch1.7\lib\site-packages\paddle\fluid\wrapped_decorator.py", line 25, inimpl
return wrapped_func(args,kwargs)
File "C:\Users\NING MEI.conda\envs\torch1.7\lib\site-packages\paddle\fluid\framework.py", line 227, in
impl
*
return func(*args,**kwargs)
File "C:\Users\NING MEI.conda\envs\torch1.7\lib\site-packages\paddle\fluid\dygraph\varbase_patch_methods.py", line 239, in backward
framework._dygraph_tracer())
ValueError: (InvalidArgument) GradOp is only callable when is_test is false
[Hint: Expected ctx->Attrs().Get("is_test") == false, but received ctx->Attrs().Get("is_test"):1 != false:0.] (at C:/home/workspace/Paddle_release2/paddle/fluid/operators/dropout_op.cc:122)

bq9c1y66

bq9c1y661#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网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!

esyap4oy

esyap4oy2#

报错原因是is_test属性为true时 没有反向梯度

相关问题