LinearOperator 的作用類似於 [batch] 排列矩陣。
繼承自:LinearOperator,Module
用法
tf.linalg.LinearOperatorPermutation(
perm, dtype=tf.dtypes.float32, is_non_singular=None, is_self_adjoint=None,
is_positive_definite=None, is_square=None,
name='LinearOperatorPermutation'
)參數
-
perm形狀[B1,...,Bb, N]整數Tensor與b >= 0N >= 0。一個整數向量,表示要應用的排列。請注意,此參數與tf.transpose相同。但是,此排列應用於行,而tf.transpose中的排列應用於Tensor的維度。perm必須具有來自{0, 1, ... N-1}的唯一條目。 -
dtype此運算符的參數dtype。默認值:float32。允許的數據類型:float16,float32,float64,complex64,complex128。 -
is_non_singular期望這個運算符是非奇異的。 -
is_self_adjoint期望這個算子等於它的厄米轉置。這是自動設置為 true -
is_positive_definite期望此運算符是正定的,這意味著二次形式x^H A x對於所有非零x具有正實部。請注意,我們不要求算子自伴是正定的。請參閱:https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices 這是自動設置為 false。 -
is_square期望此運算符的行為類似於方形 [batch] 矩陣。這是自動設置為真。 -
name此LinearOperator的名稱。
拋出
-
ValueErroris_self_adjointis notTrue,is_positive_definiteis notFalse或is_squareis notTrue。
屬性
-
H返回當前的伴隨LinearOperator.給定
A表示此LinearOperator,返回A*。請注意,調用self.adjoint()和self.H是等效的。 -
batch_shapeTensorShape這批尺寸的LinearOperator.如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]的批處理矩陣A,則返回TensorShape([B1,...,Bb]),相當於A.shape[:-2] -
domain_dimension此運算符的域的維度(在向量空間的意義上)。如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]的批處理矩陣A,則返回N。 -
dtypeTensor的DType由此LinearOperator處理。 -
graph_parents這個的圖依賴列表LinearOperator. (已棄用)警告:此函數已棄用。它將在未來的版本中刪除。更新說明:請勿調用
graph_parents。 -
is_non_singular -
is_positive_definite -
is_self_adjoint -
is_square返回True/False取決於此運算符是否為正方形。 -
parameters用於實例化此LinearOperator的參數字典。 -
perm -
range_dimension此運算符範圍的維度(在向量空間的意義上)。如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]的批處理矩陣A,則返回M。 -
shapeTensorShape這個的LinearOperator.如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]的批處理矩陣A,則返回TensorShape([B1,...,Bb, M, N]),等效於A.shape。 -
tensor_rank與此運算符對應的矩陣的秩(在張量的意義上)。如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]的批處理矩陣A,則返回b + 2。
對於某些 b >= 0 ,此運算符的作用類似於具有形狀 [B1,...,Bb, N, N] 的排列的 [batch]。第一個 b 索引索引批處理成員。對於每個批次索引 (i1,...,ib) , A[i1,...,ib,::] 是一個 N x N 矩陣。這個矩陣A 沒有具體化,但是為了廣播這個形狀是相關的。
LinearOperatorPermutation 使用(批量)向量進行初始化。
排列由整數向量 v 定義,其值是唯一的並且在 [0, ... n] 範圍內。對輸入矩陣應用置換具有以下含義:索引 i 處的 v 的值表示將輸入矩陣的第 v[i] 行移動到第 i 行。因為所有值都是唯一的,這將導致輸入矩陣的行排列。請注意,置換向量 v 與 tf.transpose 具有相同的語義。
# Create a 3 x 3 permutation matrix that swaps the last two columns.
vec = [0, 2, 1]
operator = LinearOperatorPermutation(vec)
operator.to_dense()
==> [[1., 0., 0.]
[0., 0., 1.]
[0., 1., 0.]]
operator.shape
==> [3, 3]
# This will be zero.
operator.log_abs_determinant()
==> scalar Tensor
x = ... Shape [3, 4] Tensor
operator.matmul(x)
==> Shape [3, 4] Tensor
形狀兼容性
該運算符作用於具有兼容形狀的 [batch] 矩陣。 x 是與 matmul 和 solve 的形狀兼容的批處理矩陣,如果
operator.shape = [B1,...,Bb] + [N, N], with b >= 0
x.shape = [C1,...,Cc] + [N, R],
and [C1,...,Cc] broadcasts with [B1,...,Bb] to [D1,...,Dd]
矩陣屬性提示
此 LinearOperator 使用 is_X 形式的布爾標誌初始化,用於 X = non_singular, self_adjoint, positive_definite, square 。它們具有以下含義:
- 如果
is_X == True,調用者應該期望操作符具有屬性X。這是一個應該實現的承諾,但不是運行時斷言。例如,有限的浮點精度可能會導致違反這些承諾。 - 如果
is_X == False,調用者應該期望操作符沒有X。 - 如果
is_X == None(默認),調用者應該沒有任何期望。
相關用法
- Python tf.linalg.LinearOperatorPermutation.solve用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorPermutation.matmul用法及代碼示例
- Python tf.linalg.LinearOperatorFullMatrix.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.solve用法及代碼示例
- Python tf.linalg.LinearOperatorIdentity.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorKronecker.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorBlockLowerTriangular.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorLowerTriangular.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.solve用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorTridiag.solvevec用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.linalg.LinearOperatorPermutation。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
