bug描述 Describe the Bug
示例代码: https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/jit/TracedLayer_cn.html
paddlepaddle==2.4.1
代码片段:
import paddle
class ExampleLayer(paddle.nn.Layer):
def init(self):
super(ExampleLayer, self).init()
self._fc = paddle.nn.Linear(3, 10)
def forward(self, input):
return self._fc(input)
layer = ExampleLayer()
in_var = paddle.uniform(shape=[2, 3], dtype='float32')
out_dygraph, static_layer = paddle.jit.TracedLayer.trace(layer, inputs=[in_var])
报错详情:
Python 3.8.13 (default, Mar 28 2022, 11:38:47)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import paddle
class ExampleLayer(paddle.nn.Layer):
... def init(self):
... super(ExampleLayer, self).init()
... self._fc = paddle.nn.Linear(3, 10)
... def forward(self, input):
... return self._fc(input)
...
layer = ExampleLayer()
in_var = paddle.uniform(shape=[2, 3], dtype='float32')
out_dygraph, static_layer = paddle.jit.TracedLayer.trace(layer, inputs=[in_var])
Traceback (most recent call last):
File "", line 1, in
File "/root/miniconda3/lib/python3.8/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl
return wrapped_func(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/framework.py", line 534, in impl
return func(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/jit.py", line 1490, in trace
outs, prog, feed, fetch, parameters = _trace(layer, inputs)
File "/root/miniconda3/lib/python3.8/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 26, in impl
return wrapped_func(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/framework.py", line 534, in impl
return func(*args, **kwargs)
File "/root/miniconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/jit.py", line 1378, in _trace
program_desc, feed_names, fetch_names, parameters = tracer.create_program_desc(
TypeError: create_program_desc(): incompatible function arguments. The following argument types are supported:
- (self: paddle.fluid.libpaddle.ProgramDescTracer, arg0: List[paddle.fluid.libpaddle.VarBase], arg1: str, arg2: List[paddle.fluid.libpaddle.VarBase], arg3: str, arg4: str) -> Tuple[paddle::framework::ProgramDesc, List[str], List[str], List[paddle.fluid.libpaddle.VarBase]]
Invoked with: <paddle.fluid.libpaddle.ProgramDescTracer object at 0x7ff6100ec630>, [Tensor(shape=[2, 3], dtype=float32, place=Place(cpu), stop_gradient=True,
[[-0.35561991, 0.12304401, -0.22898322],
[-0.48768324, 0.97504318, 0.12122202]])], 'feed_', [Tensor(shape=[2, 10], dtype=float32, place=Place(cpu), stop_gradient=False,
[[ 0.25269434, 0.07252373, -0.10471330, 0.19382510, -0.28417745,
0.02757533, 0.31943336, 0.16885607, -0.16684972, -0.15213378],
[-0.10124237, 0.12843959, -0.04026286, -0.08484009, -0.53981638,
-0.03719448, 0.19071770, -0.16087075, 0.05686845, -0.47109282]])], 'fetch_', 't_'
其他补充信息 Additional Supplementary Information
No response
3条答案
按热度按时间zour9fqk1#
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档 、 常见问题 、 历史Issue 、 AI社区 来寻求解答。祝您生活愉快~
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 API , FAQ , Github Issue and AI community to get the answer.Have a nice day!
afdcj2ne2#
感谢您对paddle框架的支持,我们已经收到您的问题反馈,会进行对该问题的评估与修复。如有进展会回复您。
djmepvbi3#
您好,目前TracedLayer已经不在支持新动态图了。并且该接口已有废除计划。
目前有两个方案: