Deleting a branch is permanent. It CANNOT be undone. Continue?
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》
问题所属任务编号(Task 02)
Task 02
运行环境(操作系统版本、Python 版本)/ 非程序问题
非程序问题
完整的报错信息(截图或复制均可)/ 问题详细描述
想知道下面这个计算图长啥样
我是这样画的,但是这样不就会出现两个x作为叶子结点了吗
其实我怀疑底层做了优化,如果操作数还是x就会合并,但是打印了一下type发现好像没有这样优化
如果确实是如上的计算图,反向计算的时候就会出问题,望解惑
描述你期望看到的结果
我的理解,计算图是有向无环图,但是图中的一个节点可以有很多条边,所以代码中的x通过多条边指向多个节点,整个图中只要无环即可。
你的截图中的代码的计算图是下面这样的:
青色矩形为叶子节点x,会绑定一个AccumulateGrad操作累积梯度。可以看到叶子结点通过多条边和其他节点相连。
假如修改代码中的y = x * x * x,那么计算图会变成下面这样:
在计算y时产生了一个临时节点存储 x * x。
如果接着修改z = x + y + x,那么计算图会变成这样:
我觉得图大概挺直观了。