-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy nn.Graph FeedInputOpExpr #5458
Conversation
…pret::Apply(FeedInputOpExpr)
This comment has been minimized.
This comment has been minimized.
if not x.is_determined: | ||
x.determine() | ||
|
||
out_tensor = input_op.apply([x._local_or_consistent_tensor], attrs)[0] |
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.
这里是调用 FeedInputOpExpr 的示例。注意:由于现在 Python 端的 Tensor 并不是 C++ 里的 Tensor 直接导出的类,所以这里拿到的 Python 端的 Tensor 需要做一些处理之后取到内部的 C++ Tensor 才能传给 OpExpr:
x = flow.Tensor(2, 4)
type(x) # => tensor
if not x.is_determined:
x.determine()
tensor_in_c = x._local_or_consistent_tensor
type(tensor_in_c) # => oneflow._oneflow_internal.Tensor
if (tensor->is_consistent()) { | ||
return false; | ||
} else { | ||
return true; |
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.
非consistent的就是dynamic的么?
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.
是的,Local 永远是 Dynamic
Lazy nn.Graph 所依赖的 FeedInputOpExpr: 将该 job 的所有 input tensor (EagerTensor)转化成 InputOp,并生成对应的 LazyTensor
解决的 BUG 进度:
- [ ] OpExpr 中,ArgTuple 的解析没有考虑到非 UserOp: (关联:ArgTuple #4795) @hjchen2 代码:TODOhttps://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/core/framework/arg_tuple.cpp#L26