torch.Tensor.requires_grad¶ Tensor.requires_grad¶ 如果需要为此张量计算梯度,则为 True,否则为 False。 注意 需要为张量计算梯度并不意味着 grad 属性将被填充,有关更多详细信息,请参阅 is_leaf。