@Namespace(value="tensorflow::ops") @NoOffset public static class tensorflow.ReverseSequence extends Pointer
input along the dimension batch_dim, and for each
slice i, reverses the first seq_lengths[i] elements along
the dimension seq_dim.
The elements of seq_lengths must obey seq_lengths[i] <= input.dims[seq_dim],
and seq_lengths must be a vector of length input.dims[batch_dim].
The output slice i along dimension batch_dim is then given by input
slice i, with the first seq_lengths[i] slices along dimension
seq_dim reversed.
For example:
# Given this:
batch_dim = 0
seq_dim = 1
input.dims = (4, 8, ...)
seq_lengths = [7, 2, 3, 5]
# then slices of input are reversed on seq_dim, but only up to seq_lengths:
output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...]
output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...]
output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...]
output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...]
# while entries past seq_lens are copied through:
output[0, 7:, :, ...] = input[0, 7:, :, ...]
output[1, 2:, :, ...] = input[1, 2:, :, ...]
output[2, 3:, :, ...] = input[2, 3:, :, ...]
output[3, 2:, :, ...] = input[3, 2:, :, ...]
In contrast, if:
# Given this:
batch_dim = 2
seq_dim = 0
input.dims = (8, ?, 4, ...)
seq_lengths = [7, 2, 3, 5]
# then slices of input are reversed on seq_dim, but only up to seq_lengths:
output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...]
output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...]
output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...]
output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...]
# while entries past seq_lens are copied through:
output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...]
output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...]
output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...]
output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...]
Arguments:
* scope: A Scope object
* input: The input to reverse.
* seq_lengths: 1-D with length input.dims(batch_dim) and
max(seq_lengths) <= input.dims(seq_dim)
* seq_dim: The dimension which is partially reversed.
Optional attributes (see Attrs):
* batch_dim: The dimension along which reversal is performed.
Returns:
* Output: The partially reversed input. It has the same shape as input.| Modifier and Type | Class and Description |
|---|---|
static class |
tensorflow.ReverseSequence.Attrs
Optional attribute setters for ReverseSequence
|
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator| Constructor and Description |
|---|
ReverseSequence(Pointer p)
Pointer cast constructor.
|
ReverseSequence(tensorflow.Scope scope,
tensorflow.Input input,
tensorflow.Input seq_lengths,
long seq_dim) |
ReverseSequence(tensorflow.Scope scope,
tensorflow.Input input,
tensorflow.Input seq_lengths,
long seq_dim,
tensorflow.ReverseSequence.Attrs attrs) |
| Modifier and Type | Method and Description |
|---|---|
tensorflow.Input |
asInput() |
tensorflow.Output |
asOutput() |
static tensorflow.ReverseSequence.Attrs |
BatchDim(long x) |
tensorflow.Node |
node() |
tensorflow.Operation |
operation() |
tensorflow.ReverseSequence |
operation(tensorflow.Operation operation) |
tensorflow.Output |
output() |
tensorflow.ReverseSequence |
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 ReverseSequence(Pointer p)
Pointer.Pointer(Pointer).public ReverseSequence(@Const @ByRef tensorflow.Scope scope, @ByVal tensorflow.Input input, @ByVal tensorflow.Input seq_lengths, @Cast(value="tensorflow::int64") long seq_dim)
public ReverseSequence(@Const @ByRef tensorflow.Scope scope, @ByVal tensorflow.Input input, @ByVal tensorflow.Input seq_lengths, @Cast(value="tensorflow::int64") long seq_dim, @Const @ByRef tensorflow.ReverseSequence.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.ReverseSequence.Attrs BatchDim(@Cast(value="tensorflow::int64") long x)
@ByRef public tensorflow.Operation operation()
public tensorflow.ReverseSequence operation(tensorflow.Operation operation)
@ByRef public tensorflow.Output output()
public tensorflow.ReverseSequence output(tensorflow.Output output)
Copyright © 2019. All rights reserved.