This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cs501r_f2018:lab6 [2018/10/09 18:54] sadler [Description:] |
cs501r_f2018:lab6 [2018/10/09 19:26] sadler [Description:] |
||
---|---|---|---|
Line 147: | Line 147: | ||
if epoch % print_every == 0: | if epoch % print_every == 0: | ||
- | print('[%s (%d %d%%) %.4f]' % (time_since(start), epoch, epoch / n_epochs * 100, loss_)) | + | print('[%s (%d %d%%) %.4f]' % (time.time() - start, epoch, epoch / n_epochs * 100, loss_)) |
print(evaluate('Wh', 100), '\n') | print(evaluate('Wh', 100), '\n') | ||
Line 206: | Line 206: | ||
for c in range(chunk_len): | for c in range(chunk_len): | ||
output, hidden = # run the forward pass of your rnn with proper input | output, hidden = # run the forward pass of your rnn with proper input | ||
- | loss += criterion(output, target[c].view(1)) | + | loss += criterion(output, target[c].unsqueeze(0)) |
## calculate backwards loss and step the optimizer (globally) | ## calculate backwards loss and step the optimizer (globally) |