PaddlePaddle / PaddlePaddle/PaConvert
关于转换的问题
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 122
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
我能理解这个项目是通过AST以及Matcher的机制来实现
但其实目前而言这种转换的话,我觉得直接通过AI来实现可能会更加的实际
还可以尽可能的避免转换中出现的问题,包括减少需要自行调整的情况
`import paddle
class MyNet(paddle.nn.Layer):
test = "str"
def __init__(self, num_classes=10):
super(MyNet, self).__init__()
# 将 mmcv.cnn.ConvModule(4, 6, (3, 3)) 替换为等价的 Conv2D
# ConvModule 在未指定 norm/act 时等价于一个裸 conv
self._conv = paddle.nn.Conv2D(in_channels=4, out_channels=6, kernel_size=(3, 3))
self._pool = paddle.nn.MaxPool2D(kernel_size=2, stride=1)
# 线性层保持一致
self._fc1 = paddle.nn.Linear(in_features=6 * 25 * 25, out_features=120)
self._fc2 = paddle.nn.Linear(in_features=120, out_features=84)
self._fc3 = paddle.nn.Linear(in_features=84, out_features=num_classes)
def forward(self, x):
x = self._conv(x)
x = self._pool(x)
x = self._fc1(paddle.flatten(x=x, start_axis=1))
x = self._fc2(x)
x = self._fc3(x)
y = paddle.add(x=x, y=x)
return y
net = MyNet()
sgd = paddle.optimizer.SGD(parameters=net.parameters(), learning_rate=0.01, weight_decay=0.0)
tmp_lr = paddle.optimizer.lr.MultiStepDecay(milestones=[2, 4, 6], gamma=0.8, learning_rate=sgd.get_lr())
sgd.set_lr_scheduler(tmp_lr)
lr = tmp_lr
for i in range(10):
x = paddle.rand(shape=[8, 4, 28, 28])
out = net(x).sum()
sgd.clear_gradients(set_to_zero=False)
out.backward()
sgd.step()`
这是使用github上的copilot实现的转换,对比之下没有任何的问题
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file, test, or entry point is named. Start by reviewing the AST and Matcher conversion mechanisms referenced in the report, then compare them with the provided Copilot-generated Paddle example. Done would require a concrete scope and acceptance criteria for AI-assisted conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100