Merge pull request #6726 from pkuyym/fix-6712

Expose sequence_softmax_op.
del_some_in_makelist
Yang yaming 7 years ago committed by GitHub
commit 1e92353a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -305,3 +305,10 @@ lstm_unit
---------
.. autofunction:: paddle.v2.fluid.layers.lstm_unit
:noindex:
sequence_softmax
---------
.. autofunction:: paddle.v2.fluid.layers.sequence_softmax
:noindex:

@ -2,7 +2,7 @@ from ..registry import register_layer
__all__ = [
'mean', 'mul', 'dropout', 'reshape', 'sigmoid', 'scale', 'transpose',
'sigmoid_cross_entropy_with_logits', 'elementwise_add', 'elementwise_div',
'elementwise_sub', 'elementwise_mul', 'clip', 'abs'
'elementwise_sub', 'elementwise_mul', 'clip', 'abs', 'sequence_softmax'
]
for _OP in set(__all__):

@ -187,6 +187,15 @@ class TestBook(unittest.TestCase):
x_t=x_t, hidden_t_prev=prev_hidden, cell_t_prev=prev_cell))
print(str(program))
def test_sequence_softmax(self):
program = Program()
with program_guard(program):
seq_data = layers.data(
name='seq_data', shape=[10, 10], dtype='float32', lod_level=1)
seq = layers.fc(input=seq_data, size=20)
self.assertIsNotNone(layers.sequence_softmax(x=seq))
print(str(program))
if __name__ == '__main__':
unittest.main()

Loading…
Cancel
Save