This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
support property process in TensorVariable #170
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3b7b51e
add some example
zrr1999 f490585
add tensor_property decorator
zrr1999 2dfaa13
change dispatcher order
zrr1999 e746cfd
fallback when make numpy guard (#171)
SigureMo 3286022
support more method and use dispatcher
zrr1999 676d1b6
update dispatch
zrr1999 0d1e599
update
zrr1999 836a8f0
add guard_str
zrr1999 e85d739
break when getting middle tensor name
zrr1999 df3a024
fix bug
zrr1999 132649d
Apply suggestions from code review
SigureMo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,16 @@ def tensor_method_passed_by_user(a: paddle.Tensor, func: paddle.Tensor): | |
|
||
|
||
def tensor_method_property(a: paddle.Tensor, b: paddle.Tensor): | ||
return a @ b.T + len(a.shape) + b.size + a.ndim | ||
return ( | ||
a.name, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 突然想到一个问题,这里 a.name 应该没啥问题,但
按照这个思路可以再看看其他几个是否有类似的问题 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 当获取中间变量的name,如果不打断是这种分别生成的 - infer_meta_variable_tmp_0
+ eager_tmp_2 如果打断是这种序号会持续累加的 AssertionError: 'eager_tmp_2' != 'eager_tmp_3'
- eager_tmp_2
? ^
+ eager_tmp_3
? ^ 所以可能这里的测试case是不能加进去的 另外这里我是不是只需要通过是否以 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
str(a.place), | ||
a.persistable, | ||
a.dtype, | ||
a.type, | ||
a.is_tensor(), | ||
a.clear_gradient(), | ||
a @ b.T + len(a.shape) + b.size + a.ndim + a.dim() + a.rank(), | ||
) | ||
|
||
|
||
class TestTensorMethod(TestCaseBase): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前这样会影响 Tensor guard
@2742195759 这些信息也应该放到 meta 里嘛?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
见AST动转静的CacheKey:
这里如果 MetaInfo 添加了这些,那么 MetaInfo 进行Guard判定时对齐动转静。