組成一個或多個 LinearOperators
。
繼承自:LinearOperator
,Module
用法
tf.linalg.LinearOperatorComposition(
operators, is_non_singular=None, is_self_adjoint=None,
is_positive_definite=None, is_square=None, name=None
)
參數
-
operators
LinearOperator
對象的迭代,每個對象都具有相同的dtype
和可組合的形狀。 -
is_non_singular
期望這個運算符是非奇異的。 -
is_self_adjoint
期望這個算子等於它的厄米轉置。 -
is_positive_definite
期望這個算子是正定的,意思是二次形式x^H A x
對所有非零具有正實部x
.請注意,我們不要求算子自伴是正定的。看:https://en.wikipedia.org/wiki/Positive-definite_matrix#Extension_for_non-symmetric_matrices -
is_square
期望此運算符的行為類似於方形 [batch] 矩陣。 -
name
此LinearOperator
的名稱。默認是與_o_
連接的各個操作符名稱。
拋出
-
TypeError
如果所有運算符都沒有相同的dtype
。 -
ValueError
如果operators
為空。
屬性
-
H
返回當前的伴隨LinearOperator
.給定
A
表示此LinearOperator
,返回A*
。請注意,調用self.adjoint()
和self.H
是等效的。 -
batch_shape
TensorShape
這批尺寸的LinearOperator
.如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]
的批處理矩陣A
,則返回TensorShape([B1,...,Bb])
,相當於A.shape[:-2]
-
domain_dimension
此運算符的域的維度(在向量空間的意義上)。如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]
的批處理矩陣A
,則返回N
。 -
dtype
Tensor
的DType
由此LinearOperator
處理。 -
graph_parents
這個的圖依賴列表LinearOperator
. (已棄用)警告:此函數已棄用。它將在未來的版本中刪除。更新說明:請勿調用
graph_parents
。 -
is_non_singular
-
is_positive_definite
-
is_self_adjoint
-
is_square
返回True/False
取決於此運算符是否為正方形。 -
operators
-
parameters
用於實例化此LinearOperator
的參數字典。 -
range_dimension
此運算符範圍的維度(在向量空間的意義上)。如果此運算符的作用類似於帶有
A.shape = [B1,...,Bb, M, N]
的批處理矩陣A
,則返回M
。 -
shape
TensorShape
這個的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
。
該運算符組成一個或多個線性運算符 [op1,...,opJ]
,構建一個新的 LinearOperator
,其動作定義為:
op_composed(x):= op1(op2(...(opJ(x)...))
如果 opj
的行為類似於 [batch] 矩陣 Aj
,則 op_composed
的行為類似於由乘法 A1 A2...AJ
形成的 [batch] 矩陣。
如果 opj
具有形狀 batch_shape_j + [M_j, N_j]
,那麽我們必須具有 N_j = M_{j+1}
,在這種情況下,組合運算符的形狀等於 broadcast_batch_shape + [M_1, N_J]
,其中 broadcast_batch_shape
是 batch_shape_j
, j = 1,...,J
的相互廣播,假設中間批次形狀播送。即使組合形狀被很好地定義,組合算子的方法也可能由於定義算子的方法中缺乏廣播能力而失敗。
# Create a 2 x 2 linear operator composed of two 2 x 2 operators.
operator_1 = LinearOperatorFullMatrix([[1., 2.], [3., 4.]])
operator_2 = LinearOperatorFullMatrix([[1., 0.], [0., 1.]])
operator = LinearOperatorComposition([operator_1, operator_2])
operator.to_dense()
==> [[1., 2.]
[3., 4.]]
operator.shape
==> [2, 2]
operator.log_abs_determinant()
==> scalar Tensor
x = ... Shape [2, 4] Tensor
operator.matmul(x)
==> Shape [2, 4] Tensor
# Create a [2, 3] batch of 4 x 5 linear operators.
matrix_45 = tf.random.normal(shape=[2, 3, 4, 5])
operator_45 = LinearOperatorFullMatrix(matrix)
# Create a [2, 3] batch of 5 x 6 linear operators.
matrix_56 = tf.random.normal(shape=[2, 3, 5, 6])
operator_56 = LinearOperatorFullMatrix(matrix_56)
# Compose to create a [2, 3] batch of 4 x 6 operators.
operator_46 = LinearOperatorComposition([operator_45, operator_56])
# Create a shape [2, 3, 6, 2] vector.
x = tf.random.normal(shape=[2, 3, 6, 2])
operator.matmul(x)
==> Shape [2, 3, 4, 2] Tensor
性能
LinearOperatorComposition
在任何操作上的性能等於各個操作符操作的總和。
矩陣屬性提示
此 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.LinearOperatorComposition.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorComposition.solve用法及代碼示例
- Python tf.linalg.LinearOperatorComposition.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorComposition.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorComposition.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorComposition.matmul用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.solve用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.solvevec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant.diag_part用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.assert_non_singular用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.matmul用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant2D用法及代碼示例
- Python tf.linalg.LinearOperatorCirculant3D.solve用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.linalg.LinearOperatorComposition。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。