tensorflow:: אופס:: GatherV2
#include <array_ops.h>
אסוף פרוסות מציר axis
params
לפי indices
.
תַקצִיר
indices
חייבים להיות טנסור שלם של כל מימד (בדרך כלל 0-D או 1-D). מייצר טנזור פלט עם הצורה params.shape[:axis] + indices.shape + params.shape[axis + 1:]
כאשר:
# Scalar indices (output is rank(params) - 1). output[a_0, ..., a_n, b_0, ..., b_n] = params[a_0, ..., a_n, indices, b_0, ..., b_n]
# Vector indices (output is rank(params)). output[a_0, ..., a_n, i, b_0, ..., b_n] = params[a_0, ..., a_n, indices[i], b_0, ..., b_n]
# Higher rank indices (output is rank(params) + rank(indices) - 1). output[a_0, ..., a_n, i, ..., j, b_0, ... b_n] = params[a_0, ..., a_n, indices[i, ..., j], b_0, ..., b_n]
שימו לב שב-CPU, אם נמצא אינדקס מחוץ לתחום, מוחזרת שגיאה. ב-GPU, אם נמצא אינדקס מחוץ לתחום, 0 מאוחסן בערך הפלט המתאים.
ראה גם tf.batch_gather
ו- tf.gather_nd
.
טיעונים:
- scope: אובייקט Scope
- params: הטנזור שממנו לאסוף ערכים. חייב להיות לפחות
axis + 1
. - מדדים: טנסור אינדקס. חייב להיות בטווח
[0, params.shape[axis])
. - ציר: הציר
params
שממנו יש לאסוףindices
. ברירת המחדל למימד הראשון. תומך באינדקסים שליליים.
החזרות:
-
Output
: ערכיםparams
שנאספו ממדדים שניתנו על ידיindices
, עם צורהparams.shape[:axis] + indices.shape + params.shape[axis + 1:]
.
בנאים והורסים | |
---|---|
GatherV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input params, :: tensorflow::Input indices, :: tensorflow::Input axis) | |
GatherV2 (const :: tensorflow::Scope & scope, :: tensorflow::Input params, :: tensorflow::Input indices, :: tensorflow::Input axis, const GatherV2::Attrs & attrs) |
תכונות ציבוריות | |
---|---|
operation | |
output |
תפקידים ציבוריים | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
פונקציות סטטיות ציבוריות | |
---|---|
BatchDims (int64 x) |
מבנים | |
---|---|
tensorflow:: ops:: GatherV2:: Attrs | קובעי תכונות אופציונליים עבור GatherV2 . |
תכונות ציבוריות
מִבצָע
Operation operation
תְפוּקָה
::tensorflow::Output output
תפקידים ציבוריים
GatherV2
GatherV2( const ::tensorflow::Scope & scope, ::tensorflow::Input params, ::tensorflow::Input indices, ::tensorflow::Input axis )
GatherV2
GatherV2( const ::tensorflow::Scope & scope, ::tensorflow::Input params, ::tensorflow::Input indices, ::tensorflow::Input axis, const GatherV2::Attrs & attrs )
צוֹמֶת
::tensorflow::Node * node() const
מפעיל::tensorflow::קלט
operator::tensorflow::Input() const
אופרטור::tensorflow::פלט
operator::tensorflow::Output() const
פונקציות סטטיות ציבוריות
BatchDims
Attrs BatchDims( int64 x )
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],[],null,["# tensorflow::ops::GatherV2 Class Reference\n\ntensorflow::ops::GatherV2\n=========================\n\n`#include \u003carray_ops.h\u003e`\n\n[Gather](/versions/r1.15/api_docs/cc/class/tensorflow/ops/gather#classtensorflow_1_1ops_1_1_gather) slices from `params` axis `axis` according to `indices`.\n\nSummary\n-------\n\n`indices` must be an integer tensor of any dimension (usually 0-D or 1-D). Produces an output tensor with shape `params.shape[:axis] + indices.shape + params.shape[axis + 1:]` where:\n\n\n```scdoc\n # Scalar indices (output is rank(params) - 1).\n output[a_0, ..., a_n, b_0, ..., b_n] =\n params[a_0, ..., a_n, indices, b_0, ..., b_n]\n```\n\n\u003cbr /\u003e\n\n\n```transact-sql\n # Vector indices (output is rank(params)).\n output[a_0, ..., a_n, i, b_0, ..., b_n] =\n params[a_0, ..., a_n, indices[i], b_0, ..., b_n]\n```\n\n\u003cbr /\u003e\n\n\n```scdoc\n # Higher rank indices (output is rank(params) + rank(indices) - 1).\n output[a_0, ..., a_n, i, ..., j, b_0, ... b_n] =\n params[a_0, ..., a_n, indices[i, ..., j], b_0, ..., b_n]\n```\n\n\u003cbr /\u003e\n\n\n\u003cbr /\u003e\n\nNote that on CPU, if an out of bound index is found, an error is returned. On GPU, if an out of bound index is found, a 0 is stored in the corresponding output value.\n\nSee also `tf.batch_gather` and `tf.gather_nd`.\n\nArguments:\n\n- scope: A [Scope](/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- params: The tensor from which to gather values. Must be at least rank `axis + 1`.\n- indices: Index tensor. Must be in range `[0, params.shape[axis])`.\n- axis: The axis in `params` to gather `indices` from. Defaults to the first dimension. Supports negative indexes.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Values from `params` gathered from indices given by `indices`, with shape `params.shape[:axis] + indices.shape + params.shape[axis + 1:]`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [GatherV2](#classtensorflow_1_1ops_1_1_gather_v2_1afff9f85abc36b6134f07ac9264e6b6b7)`(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)` params, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` axis)` ||\n| [GatherV2](#classtensorflow_1_1ops_1_1_gather_v2_1a8f8e2e0c5f4693b13f8a2c747ff77d8b)`(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)` params, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` indices, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` axis, const `[GatherV2::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/gather-v2/attrs#structtensorflow_1_1ops_1_1_gather_v2_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_gather_v2_1acada34664fa1ed40763d7823796966d3) | [Operation](/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_gather_v2_1a8d4dd95b0f18afade1621c680ecdac1a) | `::`[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_gather_v2_1abc465824a7b865f5bdfa41eb624a1bb7)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_gather_v2_1a967966fdcae665e9578c3e9512e18b4c)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_gather_v2_1a5f58668891b9a0ae4a460fe84c7b4d5c)`() const ` | ` ` ` ` |\n\n| ### Public static functions ||\n|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| [BatchDims](#classtensorflow_1_1ops_1_1_gather_v2_1a96a2555cae1e27560651b09777fece7c)`(int64 x)` | [Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/gather-v2/attrs#structtensorflow_1_1ops_1_1_gather_v2_1_1_attrs) |\n\n| ### Structs ||\n|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::GatherV2::Attrs](/versions/r1.15/api_docs/cc/struct/tensorflow/ops/gather-v2/attrs) | Optional attribute setters for [GatherV2](/versions/r1.15/api_docs/cc/class/tensorflow/ops/gather-v2#classtensorflow_1_1ops_1_1_gather_v2). |\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### GatherV2\n\n```gdscript\n GatherV2(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input params,\n ::tensorflow::Input indices,\n ::tensorflow::Input axis\n)\n``` \n\n### GatherV2\n\n```gdscript\n GatherV2(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input params,\n ::tensorflow::Input indices,\n ::tensorflow::Input axis,\n const GatherV2::Attrs & attrs\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``` \n\nPublic static functions\n-----------------------\n\n### BatchDims\n\n```text\nAttrs BatchDims(\n int64 x\n)\n```"]]