Skip to content

Commit 3a44594

Browse files
committed
ctc loss: if label prob is 0, then ctc loss is +inf (instead of throwing an exception)
1 parent 7e714fc commit 3a44594

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Loss.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def ctcLabelingProb(mat, gt, classes):
5858

5959
def ctcLoss(mat, gt, classes):
6060
"calculate CTC loss"
61-
return -math.log(ctcLabelingProb(mat, gt, classes))
61+
try:
62+
return -math.log(ctcLabelingProb(mat, gt, classes))
63+
except:
64+
return float('inf')
6265

6366

6467
def testLoss():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy