Skip to content

Commit 2845195

Browse files
committed
add doc
1 parent f8c55fb commit 2845195

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

paddle/fluid/operators/sequence_concat_op.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ class SeqConcatShapeInferer : public framework::InferShapeBase {
3838
public:
3939
void operator()(framework::InferShapeContext *context) const override {
4040
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.");
4345

46+
PADDLE_ENFORCE_GT(context->HasInputs("X"), 1,
47+
"The number of input sequences is at least two.");
4448
auto x_dims = context->GetInputsDim("X");
4549
int64_t batch_size = 0;
4650
int64_t feature_size = 0;

python/paddle/fluid/layers/nn.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,31 @@ def sequence_pool(input, pool_type):
17811781
return pool_out
17821782

17831783

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+
17841809
def sequence_first_step(input):
17851810
"""
17861811
This function gets the first step of sequence.

0 commit comments

Comments
 (0)