Constant padding mode.
Constant padding mode.
The op pads input
with zeros according to the paddings
you specify. paddings
is an integer tensor with shape
[n, 2]
, where n
is the rank of input
. For each dimension D
of input
, paddings(D, 0)
indicates how many
zeros to add before the contents of input
in that dimension, and paddings(D, 1)
indicates how many zeros to
add after the contents of input
in that dimension.
The padded size of each dimension D
of the output is equal to
paddings(D, 0) + input.shape(D) + paddings(D, 1)
.
For example:
// 'input' = [[1, 2, 3], [4, 5, 6]] // 'paddings' = [[1, 1], [2, 2]] tf.pad(input, paddings, tf.ConstantPadding(0)) ==> [[0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 2, 3, 0, 0], [0, 0, 4, 5, 6, 0, 0], [0, 0, 0, 0, 0, 0, 0]]
Padding mode.
Padding mode.
Reflective padding mode.
Reflective padding mode.
The op pads input
with mirrored values according to the paddings
you specify. paddings
is an integer tensor
with shape [n, 2]
, where n
is the rank of input
. For each dimension D
of input
, paddings(D, 0)
indicates how many values to add before the contents of input
in that dimension, and paddings(D, 1)
indicates
how many values to add after the contents of input
in that dimension. Both paddings(D, 0)
and paddings(D, 1)
must be no greater than input.shape(D) - 1
.
The padded size of each dimension D
of the output is equal to
paddings(D, 0) + input.shape(D) + paddings(D, 1)
.
For example:
// 'input' = [[1, 2, 3], [4, 5, 6]] // 'paddings' = [[1, 1], [2, 2]] tf.pad(input, paddings, tf.ReflectivePadding) ==> [[6, 5, 4, 5, 6, 5, 4], [3, 2, 1, 2, 3, 2, 1], [6, 5, 4, 5, 6, 5, 4], [3, 2, 1, 2, 3, 2, 1]]
Symmetric padding mode.
Symmetric padding mode.
The op pads input
with mirrored values according to the paddings
you specify. paddings
is an integer tensor
with shape [n, 2]
, where n
is the rank of input
. For each dimension D
of input
, paddings(D, 0)
indicates how many values to add before the contents of input
in that dimension, and paddings(D, 1)
indicates
how many values to add after the contents of input
in that dimension. Both paddings(D, 0)
and paddings(D, 1)
must be no greater than input.shape(D)
.
The padded size of each dimension D
of the output is equal to
paddings(D, 0) + input.shape(D) + paddings(D, 1)
.
For example:
// 'input' = [[1, 2, 3], [4, 5, 6]] // 'paddings' = [[1, 1], [2, 2]] tf.pad(input, paddings, tf.SymmetricPadding) ==> [[2, 1, 1, 2, 3, 3, 2], [2, 1, 1, 2, 3, 3, 2], [5, 4, 4, 5, 6, 6, 5], [5, 4, 4, 5, 6, 6, 5]]
$OpDocBasicBatchToSpace
$OpDocBasicBatchToSpace
4
-dimensional input tensor with shape [batch, height, width, depth]
.
Block size which must be greater than 1
.
2
-dimensional INT32 or INT64 tensor containing non-negative integers with shape
[2, 2]
.
Name for the created op.
Created op output.
$OpDocBasicBatchToSpaceND
$OpDocBasicBatchToSpaceND
N
-dimensional tensor with shape inputShape = [batch] + spatialShape + remainingShape
, where
spatialShape has M
dimensions.
One-dimensional INT32 or INT64 tensor with shape [M]
whose elements must all be
>= 1
.
Two-dimensional INT32 or INT64 tensor with shape [M, 2]
whose elements must all be
non-negative. crops(i) = [cropStart, cropEnd]
specifies the amount to crop from input
dimension i + 1
, which corresponds to spatial dimension i
. It is required that
cropStart(i) + cropEnd(i) <= blockShape(i) * inputShape(i + 1)
.
Name for the created op.
Created op output.
$OpDocBasicBooleanMask
$OpDocBasicBooleanMask
N
-dimensional tensor.
K
-dimensional boolean tensor, where K <= N
and K
must be known statically.
Name for the created op output.
Created op output.
$OpDocBasicBroadcastGradientArguments
$OpDocBasicBroadcastGradientArguments
First operand shape.
Second operand shape.
Name for the created op.
Tuple containing two op outputs, each containing the reduction indices for the corresponding op.
$OpDocBasicBroadcastShape
$OpDocBasicBroadcastShape
One-dimensional integer tensor representing the shape of the first argument.
One-dimensional integer tensor representing the shape of the first argument.
Name for the created op.
Created op output, which is a one-dimensional integer tensor representing the broadcasted shape.
$OpDocBasicBroadcastTo
$OpDocBasicBroadcastTo
Tensor to broadcast.
Shape to broadcast the provided tensor to.
Name for the created op.
Created op output.
$OpDocBasicCheckNumerics
$OpDocBasicCheckNumerics
Input tensor.
Prefix to print for the error message.
Name for the created op.
Created op output, which has the same value as the input tensor.
$OpDocBasicConcatenate
$OpDocBasicConcatenate
Input tensors to be concatenated.
Dimension along which to concatenate the input tensors. As in Python, indexing for the axis is
0-based. Positive axes in the range of [0, rank(values))
refer to the axis
-th dimension, and
negative axes refer to the axis + rank(inputs)
-th dimension.
Name for the created op.
Created op output.
$OpDocBasicConstant
$OpDocBasicConstant
Constant value.
Data type of the resulting tensor. If not provided, its value will be inferred from the type
of value
.
Shape of the resulting tensor.
Name for the created op.
Created op output.
InvalidShapeException
If shape != null
, verifyShape == true
, and the shape of values does not match
the provided shape
.
$OpDocBasicDepthToSpace
$OpDocBasicDepthToSpace
4
-dimensional input tensor with shape [batch, height, width, depth]
.
Block size which must be greater than 1
.
Format of the input and output data.
Name for the created op.
Created op output.
$OpDocBasicEditDistance
$OpDocBasicEditDistance
Sparse tensor that contains the hypothesis sequences.
Sparse tensor that contains the truth sequences.
Optional boolean value indicating whether to normalize the Levenshtein distance by the length
of truth
.
Name for the created op.
Created op output.
$OpDocBasicExpandDims
$OpDocBasicExpandDims
Input tensor.
Dimension index at which to expand the shape of input
.
Name for the created op.
Created op output.
$OpDocBasicFill
$OpDocBasicFill
Optional data type for the created tensor.
Shape of the output tensor.
Value to fill the output tensor.
Name for the created op.
Created op output.
$OpDocBasicGather
$OpDocBasicGather
Tensor from which to gather values.
Tensor containing indices to gather.
Tensor containing the axis along which to gather.
Name for the created op.
Created op output.
$OpDocBasicGatherND
$OpDocBasicGatherND
Tensor from which to gather values.
Tensor containing indices to gather.
Name for the created op.
Created op output that contains the values from input
gathered from indices given by indices
, with
shape indices.shape(::-1) + input.shape(indices.shape(-1)::)
.
$OpDocBasicGuaranteeConstant
$OpDocBasicGuaranteeConstant
Input tensor to guarantee that is constant.
Name for the created op.
Created op output which is equal to the input tensor.
$OpDocBasicIdentity
$OpDocBasicIdentity
Input tensor.
Name for the created op.
Created op output.
$OpDocBasicIndexedSlicesMask
$OpDocBasicIndexedSlicesMask
Input indexed slices.
One-dimensional tensor containing the indices of the elements to mask.
Name for the created op.
Created op output.
$OpDocBasicInvertPermutation
$OpDocBasicListDiff
$OpDocBasicListDiff
One-dimensional tensor containing the values to keep.
One-dimensional tensor containing the values to remove.
Data type to use for the output indices of this op. Must be INT32 or INT64.
Name for the created op.
Tuple containing output
and indices
, from the method description.
$OpDocBasicMatrixTranspose
$OpDocBasicMatrixTranspose
Input tensor to transpose.
If true
, then the complex conjugate of the transpose result is returned.
Name for the created op.
Created op output.
$OpDocBasicMeshGrid
$OpDocBasicMeshGrid
Sequence containing N
input rank-1
tensors.
If true
(the default value), the broadcasting instructions for the first two
dimensions are swapped.
Name for the created op.
Created op outputs, each with rank N
.
$OpDocBasicOneHot
$OpDocBasicOneHot
Tensor containing the indices for the "on" values.
Scalar tensor defining the depth of the one-hot dimension.
Scalar tensor defining the value to fill in the output i
th value, when indices[j] = i
.
Defaults to the value 1
with type dataType
.
Scalar tensor defining the value to fill in the output i
th value, when indices[j] != i
.
Defaults to the value 0
with type dataType
.
Axis to fill. Defaults to -1
, representing the last axis.
Data type of the output tensor. If not provided, the function will attempt to assume the data
type of onValue
or offValue
, if one or both are passed in. If none of onValue
, offValue
,
or dataType
are provided, dataType
will default to the FLOAT32
data type.
Name for the created op.
Created op output.
$OpDocBasicOnes
$OpDocBasicOnes
Tensor data type.
Tensor shape.
Name for the created op.
Created op output.
$OpDocBasicOnesLike
$OpDocBasicOnesLike
Input tensor.
Data type of the output tensor.
Boolean flag indicating whether to optimize this op if the shape of input
is known at graph
creation time.
Name for the created op.
Created op output.
$OpDocBasicPad
$OpDocBasicParallelStack
$OpDocBasicParallelStack
Input tensors to be stacked.
Name for the created op.
Created op output.
$OpDocBasicPlaceholder
$OpDocBasicPlaceholder
Data type of the elements in the tensor that will be fed.
Shape of the tensor that will be fed. The shape can be any partially-specified, or even completely unknown.
Name for the created op.
Created op output.
$OpDocBasicPlaceholderWithDefault
$OpDocBasicPlaceholderWithDefault
Default value to pass through when no input is fed for this placeholder.
Shape of the tensor that will be fed. The shape can be any partially-specified, or even completely unknown.
Name for the created op.
Created op output.
$OpDocBasicPreventGradient
$OpDocBasicPreventGradient
Input tensor.
Message to print along with the error.
Name for the created op.
Created op output, which has the same value as the input tensor.
$OpDocBasicRank
$OpDocBasicRank
Tensor whose rank to return.
Optional data type to use for the output of this op.
Boolean flag indicating whether to optimize this op creation by using a constant op with the
rank value that input
has at graph creation time (instead of execution time), if known.
Name for the created op.
Created op output.
$OpDocBasicRequiredSpaceToBatchPaddingsAndCrops
$OpDocBasicRequiredSpaceToBatchPaddingsAndCrops
INT32
tensor with shape [N]
.
INT32
tensor with shape [N]
.
Optional INT32
tensor with shape [N, 2]
that specifies the minimum amount of padding to
use. All elements must be non-negative. Defaults to a tensor containing all zeros.
Created op name.
Tuple containing the paddings and crops required.
$OpDocBasicReshape
$OpDocBasicReshape
Input tensor.
Shape of the output tensor.
Name for the created op.
Created op output.
$OpDocBasicReverse
$OpDocBasicReverseSequence
$OpDocBasicReverseSequence
Input tensor to reverse.
One-dimensional tensor with length input.shape(batchAxis)
and
max(sequenceLengths) <= input.shape(sequenceAxis)
.
Tensor dimension which is partially reversed.
Tensor dimension along which the reversal is performed.
Created op name.
Created op output which has the same shape as input
.
$OpDocBasicScatterND
$OpDocBasicScatterND
Indices tensor (must have INT32
or INT64
data type).
Updates to scatter into the output tensor.
One-dimensional INT32
or INT64
tensor specifying the shape of the output tensor.
Name for the created op.
Created op output.
$OpDocBasicSequenceMask
$OpDocBasicSequenceMask
One-dimensional integer tensor containing the lengths to keep for each row. If maxLength
is
provided, then all values in lengths
must be smaller than maxLength
.
Scalar integer tensor representing the maximum length of each row. Defaults to the maximum value
in lengths
.
Data type for the output tensor.
Name for the created op.
Created op output.
IllegalArgumentException
If maxLength
is not a scalar.
$OpDocBasicShape
$OpDocBasicShape
Tensor whose shape to return.
Optional data type to use for the output of this op.
Boolean flag indicating whether to optimize this op creation by using a constant op with the
shape of that input
at graph creation time (instead of execution time), if known.
Name for the created op.
Created op output, which is one-dimensional.
$OpDocBasicShapeN
$OpDocBasicShapeN
Tensors whose shapes to return.
Optional data type to use for the outputs of this op.
Name for the created op.
Created op outputs, all of which are one-dimensional.
$OpDocBasicSize
$OpDocBasicSize
Tensor whose size to return.
Optional data type to use for the output of this op.
Boolean flag indicating whether to optimize this op creation by using a constant op with the
number of elements provided by the shape of that input
at graph creation time (instead of
execution time), if known.
Name for the created op.
Created op output.
$OpDocBasicSlice
$OpDocBasicSlice
Tensor to slice.
Begin index tensor (must have data type of INT32
or INT64
). begin(i)
specifies the offset into
the i
th dimension of input
to slice from.
Slice size tensor (must have data type of INT32
or INT64
). size(i)
specifies the number of
elements of the i
th dimension of input
to slice. If size(i) == -1
, then all the remaining
elements in dimension i
are included in the slice (i.e., this is equivalent to setting
size(i) = input.shape(i) - begin(i)
).
Name for the created op.
Created op output.
$OpDocBasicSpaceToBatch
$OpDocBasicSpaceToBatch
4
-dimensional input tensor with shape [batch, height, width, depth]
.
Block size which must be greater than 1
.
2
-dimensional INT32 or INT64 tensor containing non-negative integers with shape
[2, 2]
.
Name for the created op.
Created op output.
$OpDocBasicSpaceToBatchND
$OpDocBasicSpaceToBatchND
N
-dimensional tensor with shape inputShape = [batch] + spatialShape + remainingShape
, where
spatialShape has M
dimensions.
One-dimensional INT32 or INT64 tensor with shape [M]
whose elements must all be
>= 1
.
Two-dimensional INT32 or INT64 tensor with shape [M, 2]
whose elements must all be
non-negative. paddings(i) = [padStart, padEnd]
specifies the padding for input dimension
i + 1
, which corresponds to spatial dimension i
. It is required that blockShape(i)
divides inputShape(i + 1) + padStart + padEnd
.
Name for the created op.
Created op output.
$OpDocBasicSpaceToDepth
$OpDocBasicSpaceToDepth
4
-dimensional input tensor with shape [batch, height, width, depth]
.
Block size which must be greater than 1
.
Format of the input and output data.
Name for the created op.
Created op output.
$OpDocBasicSparsePlaceholder
$OpDocBasicSparsePlaceholder
Data type of the elements in the tensor that will be fed.
Shape of the tensor that will be fed. The shape can be any partially-specified, or even completely unknown. This represents the shape of the dense tensor that corresponds to the sparse tensor that this placeholder refers to.
Name for the created op.
Created op output.
$OpDocBasicSplit
$OpDocBasicSplit
Input tensor to split.
Sizes for the splits to obtain.
Dimension along which to split the input tensor.
Name for the created op.
Created op outputs.
$OpDocBasicSplitEvenly
$OpDocBasicSplitEvenly
Input tensor to split.
Number of splits to obtain along the axis
dimension.
Dimension along which to split the input tensor.
Name for the created op.
Created op outputs.
$OpDocBasicSqueeze
$OpDocBasicSqueeze
Input tensor.
Dimensions of size 1 to squeeze. If this argument is not provided, then all dimensions of size 1 will be squeezed.
Name for the created op.
Created op output.
$OpDocBasicStack
$OpDocBasicStack
Input tensors to be stacked.
Dimension along which to stack the input tensors.
Name for the created op.
Created op output.
$OpDocBasicStopGradient
$OpDocBasicStopGradient
Input tensor.
Name for the created op.
Created op output, which has the same value as the input tensor.
$OpDocBasicStridedSlice
$OpDocBasicStridedSlice
Tensor to slice.
One-dimensional integer tensor. begin(i)
specifies the begin offset into the i
th range
specification. The exact dimension this corresponds to will be determined by context.
Out-of-bounds values will be silently clamped. If the i
th bit of beginMask
is 1
, then
begin(i)
is ignored and the full range of the appropriate dimension is used instead.
Negative values causes indexing to start from the highest element.
One-dimensional integer tensor. end(i)
is like begin(i)
with the exception that it
determines the end offset into the i
th range specification, and that endMask
is used to
determine full ranges.
One-dimensional integer tensor. strides(i)
specifies the increment in the i
th range
specification after extracting a given element. Negative indices will reverse the original
order. Out-of-bounds values are clamped to [0, shape(i)) if slice(i) > 0
or
[-1, shape(i) - 1] if slice(i) < 0
.
Integer value representing a bitmask where bit i
being 1
means to ignore the begin
value and instead use the largest interval possible. At runtime begin(i)
will be replaced
with [0, shape(i) - 1) if stride(i) > 0
or [-1, shape(i) - 1]
if stride(i) < 0
.
Integer value analogous to beginMask
, but for specifying the end offset of the slice.
Integer value representing a bitmask where bit i
being 1
means that the i
th position
is actually an ellipsis. At most one bit can be 1
. If ellipsisMask == 0
, then an
implicit ellipsis mask with value 1 << (m + 1)
is provided. This means that
foo(3 :: 5) == foo(3 :: 5, ---)
. An ellipsis implicitly creates as many range
specifications as necessary to fully specify the sliced range for every dimension. For
example, for a 4-dimensional tensor foo
the slice foo(2, ---, 5 :: 8)
implies
foo(2, ::, ::, 5 :: 8)
.
Integer value representing a bitmask where bit i
being 1
means that the i
th range
specification creates a new dimension with size 1
. For example,
foo(0 :: 4, NewAxis, 0 :: 2)
will produce a tensor with shape [4, 1, 2]
.
Integer value representing a bitmask where bit i
being 1
means that the i
th range
specification should shrink the dimensionality. begin
and end
must imply a slice of
size 1
in the dimension. For example, in foo(0 :: 4, 3, 0 :: 2)
would result in a
tensor with shape [4, 2]
.
Name for the created op.
Created op output.
$OpDocBasicTile
$OpDocBasicTile
Tensor to tile.
One-dimensional tensor containing the tiling multiples. Its length must be the same as the rank
of input
.
Name for the created op.
Created op output.
$OpDocBasicTranspose
$OpDocBasicTranspose
Input tensor to transpose.
Permutation of the input tensor dimensions.
If true
, then the complex conjugate of the transpose result is returned.
Name for the created op.
Created op output.
$OpDocBasicUnique
$OpDocBasicUniqueWithCounts
$OpDocBasicUnstack
$OpDocBasicUnstack
Rank R > 0
Tensor
to be unstacked.
Number of tensors to unstack. If set to -1
(the default value), its value will be inferred.
Dimension along which to unstack the input tensor.
Name for the created op.
Created op outputs.
IllegalArgumentException
If number
is not specified and its value cannot be inferred.
IndexOutOfBoundsException
If axis
is not within the range [-R, R).
$OpDocBasicWhere
$OpDocBasicWhere
Input boolean tensor.
Name for the created op.
Created op output.
$OpDocBasicZeros
$OpDocBasicZeros
Tensor data type.
Tensor shape.
Name for the created op.
Created op output.
$OpDocBasicZerosLike
$OpDocBasicZerosLike
Input tensor.
Data type of the output tensor.
Boolean flag indicating whether to optimize this op if the shape of input
is known at graph
creation time.
Name for the created op.
Created op output.