Skip to content

不能创建paddle.static.nn.conv2d failed #73619

@tiger100256-hu

Description

@tiger100256-hu

bug描述 Describe the Bug

使用document https://www.paddlepaddle.org.cn/documentation/docs/en/api/paddle/static/nn/conv2d_en.html 中的实例代码 在paddlepaddle 3.0 上失败了

import paddle
paddle.enable_static()

data = paddle.static.data(name='data', shape=[None, 3, 32, 32], dtype='float32')

conv2d = paddle.static.nn.conv2d(input=data, num_filters=2, filter_size=3, act="relu")
print(conv2d.shape)
root@9a1c33cc3772:~# python test_gen.py 
Traceback (most recent call last):
  File "/root/test_gen.py", line 6, in <module>
    conv2d = paddle.static.nn.conv2d(input=data, num_filters=2, filter_size=3, act="relu")
  File "/usr/local/lib/python3.10/dist-packages/paddle/static/nn/common.py", line 1061, in conv2d
    helper.append_op(
  File "/usr/local/lib/python3.10/dist-packages/paddle/base/layer_helper.py", line 57, in append_op
    return self.main_program.current_block().append_op(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/paddle/base/framework.py", line 4701, in append_op
    op = Operator(
  File "/usr/local/lib/python3.10/dist-packages/paddle/base/framework.py", line 3329, in __init__
    raise TypeError(
TypeError: The type of '%Input' in operator conv2d should be one of [str, bytes, Variable]. but received : Value(define_op_name=pd_op.data, index=
0, dtype=tensor<-1x3x32x32xf32>, stop_gradient=True)

其他补充信息 Additional Supplementary Information

ubuntu 22.04
paddlepaddle 3.0.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions