Ejemplo n.º 1
0
 def _random_tril_matrix(self, shape):
   mat = self.rng.rand(*shape)
   chol = tfd.matrix_diag_transform(mat, transform=tf.math.softplus)
   return tf.linalg.band_part(chol, -1, 0)
Ejemplo n.º 2
0
 def _random_pd_matrix(self, *shape):
     mat = rng.rand(*shape)
     chol = tfd.matrix_diag_transform(mat, transform=tf.math.softplus)
     chol = tf.linalg.band_part(chol, -1, 0)
     return self.evaluate(tf.matmul(chol, chol, adjoint_b=True))
Ejemplo n.º 3
0
 def _random_chol(self, *shape):
     mat = self._rng.rand(*shape)
     chol = tfd.matrix_diag_transform(mat, transform=tf.math.softplus)
     chol = tf.linalg.band_part(chol, -1, 0)
     sigma = tf.matmul(chol, chol, adjoint_b=True)
     return self.evaluate(chol), self.evaluate(sigma)