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