InvertibleMatrix¶
-
class
tfsnippet.utils.InvertibleMatrix(size, strict=False, dtype=tf.float32, epsilon=1e-06, trainable=True, random_state=None, name=None, scope=None)¶ Bases:
tfsnippet.utils.reuse.VarScopeObjectA matrix initialized to be an invertible, orthogonal matrix.
If strict is
False, then there is no guarantee that the matrix will keep invertible during training. Otherwise, the matrix will be derived through a variant of PLU decomposition as proposed in (Kingma & Dhariwal, 2018):\[\mathbf{M} = \mathbf{P} \mathbf{L} (\mathbf{U} + \mathrm{diag}(\mathbf{sign} \odot \exp(\mathbf{s})))\]where P is a permutation matrix, L is a lower triangular matrix with all its diagonal elements equal to one, U is an upper triangular matrix with all its diagonal elements equal to zero, sign is a vector of {-1, 1}, and s is a vector. P and sign are fixed variables, while L, U, s are trainable variables.
A random_state can be specified via the constructor. If it is not specified, an instance of
VarScopeRandomStatewill be created according to the variable scope name of the object.Attributes Summary
inv_matrixGet the inverted matrix. log_detGet the log-determinant of the matrix. matrixGet the matrix tensor. nameGet the name of this object. shapeGet the shape of the matrix. variable_scopeGet the variable scope of this object. Attributes Documentation
-
inv_matrix¶ Get the inverted matrix.
Returns: The inverted matrix tensor. Return type: tf.Tensor
-
log_det¶ Get the log-determinant of the matrix.
Returns: The log-determinant tensor. Return type: tf.Tensor
-
matrix¶ Get the matrix tensor.
Returns: The matrix tensor. Return type: tf.Tensor or tf.Variable
-
name¶ Get the name of this object.
-
variable_scope¶ Get the variable scope of this object.
-