GatherV2


tensorflow C++ API

tensorflow::ops::GatherV2

Gather slices from params axis axis according to indices.


Summary

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:

```python 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] ```

Arguments:

  • scope: A Scope object
  • params: The tensor from which to gather values. Must be at least rank axis + 1.
  • indices: Index tensor. Must be in range [0, params.shape[axis]).
  • axis: The axis in params to gather indices from. Defaults to the first dimension. Supports negative indexes.

Returns:

  • Output: Values from params gathered from indices given by indices , with shape params.shape[:axis] + indices.shape + params.shape[axis + 1:].

GatherV2 block

Source link :https://github.com/EXPNUNI/enuSpaceTensorflow/blob/master/enuSpaceTensorflow/tf_array_ops.cpp

Argument:

  • Scope scope : A Scope object (A scope is generated automatically each page. A scope is not connected.)
  • params: The tensor from which to gather values. Must be at least rank axis + 1.
  • indices: Index tensor. Must be in range [0, params.shape[axis]).
  • axis: The axis in params to gather indices from. Defaults to the first dimension. Supports negative indexes.

Output:

  • output : Output object of GatherV2 class object.

Result:

  • std::vector(Tensor) result_output: A Tensor. Values from params gathered from indices given by indices, with shape params.shape[:axis] + indices.shape + params.shape[axis + 1:].

Using Method


※ axis로 차원을 선택하고, indices의 index값으로 해당하는 값을 가져오는 방식은 비슷하다. axis값의 차원에 indices의 인덱스 값에 해당하는 값을 가져온다.

※ 위와 동일한 환경에서 indices의 값만 [0,0] 으로 바꾸면 위와 같은 그림이 나온다.

results matching ""

    No results matching ""