快捷方式

torch.vander

torch.vander(x, N=None, increasing=False) Tensor

生成一個範德蒙德矩陣。

輸出矩陣的列是輸入向量 x(N1),x(N2),...,x0x^{(N-1)}, x^{(N-2)}, ..., x^0) 的逐元素冪。如果 increasing 為 True,則列的順序反轉為 x0,x1,...,x(N1)x^0, x^1, ..., x^{(N-1)}。每行具有幾何級數(等比數列)的此類矩陣以 Alexandre-Theophile Vandermonde 命名。

引數
  • x (Tensor) – 1-D 輸入張量。

  • N (int, 可選) – 輸出中的列數。如果未指定 N,則返回一個方陣 (N=len(x))(N = len(x))

  • increasing (bool, 可選) – 列的冪的順序。如果為 True,則冪從左到右遞增;如果為 False(預設值),則順序反轉。

返回值

範德蒙德矩陣。如果 increasing 為 False,第一列是 x(N1)x^{(N-1)},第二列是 x(N2)x^{(N-2)},依此類推。如果 increasing 為 True,列是 x0,x1,...,x(N1)x^0, x^1, ..., x^{(N-1)}

返回型別

Tensor

示例

>>> x = torch.tensor([1, 2, 3, 5])
>>> torch.vander(x)
tensor([[  1,   1,   1,   1],
        [  8,   4,   2,   1],
        [ 27,   9,   3,   1],
        [125,  25,   5,   1]])
>>> torch.vander(x, N=3)
tensor([[ 1,  1,  1],
        [ 4,  2,  1],
        [ 9,  3,  1],
        [25,  5,  1]])
>>> torch.vander(x, N=3, increasing=True)
tensor([[ 1,  1,  1],
        [ 1,  2,  4],
        [ 1,  3,  9],
        [ 1,  5, 25]])

© 版權所有 PyTorch 貢獻者。

使用 Sphinx 構建,主題由 Read the Docs 提供。

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源