Google I/O is a wrap! Catch up on TensorFlow sessions View sessions


Packs a list of N rank-R tensors into one rank-(R+1) tensor.

Packs the N tensors in values into a tensor with rank one higher than each tensor in values, by packing them along the axis dimension. Given a list of tensors of shape (A, B, C);

if axis == 0 then the output tensor will have the shape (N, A, B, C). if axis == 1 then the output 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 of unpack.

values A list of at least 1 Tensor objects with the same type. Must be of same shape and type.
axis An optional int. Defaults to 0. Dimension along which to pack. Negative values wrap around, so the valid range is [-(R+1), R+1).
name A name for the operation (optional).

A Tensor. Has the same type as values.