unstack

dragon.vm.tensorflow.unstack(
  value,
  num=None,
  axis=0,
  copy=True,
  name=None
)[source]

Unpack input into chunks along the given axis.

The number of outputs should be equal to the dimension of axis:

x = tf.constant([[1, 2, 3], [4, 5, 6]])
# Shape: (2, 3) -> (3,), (3,)
print(tf.unstack(x, axis=0))

axis can be negative:

x = tf.constant([[1, 2, 3], [4, 5, 6]])
# Shape: (2, 3) -> (2,), (2,), (2,)
print(tf.unstack(x, axis=-1))
Parameters:
  • value (dragon.Tensor) – The input tensor.
  • num (int, optional) – The number of outputs.
  • axis (int, optional, default=0) – The axis to unpack.
  • copy (bool, optional, default=True) – Copy or create the views of input.
  • name (str, optional) – The operation name.
Returns:

Sequence[dragon.Tensor] – The output tensors.