W3cubDocs

/TensorFlow

tf.keras.ops.triu

Return upper triangle of a tensor.

For tensors with ndim exceeding 2, triu will apply to the final two axes.

Args
x Input tensor.
k Diagonal below which to zero elements. Defaults to 0. the main diagonal. k < 0 is below it, and k > 0 is above it.
Returns
Upper triangle of x, of same shape and data type as x.

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/keras/ops/triu