赞
踩
-
- out = self.student(*inputs)
- self.last_students_logits = out.new_tensor(out, requires_grad=True)
- out = self.student(*inputs)
- self.last_students_logits = out.clone()
new_tensor 其默认参数下的操作等同于.clone().detach()
,
而requires_grad=True
时的效果相当于.clone().detach().requires_grad_(True)
More
1 对比clone、detach以及copy_等张量复制操作
2 https://blog.csdn.net/qq_40438388/article/details/106860180
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。