Unstack
tensorflow C++ API
Unpacks a given dimension of a rank-R
tensor into num
rank-(R-1)
tensors.
Summary
Unpacksnum
tensors fromvalue
by chipping it along theaxis
dimension. For example, given a tensor of shape(A, B, C, D)
;
Ifaxis == 0
then the i'th tensor inoutput
is the slicevalue[i, :, :, :]
and each tensor inoutput
will have shape(B, C, D)
. (Note that the dimension unpacked along is gone, unlikesplit
).
Ifaxis == 1
then the i'th tensor inoutput
is the slicevalue[:, i, :, :]
and each tensor inoutput
will have shape(A, C, D)
. Etc.
This is the opposite ofpack
.
Arguments:
- scope: A Scope object
- value: 1-D or higher, with
axis
dimension size equal tonum
.
Optional attributes (seeAttrs
):
- axis: Dimension along which to unpack. Negative values wrap around, so the valid range is
[-R, R)
.
Returns:
OutputList
: The list of tensors unpacked fromvalue
.
Unstack 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 value: 1-D or higher, with
axis
dimension size equal tonum
. - Int64 num: size of the selected dimension.
- Unstack::Attrs attr:
- axis: index value and select the dimension.
Output:
- Output output: Output object of Unstack class object.
Result:
- std::vector(Tensor)
result_output
: The list of tensors unpacked fromvalue
.
Using Method
※ stack과 반대의 기능을 한다. value에서 axis에 해당하는 차원을 빼내는 것이다. num의 값은 axis에 해당하는 차원의 size를 입력한다. num의 값이 size와 다르면 에러가 난다.