Fix BCE loss issue (#1872)

* Fix BCE loss issue

* Remove import
This commit is contained in:
Eren Gölge 2022-08-15 11:27:21 +02:00 committed by GitHub
parent c30b6485ea
commit 4333492341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -165,7 +165,7 @@ class BCELossMasked(nn.Module):
def __init__(self, pos_weight: float = None):
super().__init__()
self.pos_weight = torch.tensor([pos_weight])
self.pos_weight = nn.Parameter(torch.tensor([pos_weight]), requires_grad=False)
def forward(self, x, target, length):
"""