捷徑

torch.Tensor.imag

Tensor.imag

返回一個新的 tensor,其中包含 self tensor 的虛數值。返回的 tensor 和 self 共享相同的底層儲存空間。

警告

imag() 僅支援具有複數 dtype 的 tensor。

範例:
>>> x=torch.randn(4, dtype=torch.cfloat)
>>> x
tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)])
>>> x.imag
tensor([ 0.3553, -0.7896, -0.0633, -0.8119])

文件

取得 PyTorch 的完整開發者文件

檢視文件

教學

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

檢視教學

資源

尋找開發資源並取得您的問題解答

檢視資源