Stack
tensorflow C++ API
Packs a list of N
rank-R
tensors into one rank-(R+1)
tensor.
Summary
Packs theN
tensors invalues
into a tensor with rank one higher than each tensor invalues
, by packing them along theaxis
dimension. Given a list of tensors of shape(A, B, C)
;
ifaxis == 0
then theoutput
tensor will have the shape(N, A, B, C)
. ifaxis == 1
then theoutput
tensor will have the shape(A, N, B, C)
. Etc.
For example:
``` 'x' is [1, 4]
'y' is [2, 5]
'z' is [3, 6]
pack([x, y, z]) => [[1, 4], [2, 5], [3, 6]] # Pack along first dim. pack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]] ```
This is the opposite ofunpack
.
Arguments:
- scope: A Scope object
- values: Must be of same shape and type.
Optional attributes (seeAttrs
):
- axis: Dimension along which to pack. Negative values wrap around, so the valid range is
[-(R+1), R+1)
.
Returns:
Output
: The packed tensor.
Stack 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.)
- InputList values: Must be of same shape and type.
- Squeeze::Attrs attrs:
- axis: Dimension along which to pack. Negative values wrap around, so the valid range is
[-(R+1), R+1)
.
- axis: Dimension along which to pack. Negative values wrap around, so the valid range is
Output:
- Output output: Output object of Stack class object.
Result:
- std::vector(Tensor)
result_output
: The output tensor.
Using Method
※ list로 들어오는 tensor를 합쳐주는 기능을 한다. axis는 합칠 차원을 선택하는 역할을 한다.