Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

为所有入栈出栈操作添加检查,确保栈内所有内容均是Variable #142

Closed
zrr1999 opened this issue Jun 9, 2023 · 3 comments
Labels
🐾 meow 快乐喵喵开源活动专属认证 PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc

Comments

@zrr1999
Copy link
Member

zrr1999 commented Jun 9, 2023

在 OpcodeExecutor 的栈内,应该所有内容均是Variable,但是现在我们有很多时候混入了一些其他类型变量,所以我们考虑在所有入栈出栈操作上都加上 isinstance(val, VariableBase) 的检查,这可以通过如下方式实现:

简化栈操作,栈操作只允许访问栈顶,只包含 push、pop 等简单操作,不允许直接访问和替换栈
在有限的栈操作上加上检查项,确保入栈出栈都是 Variable(其实只需要保证入栈是就好了)

相关讨论见 #138 (comment)

@zrr1999 zrr1999 added the good first issue Good for newcomers label Jun 9, 2023
@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Jun 12, 2023
@NotHaozi
Copy link
Collaborator

已PR。#155

@SigureMo
Copy link
Member

@NotHaozi 以后可以在 PR 的描述里加上 fixes #pr_id,这样就可以在 merge 时自动 close 掉对应 issue 了

参考 https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

@NotHaozi
Copy link
Collaborator

@NotHaozi 以后可以在 PR 的描述里加上 fixes #pr_id,这样就可以在 merge 时自动 close 掉对应 issue 了

参考 https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

谢谢,收到!

@SigureMo SigureMo added 🐾 meow 快乐喵喵开源活动专属认证 and removed good first issue Good for newcomers labels Jul 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐾 meow 快乐喵喵开源活动专属认证 PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc
Projects
None yet
Development

No branches or pull requests

3 participants