Skip to content

Commit 9220005

Browse files
authored
fix if logic in dygraph, test=develop (#24209)
1 parent 5c09a95 commit 9220005

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

python/paddle/fluid/dygraph/nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ def forward(self, input):
961961
tmp = self._helper.create_variable_for_type_inference(self._dtype)
962962
self._helper.append_op(
963963
type="matmul", inputs=inputs, outputs={"Out": tmp}, attrs=attrs)
964-
if self.bias:
964+
if self.bias is not None:
965965
pre_activation = self._helper.create_variable_for_type_inference(
966966
dtype=self._dtype)
967967
self._helper.append_op(

python/paddle/fluid/layers/loss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def edit_distance(input,
473473
label = erased_label
474474

475475
this_inputs = {"Hyps": [input], "Refs": [label]}
476-
if input_length and label_length:
476+
if input_length is not None and label_length is not None:
477477
this_inputs['HypsLength'] = [input_length]
478478
this_inputs['RefsLength'] = [label_length]
479479

python/paddle/fluid/layers/nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ def chunk_eval(input,
10221022

10231023
this_input = {"Inference": [input], "Label": [label]}
10241024

1025-
if seq_length:
1025+
if seq_length is not None:
10261026
this_input["SeqLength"] = [seq_length]
10271027

10281028
helper.append_op(

0 commit comments

Comments
 (0)