Unpacks a given dimension of a rank-`R`

tensor into `num`

rank-`(R-1)`

tensors.

tf.raw_ops.Unpack( value, num, axis=0, name=None )

Unpacks `num`

tensors from `value`

by chipping it along the `axis`

dimension. 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, D)`

. (Note that the dimension unpacked along is gone, unlike `split`

).

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 `pack`

.

Args | |
---|---|

`value` | A `Tensor` . 1-D or higher, with `axis` dimension size equal to `num` . |

`num` | An `int` that is `>= 0` . |

`axis` | An optional `int` . Defaults to `0` . Dimension along which to unpack. Negative values wrap around, so the valid range is `[-R, R)` . |

`name` | A name for the operation (optional). |

Returns | |
---|---|

A list of `num` `Tensor` objects with the same type as `value` . |

© 2020 The TensorFlow Authors. All rights reserved.

Licensed under the Creative Commons Attribution License 3.0.

Code samples licensed under the Apache 2.0 License.

https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/Unpack