Skip to content

Possible bug when calculating running loss #8

@HenryDashwood

Description

@HenryDashwood

Hi there!

I've been looking at your training loop in the text classification tutorial and I see that you calculate a total running loss before averaging to get the average loss after the loop ends.

Looking at this line though I'm a little confused
running_loss += loss.data[0] * x.size(0)
When I print out the shape of x I get these values
Screen Shot 2019-05-08 at 1 29 50 PM
The batch sizes appear to be at index 1 so should the running loss line read running_loss += loss.data[0] * x.size(1)?

Entirely possible that I've made the mistake here but thought I would ask anyway!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions