tf.raw_ops.MatrixSetDiag
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
Returns a batched matrix tensor with new batched diagonal values.
View aliases
Compat aliases for migration
See
Migration guide for
more details.
tf.compat.v1.raw_ops.MatrixSetDiag
tf.raw_ops.MatrixSetDiag(
input, diagonal, name=None
)
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
.
Args |
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).
|
Returns |
A Tensor . Has the same type as input .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.raw_ops.MatrixSetDiag\n\n\u003cbr /\u003e\n\nReturns a batched matrix tensor with new batched diagonal values.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.MatrixSetDiag`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/MatrixSetDiag)\n\n\u003cbr /\u003e\n\n tf.raw_ops.MatrixSetDiag(\n input, diagonal, name=None\n )\n\nGiven `input` and `diagonal`, this operation returns a tensor with the\nsame shape and values as `input`, except for the main diagonal of the\ninnermost matrices. These will be overwritten by the values in `diagonal`.\n\nThe output is computed as follows:\n\nAssume `input` has `k+1` dimensions `[I, J, K, ..., M, N]` and `diagonal` has\n`k` dimensions `[I, J, K, ..., min(M, N)]`. Then the output is a\ntensor of rank `k+1` with dimensions `[I, J, K, ..., M, N]` where:\n\n- `output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]` for `m == n`.\n- `output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]` for `m != n`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|---------------------------------------------------------------------------|\n| `input` | A `Tensor`. Rank `k+1`, where `k \u003e= 1`. |\n| `diagonal` | A `Tensor`. Must have the same type as `input`. Rank `k`, where `k \u003e= 1`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`. Has the same type as `input`. ||\n\n\u003cbr /\u003e"]]