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

Remove redundant code, Solve the data type inconsistency bug #805

Merged
merged 6 commits into from
Jan 27, 2021
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
6 changes: 3 additions & 3 deletions paddleseg/models/losses/bootstrapped_cross_entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ def __init__(self, min_K, loss_th, weight=None, ignore_index=255):
self.ignore_index = ignore_index
self.K = min_K
self.threshold = loss_th
if weight is not None:
weight = paddle.to_tensor(weight, dtype='float32')
self.weight = weight
self.ignore_index = ignore_index


def forward(self, logit, label):

n, c, h, w = logit.shape
Expand All @@ -55,7 +56,6 @@ def forward(self, logit, label):
y = paddle.transpose(y, (0, 2, 3, 1))
x = paddle.reshape(x, shape=(-1, c))
y = paddle.reshape(y, shape=(-1, ))

loss = F.cross_entropy(
x,
y,
Expand Down