01d5e7bc4782daafcfa99e035c1bdbe13a985145,examples/lstm_text_generation.py,,sample,#Any#Any#,62

Before Change


    // helper function to sample an index from a probability array
    a = np.log(a) / temperature
    a = np.exp(a) / np.sum(np.exp(a))
    return np.argmax(np.random.multinomial(1, a, 1))

// train the model, output generated text after each iteration
for iteration in range(1, 60):
    print()

After Change



def sample(preds, temperature=1.0):
    // helper function to sample an index from a probability array
    preds = np.asarray(preds).astype("float64")
    preds = np.log(preds) / temperature
    exp_preds = np.exp(preds)
    preds = exp_preds / np.sum(exp_preds)
    probas = np.random.multinomial(1, preds, 1)
    return np.argmax(probas)

// train the model, output generated text after each iteration
for iteration in range(1, 60):
    print()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: keras-team/keras
Commit Name: 01d5e7bc4782daafcfa99e035c1bdbe13a985145
Time: 2016-07-16
Author: francois.chollet@gmail.com
File Name: examples/lstm_text_generation.py
Class Name:
Method Name: sample


Project Name: maxpumperla/elephas
Commit Name: c9aca7047d5d556d539e15e9f1694eafb4c1d931
Time: 2021-01-12
Author: danielenricocahall@gmail.com
File Name: elephas/parameter/client.py
Class Name: SocketClient
Method Name: get_parameters


Project Name: NifTK/NiftyNet
Commit Name: 324b3a52837f46aac644a31eecfa361d728775de
Time: 2017-12-21
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/contrib/sampler_pairwise/sampler_pairwise.py
Class Name: PairwiseSampler
Method Name: get_pairwise_inputs