torch.Tensor.detach_¶ Tensor.detach_()¶ 將 Tensor 從建立它的圖中分離,使其成為葉節點。 視圖無法原地分離。 此方法也會影響前向模式 AD 梯度,且結果永遠不會有前向模式 AD 梯度。