Skip to content

Commit 3e177b9

Browse files
walloollawqingqing01
authored andcommitted
ISSUE-10996: support name setting for layers topk/softmax/concat/dropout (#10999)
1 parent 60783a7 commit 3e177b9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ def cos_sim(X, Y):
855855
return out
856856

857857

858-
def dropout(x, dropout_prob, is_test=False, seed=None):
858+
def dropout(x, dropout_prob, is_test=False, seed=None, name=None):
859859
"""
860860
Computes dropout.
861861
@@ -873,6 +873,8 @@ def dropout(x, dropout_prob, is_test=False, seed=None):
873873
parameter is set to None, a random seed is used.
874874
NOTE: If an integer seed is given, always the same output
875875
units will be dropped. DO NOT use a fixed seed in training.
876+
name(str|None): A name for this layer(optional). If set None, the layer
877+
will be named automatically.
876878
877879
Returns:
878880
Variable: A tensor variable.
@@ -1117,7 +1119,7 @@ def sequence_softmax(input, param_attr=None, bias_attr=None, use_cudnn=True):
11171119
return softmax_out
11181120

11191121

1120-
def softmax(input, param_attr=None, bias_attr=None, use_cudnn=True):
1122+
def softmax(input, param_attr=None, bias_attr=None, use_cudnn=True, name=None):
11211123
helper = LayerHelper('softmax', **locals())
11221124
dtype = helper.input_dtype()
11231125
softmax_out = helper.create_tmp_variable(dtype)
@@ -2610,7 +2612,7 @@ def __check_input(x, y):
26102612
return out
26112613

26122614

2613-
def topk(input, k):
2615+
def topk(input, k, name=None):
26142616
"""
26152617
This operator is used to find values and indices of the k largest entries
26162618
for the last dimension.
@@ -2626,6 +2628,8 @@ def topk(input, k):
26262628
input(Variable): The input variable which can be a vector or Tensor with
26272629
higher rank.
26282630
k(int): An integer value to specify the top k largest elements.
2631+
name(str|None): A name for this layer(optional). If set None, the layer
2632+
will be named automatically.
26292633
26302634
Returns:
26312635
values(Variable): The k largest elements along each last dimensional

python/paddle/fluid/layers/tensor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def cast(x, dtype):
112112
return out
113113

114114

115-
def concat(input, axis=0):
115+
def concat(input, axis=0, name=None):
116116
"""
117117
**Concat**
118118
@@ -122,6 +122,8 @@ def concat(input, axis=0):
122122
Args:
123123
input(list): List of tensors to be concatenated
124124
axis(int): Integer axis along which the tensors will be concatenated
125+
name(str|None): A name for this layer(optional). If set None, the layer
126+
will be named automatically.
125127
126128
Returns:
127129
Variable: Output variable of the concatenation

0 commit comments

Comments
 (0)