提交 3242e286 编写于 作者: Y yangyaming

seq_expand --> sequence_expand

上级 0d748f5b
...@@ -300,7 +300,7 @@ conv2d_transpose ...@@ -300,7 +300,7 @@ conv2d_transpose
.. autofunction:: paddle.v2.fluid.layers.conv2d_transpose .. autofunction:: paddle.v2.fluid.layers.conv2d_transpose
:noindex: :noindex:
seq_expand sequence_expand
--------- ---------
.. autofunction:: paddle.v2.fluid.layers.seq_expand .. autofunction:: paddle.v2.fluid.layers.sequence_expand
:noindex: :noindex:
...@@ -10,7 +10,7 @@ __all__ = [ ...@@ -10,7 +10,7 @@ __all__ = [
'fc', 'embedding', 'dynamic_lstm', 'gru_unit', 'linear_chain_crf', 'fc', 'embedding', 'dynamic_lstm', 'gru_unit', 'linear_chain_crf',
'crf_decoding', 'cos_sim', 'cross_entropy', 'square_error_cost', 'accuracy', 'crf_decoding', 'cos_sim', 'cross_entropy', 'square_error_cost', 'accuracy',
'chunk_eval', 'sequence_conv', 'conv2d', 'sequence_pool', 'pool2d', 'chunk_eval', 'sequence_conv', 'conv2d', 'sequence_pool', 'pool2d',
'batch_norm', 'beam_search_decode', 'conv2d_transpose', 'seq_expand' 'batch_norm', 'beam_search_decode', 'conv2d_transpose', 'sequence_expand'
] ]
...@@ -791,10 +791,10 @@ def conv2d_transpose(input, ...@@ -791,10 +791,10 @@ def conv2d_transpose(input,
return out return out
def seq_expand(x, y, main_program=None, startup_program=None): def sequence_expand(x, y, main_program=None, startup_program=None):
"""Sequence Expand Layer. This layer will expand the input variable **x** """Sequence Expand Layer. This layer will expand the input variable **x**
according to LoD information of **y**. And the following examples will according to LoD information of **y**. And the following examples will
explain how seq_expand works: explain how sequence_expand works:
.. code-block:: text .. code-block:: text
...@@ -823,7 +823,7 @@ def seq_expand(x, y, main_program=None, startup_program=None): ...@@ -823,7 +823,7 @@ def seq_expand(x, y, main_program=None, startup_program=None):
x.dims = [3, 1] x.dims = [3, 1]
y is a LoDTensor: y is a LoDTensor:
Y.lod = [[0, 2, 3, 6]] y.lod = [[0, 2, 3, 6]]
with condition len(y.lod[-1]) - 1 == x.dims[0] with condition len(y.lod[-1]) - 1 == x.dims[0]
...@@ -847,12 +847,12 @@ def seq_expand(x, y, main_program=None, startup_program=None): ...@@ -847,12 +847,12 @@ def seq_expand(x, y, main_program=None, startup_program=None):
x = fluid.layers.data(name='x', shape=[10], dtype='float32') x = fluid.layers.data(name='x', shape=[10], dtype='float32')
y = fluid.layers.data(name='y', shape=[10, 20], y = fluid.layers.data(name='y', shape=[10, 20],
dtype='float32', lod_level=1) dtype='float32', lod_level=1)
out = layers.seq_expand(x=x, y=y) out = layers.sequence_expand(x=x, y=y)
""" """
helper = LayerHelper('seq_expand', input=x, **locals()) helper = LayerHelper('sequence_expand', input=x, **locals())
dtype = helper.input_dtype() dtype = helper.input_dtype()
tmp = helper.create_tmp_variable(dtype) tmp = helper.create_tmp_variable(dtype)
helper.append_op( helper.append_op(
type='seq_expand', inputs={'X': x, type='sequence_expand', inputs={'X': x,
'Y': y}, outputs={'Out': tmp}) 'Y': y}, outputs={'Out': tmp})
return tmp return tmp
...@@ -167,7 +167,7 @@ class TestBook(unittest.TestCase): ...@@ -167,7 +167,7 @@ class TestBook(unittest.TestCase):
x = layers.data(name='x', shape=[10], dtype='float32') x = layers.data(name='x', shape=[10], dtype='float32')
y = layers.data( y = layers.data(
name='y', shape=[10, 20], dtype='float32', lod_level=1) name='y', shape=[10, 20], dtype='float32', lod_level=1)
self.assertIsNotNone(layers.seq_expand(x=x, y=y)) self.assertIsNotNone(layers.sequence_expand(x=x, y=y))
print(str(program)) print(str(program))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册