|
|
|
@ -52,7 +52,7 @@ def sequence_conv(input,
|
|
|
|
|
act=None,
|
|
|
|
|
name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Notes: The Op only receives LoDTensor as input. If your input is Tensor, please use conv2d Op.(fluid.layers.** :ref:`api_fluid_layers_conv2d` ).
|
|
|
|
|
|
|
|
|
@ -176,7 +176,7 @@ def sequence_conv(input,
|
|
|
|
|
|
|
|
|
|
def sequence_softmax(input, use_cudnn=False, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Note**:
|
|
|
|
|
|
|
|
|
@ -260,7 +260,7 @@ def sequence_softmax(input, use_cudnn=False, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_pool(input, pool_type, is_test=False, pad_value=0.0):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Notes: The Op only receives LoDTensor as input. If your input is Tensor, please use pool2d Op.(fluid.layers.** :ref:`api_fluid_layers_pool2d` ).
|
|
|
|
|
|
|
|
|
@ -374,7 +374,7 @@ def sequence_pool(input, pool_type, is_test=False, pad_value=0.0):
|
|
|
|
|
@templatedoc()
|
|
|
|
|
def sequence_concat(input, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Notes: The Op only receives LoDTensor as input. If your input is Tensor, please use concat Op.(fluid.layers.** :ref:`api_fluid_layers_concat` ).
|
|
|
|
|
|
|
|
|
@ -435,7 +435,7 @@ def sequence_concat(input, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_first_step(input):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
This operator only supports LoDTensor as input. Given the input LoDTensor, it will
|
|
|
|
|
select first time-step feature of each sequence as output.
|
|
|
|
@ -489,7 +489,7 @@ def sequence_first_step(input):
|
|
|
|
|
|
|
|
|
|
def sequence_last_step(input):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
This operator only supports LoDTensor as input. Given the input LoDTensor, it will
|
|
|
|
|
select last time-step feature of each sequence as output.
|
|
|
|
@ -544,7 +544,7 @@ def sequence_last_step(input):
|
|
|
|
|
|
|
|
|
|
def sequence_slice(input, offset, length, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Sequence Slice Layer**
|
|
|
|
|
|
|
|
|
@ -632,7 +632,7 @@ def sequence_slice(input, offset, length, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_expand(x, y, ref_level=-1, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
Sequence Expand Layer. This layer will expand the input variable ``x`` \
|
|
|
|
|
according to specified level ``ref_level`` lod of ``y``. Please note that \
|
|
|
|
@ -768,7 +768,7 @@ def sequence_expand(x, y, ref_level=-1, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_expand_as(x, y, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
Sequence Expand As Layer. This OP will expand the input variable ``x`` \
|
|
|
|
|
according to the zeroth level lod of ``y``. Current implementation requires \
|
|
|
|
@ -815,7 +815,7 @@ def sequence_expand_as(x, y, name=None):
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
x (Variable): The input variable which is a Tensor or LoDTensor, with the \
|
|
|
|
|
dims ``[M, K]``. The data type should be float32, float64, int8, int32 \
|
|
|
|
|
dims ``[M, K]``. The data type should be float32, float64, int32 \
|
|
|
|
|
or int64.
|
|
|
|
|
y (Variable): The input variable which is a LoDTensor with 1-level lod.
|
|
|
|
|
name (str, optional): For detailed information, please refer \
|
|
|
|
@ -872,6 +872,9 @@ def sequence_expand_as(x, y, name=None):
|
|
|
|
|
"""
|
|
|
|
|
assert not in_dygraph_mode(), (
|
|
|
|
|
"sequence layer is not supported in dygraph mode yet.")
|
|
|
|
|
check_variable_and_dtype(x, 'x', ['float32', 'float64', 'int32', 'int64'],
|
|
|
|
|
'sequence_expand_as')
|
|
|
|
|
check_type(y, 'y', Variable, 'sequence_expand_as')
|
|
|
|
|
helper = LayerHelper('sequence_expand_as', input=x, **locals())
|
|
|
|
|
dtype = helper.input_dtype()
|
|
|
|
|
tmp = helper.create_variable_for_type_inference(dtype)
|
|
|
|
@ -885,7 +888,7 @@ def sequence_expand_as(x, y, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_pad(x, pad_value, maxlen=None, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
This layer padding the sequences in a same batch to a common length (according \
|
|
|
|
|
to ``maxlen``). The padding value is defined by ``pad_value``, and will be \
|
|
|
|
@ -999,7 +1002,7 @@ def sequence_pad(x, pad_value, maxlen=None, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_unpad(x, length, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Note**:
|
|
|
|
|
|
|
|
|
@ -1074,7 +1077,7 @@ def sequence_unpad(x, length, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_reshape(input, new_dim):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Notes: The Op only receives LoDTensor as input. If your input is Tensor, please use reshape Op.(fluid.layers.** :ref:`api_fluid_layers_reshape` ).
|
|
|
|
|
|
|
|
|
@ -1136,7 +1139,7 @@ def sequence_reshape(input, new_dim):
|
|
|
|
|
|
|
|
|
|
def sequence_scatter(input, index, updates, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
**Note**:
|
|
|
|
|
|
|
|
|
@ -1226,7 +1229,7 @@ def sequence_scatter(input, index, updates, name=None):
|
|
|
|
|
|
|
|
|
|
def sequence_enumerate(input, win_size, pad_value=0, name=None):
|
|
|
|
|
"""
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
:api_attr: Static Graph
|
|
|
|
|
|
|
|
|
|
Generate a new sequence for the input index sequence with \
|
|
|
|
|
shape ``[d_1, win_size]``, which enumerates all the \
|
|
|
|
|