Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
tensor akışı:: işlem:: MatrixDiag
#include <array_ops.h>
Belirli bir toplu diyagonal değerlere sahip toplu bir diyagonal tensör döndürür.
Özet
Bir diagonal
verildiğinde, bu işlem diagonal
bir tensör döndürür ve diğer her şey sıfırlarla doldurulur. Köşegen şu şekilde hesaplanır:
diagonal
k
boyutu olduğunu varsayalım [I, J, K, ..., N]
, bu durumda çıktı k+1
dereceli ve [I, J, K, ..., N, N]` boyutlarına sahip bir tensör olur; burada:
output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]
.
Örneğin:
# 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]
and diagonal.shape = (2, 4)
tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0]
[0, 2, 0, 0]
[0, 0, 3, 0]
[0, 0, 0, 4]],
[[5, 0, 0, 0]
[0, 6, 0, 0]
[0, 0, 7, 0]
[0, 0, 0, 8]]]
which has shape (2, 4, 4)
Argümanlar:
- kapsam: Bir Kapsam nesnesi
- diyagonal: Derece
k
, burada k >= 1
.
İade:
-
Output
: Rank k+1
, output.shape = diagonal.shape + [diagonal.shape[-1]]
ile.
Genel özellikler
Kamu işlevleri
düğüm
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operatör::tensorflow::Çıktı
operator::tensorflow::Output() const
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::MatrixDiag Class Reference\n\ntensorflow::ops::MatrixDiag\n===========================\n\n`#include \u003carray_ops.h\u003e`\n\nReturns a batched diagonal tensor with a given batched diagonal values.\n\nSummary\n-------\n\nGiven a `diagonal`, this operation returns a tensor with the `diagonal` and everything else padded with zeros. The diagonal is computed as follows:\n\nAssume `diagonal` has `k` dimensions `[I, J, K, ..., N]`, then the output is a tensor of rank `k+1` with dimensions \\[I, J, K, ..., N, N\\]\\` where:\n\n`output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]`.\n\nFor example:\n\n\n```text\n# 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]\n```\n\n\u003cbr /\u003e\n\n\n```text\nand diagonal.shape = (2, 4)\n```\n\n\u003cbr /\u003e\n\n\n```scdoc\ntf.matrix_diag(diagonal) ==\u003e [[[1, 0, 0, 0]\n [0, 2, 0, 0]\n [0, 0, 3, 0]\n [0, 0, 0, 4]],\n [[5, 0, 0, 0]\n [0, 6, 0, 0]\n [0, 0, 7, 0]\n [0, 0, 0, 8]]]\n```\n\n\u003cbr /\u003e\n\n\n```perl6\nwhich has shape (2, 4, 4)\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- diagonal: Rank `k`, where `k \u003e= 1`.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Rank `k+1`, with `output.shape = diagonal.shape + [diagonal.shape[-1]]`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [MatrixDiag](#classtensorflow_1_1ops_1_1_matrix_diag_1a2b263945a55c830cec2aa8e732ad4c37)`(const ::`[tensorflow::Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` diagonal)` ||\n\n| ### Public attributes ||\n|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_matrix_diag_1a2a3f9fd08f8b6b8b5209a62bc2c0e4e4) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_matrix_diag_1aba2480ed932f279c48fc6028f6be7a92) | `::`[tensorflow::Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_matrix_diag_1aa1db7faefb57b9fee4eddaee99c3a5a3)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_matrix_diag_1ae38fc37ca0a5a229e9c9d3f827ebfa6d)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_matrix_diag_1aaaad00f636d2ad7be0fd131133b79006)`() 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### MatrixDiag\n\n```gdscript\n MatrixDiag(\n const ::tensorflow::Scope & scope,\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```"]]