Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::
ops::
MatrixSetDiag
#include <array_ops.h>
Returns a batched matrix tensor with new batched diagonal values.
Summary
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:
-
scope: A
Scope
object
-
input: Rank
k+1
, where
k >= 1
.
-
diagonal: Rank
k
, where
k >= 1
.
Returns:
-
Output
: Rank
k+1
, with
output.shape = input.shape
.
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
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 2021-08-16 UTC.
[null,null,["Last updated 2021-08-16 UTC."],[],[],null,["# tensorflow::ops::MatrixSetDiag Class Reference\n\ntensorflow::\nops::\nMatrixSetDiag\n================================\n\n`\n#include \u003carray_ops.h\u003e\n`\n\n\nReturns a batched matrix tensor with new batched diagonal values.\n\nSummary\n-------\n\n\nGiven\n`\ninput\n`\nand\n`\ndiagonal\n`\n, this operation returns a tensor with the same shape and values as\n`\ninput\n`\n, except for the main diagonal of the innermost matrices. These will be overwritten by the values in\n`\ndiagonal\n`\n.\n\n\nThe output is computed as follows:\n\n\nAssume\n`\ninput\n`\nhas\n`\nk+1\n`\ndimensions\n`\n[I, J, K, ..., M, N]\n`\nand\n`\ndiagonal\n`\nhas\n`\nk\n`\ndimensions\n`\n[I, J, K, ..., min(M, N)]\n`\n. Then the output is a tensor of rank\n`\nk+1\n`\nwith dimensions\n`\n[I, J, K, ..., M, N]\n`\nwhere:\n\n\n- `\n output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]\n ` for `\n m == n\n ` .\n- `\n output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]\n ` for `\n m != n\n ` .\n\n\u003cbr /\u003e\n\n\nArgs:\n\n- scope: A [Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: Rank `\n k+1\n ` , where `\n k \u003e= 1\n ` .\n- diagonal: Rank `\n k\n ` , where `\n k \u003e= 1\n ` .\n\n\u003cbr /\u003e\n\n\nReturns:\n\n- `\n `[Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)`\n ` : Rank `\n k+1\n ` , with `\n output.shape = input.shape\n ` .\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| ` `[MatrixSetDiag](#classtensorflow_1_1ops_1_1_matrix_set_diag_1af9f6deaf5d71f88356239fd1fceb3bd5)` (const :: `[tensorflow::Scope](/versions/r2.6/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, :: `[tensorflow::Input](/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, :: `[tensorflow::Input](/versions/r2.6/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` diagonal) ` ||\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| ` `[operation](#classtensorflow_1_1ops_1_1_matrix_set_diag_1ac564fb65fed63cd95c5a876d8cfcb004)` ` | ` `[Operation](/versions/r2.6/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation)` ` |\n| ` `[output](#classtensorflow_1_1ops_1_1_matrix_set_diag_1a58d08deb35db4f1602c1df59432ade6c)` ` | ` :: `[tensorflow::Output](/versions/r2.6/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output)` ` |\n\n| ### Public functions ||\n|-------------------------------------------------------------------------------------------------------------------------------|--------------------------|\n| ` `[node](#classtensorflow_1_1ops_1_1_matrix_set_diag_1a20fc7ca0974220bfcd3a3aee08803d6c)` () const ` | ` ::tensorflow::Node * ` |\n| ` `[operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_matrix_set_diag_1af98eee12ae5e443a923b794be760afd7)` () const ` | ` ` |\n| ` `[operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_matrix_set_diag_1adf4b733c12f7c7dc2387318fafff0413)` () const ` | ` ` |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### MatrixSetDiag\n\n```gdscript\n MatrixSetDiag(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input diagonal\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n```"]]