Gather
tensorflow C++ API
Gather slices from params
according to indices
.
Summary
indices
must be an integer tensor of any dimension (usually 0-D or 1-D). Produces an output tensor with shapeindices.shape + params.shape[1:]
where:
```
python Scalar indices
output[:, ..., :] = params[indices, :, ... :]
Vector indices
output[i, :, ..., :] = params[indices[i], :, ... :]
Higher rank indices
output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :]
```
Ifindices
is a permutation andlen(indices) == params.shape[0]
then this operation will permuteparams
accordingly.
validate_indices
: DEPRECATED. If this operation is assigned to CPU, values inindices
are always validated to be within range. If assigned to GPU, out-of-bound indices result in safe but unspecified behavior, which may include raising an error.
Arguments:
- scope: A Scope object
Returns:
Output
: The output tensor.
Gather 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.)
- Input
params
: ATensor
. The tensor from which to gather values. - Input
indices
:ATensor
. must be an integer tensor of any dimension (usually 0-D or 1-D). In the value of params index num.
Output:
- output : Output object of Gather class object.
Result:
- std::vector(Tensor)
result_output
: ATensor
. Has the same type asparams
. Values fromparams
gathered from indices given byindices
.
Using Method
※ 위 그림에서 설명하듯 params의 값을 indices의 index값에 맞도록 가져온다.