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

Before Change


    loss.backward()
    optimizer.step()
    _, idx = outputs.max(1)
    idx = idx.data.numpy()
    result_str = [idx2char[c] for c in idx.squeeze()]
    print("epoch: %d, loss: %1.3f" % (epoch + 1, loss.data[0]))
    print("Predicted string: ", "".join(result_str))

After Change


    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: leftthomas/SRGAN
Commit Name: 1433d4c435a253e891009b08a9280bc452087db0
Time: 2017-11-21
Author: leftthomas@qq.com
File Name: test.py
Class Name:
Method Name:


Project Name: tyarkoni/pliers
Commit Name: 72a8442d538cdbffff25ce639aebf10a79db612e
Time: 2020-12-10
Author: rbrrcc@gmail.com
File Name: pliers/extractors/models.py
Class Name: TFHubExtractor
Method Name: _extract