Skip to content
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

Merged
merged 18 commits into from
Jul 14, 2021
Merged

Lazy nn.Graph FeedInputOpExpr #5458

merged 18 commits into from
Jul 14, 2021

Conversation

chengtbf
Copy link
Contributor

@chengtbf chengtbf commented Jul 11, 2021

Lazy nn.Graph 所依赖的 FeedInputOpExpr: 将该 job 的所有 input tensor (EagerTensor)转化成 InputOp,并生成对应的 LazyTensor

  • LazyInterpret::ApplyImpl(FeedInputOpExpr)
  • 导出FeedInputOpExpr
  • 为每个 Functionnal 的 OpExpr 分配 job 内的独立唯一 op name
  • 调通最小测试样例

解决的 BUG 进度:

https://github.com/Oneflow-Inc/oneflow/blob/master/oneflow/core/framework/arg_tuple.cpp#L26

@chengtbf chengtbf added this to the v0.5.0 milestone Jul 11, 2021
@chengtbf

This comment has been minimized.

@chengtbf chengtbf removed the WIP work in progress label Jul 12, 2021
@chengtbf chengtbf marked this pull request as ready for review July 12, 2021 14:41
@chengtbf chengtbf changed the title Lazy nn.Graph InputOpExpr Lazy nn.Graph FeedInputOpExpr Jul 12, 2021
if not x.is_determined:
x.determine()

out_tensor = input_op.apply([x._local_or_consistent_tensor], attrs)[0]
Copy link
Contributor Author

@chengtbf chengtbf Jul 12, 2021

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非consistent的就是dynamic的么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,Local 永远是 Dynamic

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 13, 2021 16:26
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 13, 2021 17:28
@chengtbf chengtbf requested a review from oneflow-ci-bot July 14, 2021 02:39
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 14, 2021 04:12
@oneflow-ci-bot oneflow-ci-bot merged commit 5e24f50 into master Jul 14, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the dev_cc_input_op_expr branch July 14, 2021 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants