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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
