Stack

public final class Stack

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

Nested Classes

class Stack.Options Optional attributes for Stack  

Constants

String OP_NAME The name of this op, as known by TensorFlow core engine

Public Methods

Output<T>
asOutput()
Returns the symbolic handle of the tensor.
static Stack.Options
axis(Long axis)
static <T extends TType> Stack<T>
create(Scope scope, Iterable<Operand<T>> values, Options... options)
Factory method to create a class wrapping a new Stack operation.
Output<T>
output()
The packed tensor.

Inherited Methods

Constants

public static final String OP_NAME

The name of this op, as known by TensorFlow core engine

Constant Value: "Pack"

Public Methods

public Output<T> asOutput ()

Returns the symbolic handle of the tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

public static Stack.Options axis (Long axis)

Parameters
axis Dimension along which to pack. Negative values wrap around, so the valid range is `[-(R+1), R+1)`.

public static Stack<T> create (Scope scope, Iterable<Operand<T>> values, Options... options)

Factory method to create a class wrapping a new Stack operation.

Parameters
scope current scope
values Must be of same shape and type.
options carries optional attributes values
Returns
  • a new instance of Stack

public Output<T> output ()

The packed tensor.