評價此頁

torch.Tensor.detach_#

Tensor.detach_()#

將 Tensor 從建立它的圖中分離出來,使其成為一個葉子節點。檢視(Views)不能原地分離。

此方法還會影響前向模式 AD 梯度,結果將永遠不會有前向模式 AD 梯度。