File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
python/paddle/fluid/layers Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,13 @@ class SeqConcatShapeInferer : public framework::InferShapeBase {
38
38
public:
39
39
void operator ()(framework::InferShapeContext *context) const override {
40
40
try {
41
- PADDLE_ENFORCE (context->HasInputs (" X" ));
42
- PADDLE_ENFORCE (context->HasOutput (" Out" ));
41
+ PADDLE_ENFORCE (context->HasInputs (" X" ),
42
+ " Input(X) of Sequence Concat Op should not be null." );
43
+ PADDLE_ENFORCE (context->HasOutput (" Out" ),
44
+ " Output(Out) of Sequence Concat Op should not be null." );
43
45
46
+ PADDLE_ENFORCE_GT (context->HasInputs (" X" ), 1 ,
47
+ " The number of input sequences is at least two." );
44
48
auto x_dims = context->GetInputsDim (" X" );
45
49
int64_t batch_size = 0 ;
46
50
int64_t feature_size = 0 ;
Original file line number Diff line number Diff line change @@ -1781,6 +1781,31 @@ def sequence_pool(input, pool_type):
1781
1781
return pool_out
1782
1782
1783
1783
1784
+ @templatedoc ()
1785
+ def sequence_concat (input , name = None ):
1786
+ """
1787
+ ${comment}
1788
+
1789
+ Args:
1790
+ input(list): List of Variables to be concatenated.
1791
+ name(str|None): A name for this layer(optional). If set None, the layer
1792
+ will be named automatically.
1793
+
1794
+ Returns:
1795
+ Variable: Output variable of the concatenation.
1796
+
1797
+ Examples:
1798
+ .. code-block:: python
1799
+
1800
+ out = fluid.layers.sequence_concat(input=[seq1, seq2, seq3])
1801
+ """
1802
+ helper = LayerHelper ('sequence_concat' , ** locals ())
1803
+ out = helper .create_tmp_variable (dtype = helper .input_dtype ())
1804
+ helper .append_op (
1805
+ type = 'sequence_concat' , inputs = {'X' : input }, outputs = {'Out' : [out ]})
1806
+ return out
1807
+
1808
+
1784
1809
def sequence_first_step (input ):
1785
1810
"""
1786
1811
This function gets the first step of sequence.
You can’t perform that action at this time.
0 commit comments