tf.matrix_diag_part(input, name=None)
Returns the batched diagonal part of a batched tensor.
This operation returns a tensor with the diagonal part of the batched input. The diagonal part is computed as follows:
Assume input has k dimensions [I, J, K, ..., N, N], then the output is a tensor of rank k - 1 with dimensions [I, J, K, ..., N] where:
diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n].
The input must be at least a matrix.
For example:
# 'input' is [[[1, 0, 0, 0]
[0,