oneflow icon indicating copy to clipboard operation
oneflow copied to clipboard

eager global detach 接口行为错误

Open wyg1997 opened this issue 2 years ago • 0 comments

Summary

eager global 下 detach 接口获得结果的 autograd 属性不符合预期,影响后续后向图构图。

Code to reproduce bug

cuda_placement = flow.placement("cuda", [0, 1])
cpu_placement = flow.placement("cpu", [0, 1])
B = flow.sbp.broadcast

a = flow.ones(2, 3).to_global(cuda_placement, B)  # cuda placement 才能复现,cpu placement 没问题
if flow.env.get_rank() == 0:
    print(f"{a.is_leaf=}")  # True

b = a.float().clone().detach()
if flow.env.get_rank() == 0:
    print(f"{b.is_leaf=}")  # False but expect True

wyg1997 avatar Sep 22 '22 06:09 wyg1997