快捷方式

torch.resolve_neg

torch.resolve_neg(input) Tensor

如果 input 的負數位元 (negative bit) 設定為 True,則返回一個具體化的取反 (materialized negation) 新張量;否則,返回 input。輸出張量的負數位元將始終設定為 False

參數 (Parameters)

input (Tensor) – 輸入張量。

範例 (Example)

>>> x = torch.tensor([-1 + 1j, -2 + 2j, 3 - 3j])
>>> y = x.conj()
>>> z = y.imag
>>> z.is_neg()
True
>>> out = z.resolve_neg()
>>> out
tensor([-1., -2., 3.])
>>> out.is_neg()
False

文件

存取 PyTorch 的全面開發者文件

查看文件 (View Docs)

教學 (Tutorials)

取得針對初學者和進階開發者的深入教學

查看教學 (View Tutorials)

資源 (Resources)

尋找開發資源並獲得問題解答

查看資源 (View Resources)