Similar to this question, I want to convert this tensor
tensor = tf.ones((5, 5))
tf.Tensor(
[[1. 1. 1. 1. 1.]
[1. 1. 1. 1. 1.]
[1. 1. 1. 1. 1.]
[1. 1. 1. 1. 1.]
[1. 1. 1. 1. 1.]], shape=(5, 5), dtype=float32)
to an upper triangular tensor with ones and zeros everywhere else:
tf.Tensor(
[[1. 1. 1. 1. 1.]
[0. 1. 1. 1. 1.]
[0. 0. 1. 1. 1.]
[0. 0. 0. 1. 1.]
[0. 0. 0. 0. 1.]], shape=(5, 5), dtype=float32)
any ideas?