tensorflow::ops::GatherV2
#include <array_ops.h>
Gather срезы из params оси axis в соответствии с indices.
Краткое описание
indices должна быть целочисленным тензором любой размерности (обычно 0-й или 1-й). Создаёт выходной тензор с формой params.shape[:axis] + indices.shape[batch_dims:] + 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. - indices: Тензор индексов. Должен находиться в диапазоне
[0, params.shape[axis]). - 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 operation
output
::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 )
node
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Общедоступные статические функции
BatchDims
Attrs BatchDims( int64 x )
© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/cc/class/tensorflow/ops/gather-v2