Article / Updated 06-19-2018
An application must specify the shape of each tensor to be created. The tf package provides functions that update tensors and their shapes after creation. This table lists these transformation functions and provides a description of each.Functions for Transforming Tensors
Function
Description
cast(tensor, dtype, name=None)
Changes the tensor's data type to the given type
reshape(tensor, shape, name=None)
Returns a tensor with the same elements as the given tensor with the given shape
squeeze(tensor, axis=None, name=None, squeeze_dims=None)
Removes dimensions of size 1
reverse(tensor, axis, name=None)
Reverses given dimensions of the tensor
slice(tensor, begin, size, name=None)
Extracts a portion of a tensor
stack(tensors, axis=0, name='stack')
Combines a list of tensors into a tensor of greater rank
unstack(tensor, num=None, axis=0, name='unstack')
Splits a tensor into a list of tensors of lesser rank
Despite its name, reshape doesn't modify an existing tensor.