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
+1 -1
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):
"""