Skip to content

How to invoke FocalLoss with batch size of 1? #2835

Answered by dzenanz
dzenanz asked this question in Q&A
Discussion options

You must be logged in to vote

Adding a dummy dimension gets me past the crash:

            i_output2 = i_output.unsqueeze(0)
            i_target2 = i_target.unsqueeze(0)
            loss += focal_loss(i_output2, i_target2)

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@dzenanz
Comment options

@dzenanz
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dzenanz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants