SpaceToDepth for tensors of type T.
Rearranges blocks of spatial data, into depth. More specifically, this op outputs a copy of the input tensor where values from the `height` and `width` dimensions are moved to the `depth` dimension. The attr `block_size` indicates the input block size.
* Non-overlapping blocks of size `block_size x block size` are rearranged into depth at each location. * The depth of the output tensor is `block_size * block_size * input_depth`. * The Y, X coordinates within each block of the input become the high order component of the output channel index. * The input tensor's height and width must be divisible by block_size.
The `data_format` attr specifies the layout of the input and output tensors with the following options: "NHWC": `[ batch, height, width, channels ]` "NCHW": `[ batch, channels, height, width ]` "NCHW_VECT_C": `qint8 [ batch, channels / 4, height, width, 4 ]`
It is useful to consider the operation as transforming a 6-D Tensor. e.g. for data_format = NHWC, Each element in the input tensor can be specified via 6 coordinates, ordered by decreasing memory layout significance as: n,oY,bY,oX,bX,iC (where n=batch index, oX, oY means X or Y coordinates within the output image, bX, bY means coordinates within the input block, iC means input channels). The output would be a transpose to the following layout: n,oY,oX,bY,bX,iC
This operation is useful for resizing the activations between convolutions (but keeping all data), e.g. instead of pooling. It is also useful for training purely convolutional models.
For example, given an input of shape `[1, 2, 2, 1]`, data_format = "NHWC" and block_size = 2:
x = [[[[1], [2]],
[[3], [4]]]]
[[[[1, 2, 3, 4]]]]
For an input tensor with larger depth, here of shape `[1, 2, 2, 3]`, e.g.
x = [[[[1, 2, 3], [4, 5, 6]],
[[7, 8, 9], [10, 11, 12]]]]
[[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
x = [[[[1], [2], [5], [6]],
[[3], [4], [7], [8]],
[[9], [10], [13], [14]],
[[11], [12], [15], [16]]]]
x = [[[[1, 2, 3, 4],
[5, 6, 7, 8]],
[[9, 10, 11, 12],
[13, 14, 15, 16]]]]
Nested Classes
class | SpaceToDepth.Options | Optional attributes for SpaceToDepth
|
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 <T extends TType> SpaceToDepth<T> |
create(Scope scope, Operand<T> input, Long blockSize, Options... options)
Factory method to create a class wrapping a new SpaceToDepth operation.
|
static SpaceToDepth.Options |
dataFormat(String dataFormat)
|
Output<T> |
output()
|
Inherited Methods
Constants
public static final String OP_NAME
The name of this op, as known by TensorFlow core engine
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 SpaceToDepth<T> create (Scope scope, Operand<T> input, Long blockSize, Options... options)
Factory method to create a class wrapping a new SpaceToDepth operation.
Parameters
scope | current scope |
---|---|
blockSize | The size of the spatial block. |
options | carries optional attributes values |
Returns
- a new instance of SpaceToDepth