Unstack


tensorflow C++ API

tensorflow::ops::Unstack

Unpacks a given dimension of a rank-R tensor into num rank-(R-1) tensors.


Summary

Unpacksnumtensors fromvalueby chipping it along theaxisdimension. For example, given a tensor of shape(A, B, C, D);

Ifaxis == 0then the i'th tensor inoutputis the slicevalue[i, :, :, :]and each tensor inoutputwill have shape(B, C, D). (Note that the dimension unpacked along is gone, unlikesplit).

Ifaxis == 1then the i'th tensor inoutputis the slicevalue[:, i, :, :]and each tensor inoutputwill 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 to num.

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 from value.

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 to num.
  • 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 from value.

Using Method




※ stack과 반대의 기능을 한다. value에서 axis에 해당하는 차원을 빼내는 것이다. num의 값은 axis에 해당하는 차원의 size를 입력한다. num의 값이 size와 다르면 에러가 난다.

results matching ""

    No results matching ""