Unpacks the given dimension of a rank-R tensor into rank-(R-1) tensors.
Aliases:
tf.compat.v1.unstacktf.compat.v2.unstack
tf.unstack(
value,
num=None,
axis=0,
name='unstack'
)
Unpacks num tensors from value by chipping it along the axis dimension. If num is not specified (the default), it is inferred from value's shape. If value.shape[axis] is not known, ValueError is raised.
For example, given a tensor of shape (A, B, C, D);
If axis == 0 then the i'th tensor in output is the slice value[i, :, :, :] and each tensor in output will have shape (B, C, DB, C, D). (Note that the dimension unpacked along is gone, unlike ``).
If axis == 1 then the i'th tensor in output is the slice value[:, i, :, :] and each tensor in output will have shape (A, C, D). Etc.
This is the opposite of stack.
Args:
value: A rankR > 0Tensorto be unstacked.num: Anint. The length of the dimensionaxis. Automatically inferred ifNone(the default).
Returns:
The list of Tensor objects unstacked from value.
Raises:
ValueError: Ifnumis unspecified and cannot be inferred.ValueError: Ifaxisis out of the range [-R, R).