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 01-05)
Task 03
运行环境(操作系统版本、Python 版本)/ 非程序问题
完整的报错信息(截图或复制均可)/ 问题详细描述
我们输出有噪声的scatter图时,【问题】这个detach().是不是没必要,去掉也行?还是有额外的好处?
d2l.plt.scatter(features[:, 1].detach().numpy(), labels.detach().numpy(), 1);
描述你期望看到的结果
detach是为了切断一些分支的反向传播。
detach返回一个新的tensor,和原始的tensor共同一个内存,仍指向原变量的存放位置,新的tensor不计算梯度。
现在看没有区别,但加了以后优势在于:①当我们只想要调整部分网络参数或②只训练部分分支网络,并不让其梯度对主网络的梯度造成影响时。。。使用这个新的tensor进行计算反向传播时,运行到这个调用了deach的tensor就会停止,不再继续向前进行传播。