Type FillTriangular
Namespace tensorflow.contrib.distributions.bijectors
Parent Bijector
Interfaces IFillTriangular
Transforms vectors to triangular. Triangular matrix elements are filled in a clockwise spiral. Given input with shape `batch_shape + [d]`, produces output with
shape `batch_shape + [n, n]`, where
`n = (-1 + sqrt(1 + 8 * d))/2`.
This follows by solving the quadratic equation
`d = 1 + 2 +... + n = n * (n + 1)/2`. #### Example
Show Example
b = tfb.FillTriangular(upper=False) b.forward([1, 2, 3, 4, 5, 6]) # ==> [[4, 0, 0], # [6, 5, 0], # [3, 2, 1]] b = tfb.FillTriangular(upper=True) b.forward([1, 2, 3, 4, 5, 6]) # ==> [[1, 2, 3], # [0, 5, 6], # [0, 0, 4]]