Help protect the Great Barrier Reef with TensorFlow on Kaggle

# tf.raw_ops.MatrixSetDiag

Returns a batched matrix tensor with new batched diagonal values.

Given `input` and `diagonal`, this operation returns a tensor with the same shape and values as `input`, except for the main diagonal of the innermost matrices. These will be overwritten by the values in `diagonal`.

The output is computed as follows:

Assume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has `k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a tensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where:

• `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`.
• `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`.

`input` A `Tensor`. Rank `k+1`, where `k >= 1`.
`diagonal` A `Tensor`. Must have the same type as `input`. Rank `k`, where `k >= 1`.
`name` A name for the operation (optional).

A `Tensor`. Has the same type as `input`.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]