55b880469ced115de9949d5d25ff835dabbb2caa,12_2_hello_rnn.py,,,#,65

Before Change


for epoch in range(100):
    outputs = rnn(inputs)
    optimizer.zero_grad()
    loss = criterion(outputs, labels)
    loss.backward()
    optimizer.step()
    _, idx = outputs.max(1)
    idx = idx.data.numpy()

After Change


for epoch in range(100):
    optimizer.zero_grad()
    loss = 0
    hidden = model.init_hidden()

    sys.stdout.write("predicted string: ")
    for input, label in zip(inputs, labels):
        // print(input.size(), label.size())
        hidden, output = model(hidden, input)
        val, idx = output.max(1)
        sys.stdout.write(idx2char[idx.data[0]])
        loss += criterion(output, label)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: hunkim/PyTorchZeroToAll
Commit Name: 55b880469ced115de9949d5d25ff835dabbb2caa
Time: 2017-11-08
Author: hunkim@gmail.com
File Name: 12_2_hello_rnn.py
Class Name:
Method Name:


Project Name: pytorch/examples
Commit Name: c048078187945e1defb8abc3246cd305fb038c6a
Time: 2017-01-11
Author: alerer@fb.com
File Name: OpenNMT/train.py
Class Name:
Method Name: eval