@Namespace(value="tensorflow::ops") @NoOffset public static class tensorflow.SpaceToDepth extends Pointer
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]]]]
This operation will output a tensor of shape [1, 1, 1, 4]:
[[[[1, 2, 3, 4]]]]
Here, the input has a batch of 1 and each batch element has shape [2, 2, 1],
the corresponding output will have a single element (i.e. width and height are
both 1) and will have a depth of 4 channels (1 * block_size * block_size).
The output element shape is [1, 1, 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]]]]
This operation, for block_size of 2, will return the following tensor of shape
[1, 1, 1, 12]
[[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
Similarly, for the following input of shape [1 4 4 1], and a block size of 2:
x = [[[[1], [2], [5], [6]],
[[3], [4], [7], [8]],
[[9], [10], [13], [14]],
[[11], [12], [15], [16]]]]
the operator will return the following tensor of shape [1 2 2 4]:
x = [[[[1, 2, 3, 4],
[5, 6, 7, 8]],
[[9, 10, 11, 12],
[13, 14, 15, 16]]]]
Arguments:
* scope: A Scope object
* block_size: The size of the spatial block.
Returns:
* Output: The output tensor.| Modifier and Type | Class and Description |
|---|---|
static class |
tensorflow.SpaceToDepth.Attrs
Optional attribute setters for SpaceToDepth
|
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator| Constructor and Description |
|---|
SpaceToDepth(Pointer p)
Pointer cast constructor.
|
SpaceToDepth(tensorflow.Scope scope,
tensorflow.Input input,
long block_size) |
SpaceToDepth(tensorflow.Scope scope,
tensorflow.Input input,
long block_size,
tensorflow.SpaceToDepth.Attrs attrs) |
| Modifier and Type | Method and Description |
|---|---|
tensorflow.Input |
asInput() |
tensorflow.Output |
asOutput() |
static tensorflow.SpaceToDepth.Attrs |
DataFormat(BytePointer x) |
static tensorflow.SpaceToDepth.Attrs |
DataFormat(String x) |
tensorflow.Node |
node() |
tensorflow.Operation |
operation() |
tensorflow.SpaceToDepth |
operation(tensorflow.Operation operation) |
tensorflow.Output |
output() |
tensorflow.SpaceToDepth |
output(tensorflow.Output output) |
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, hashCode, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetof, parseBytes, physicalBytes, position, position, put, realloc, setNull, sizeof, toString, totalBytes, totalPhysicalBytes, withDeallocator, zeropublic SpaceToDepth(Pointer p)
Pointer.Pointer(Pointer).public SpaceToDepth(@Const @ByRef tensorflow.Scope scope, @ByVal tensorflow.Input input, @Cast(value="tensorflow::int64") long block_size)
public SpaceToDepth(@Const @ByRef tensorflow.Scope scope, @ByVal tensorflow.Input input, @Cast(value="tensorflow::int64") long block_size, @Const @ByRef tensorflow.SpaceToDepth.Attrs attrs)
@ByVal @Name(value="operator tensorflow::Output") public tensorflow.Output asOutput()
@ByVal @Name(value="operator tensorflow::Input") public tensorflow.Input asInput()
public tensorflow.Node node()
@ByVal public static tensorflow.SpaceToDepth.Attrs DataFormat(@tensorflow.StringPiece BytePointer x)
@ByVal public static tensorflow.SpaceToDepth.Attrs DataFormat(@tensorflow.StringPiece String x)
@ByRef public tensorflow.Operation operation()
public tensorflow.SpaceToDepth operation(tensorflow.Operation operation)
@ByRef public tensorflow.Output output()
public tensorflow.SpaceToDepth output(tensorflow.Output output)
Copyright © 2019. All rights reserved.