Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set stop_gradient=True for some variables in SSD API. #9396

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/paddle/fluid/layers/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class number, M is number of bounding boxes. For each category
scores = nn.softmax(input=scores)
scores = ops.reshape(x=scores, shape=old_shape)
scores = nn.transpose(scores, perm=[0, 2, 1])
scores.stop_gradient = True
nmsed_outs = helper.create_tmp_variable(dtype=decoded_box.dtype)
helper.append_op(
type="multiclass_nms",
Expand All @@ -148,6 +149,7 @@ class number, M is number of bounding boxes. For each category
'score_threshold': score_threshold,
'nms_eta': 1.0
})
nmsed_outs.stop_gradient = True
return nmsed_outs


Expand Down Expand Up @@ -837,4 +839,6 @@ def _is_list_or_tuple_and_equal(data, length, err_info):
mbox_locs_concat = tensor.concat(mbox_locs, axis=1)
mbox_confs_concat = tensor.concat(mbox_confs, axis=1)

box.stop_gradient = True
var.stop_gradient = True
return mbox_locs_concat, mbox_confs_concat, box, var