评价此页

torch.Tensor.detach_#

Tensor.detach_()#

将张量从创建它的图中断开,使其成为叶子节点。视图不能就地断开。

此方法还会影响前向模式 AD 梯度,结果将永远不会有前向模式 AD 梯度。