f79ecd6c4c0bf965d259937d4900cebe54214f10,pythainlp/ulmfit/__init__.py,,document_vector,#Any#Any#Any#,119

Before Change


    pred, _ = m(t)

    // return concatenation of last, mean and max
    last = pred[-1][-1, :, :].squeeze()
    avg_pool = pred[-1].mean(0)[0].squeeze()
    max_pool = pred[-1].max(0)[0].squeeze()
    res = torch.cat((last, avg_pool, max_pool)).detach().cpu().numpy()

    return res

After Change


    
    s = _tokenizer.tokenizer(text)
    t = torch.tensor(data.vocab.numericalize(s), requires_grad=False).to(device)
    m = learn.model[0].encoder.to(device)
    res = m(t).mean(0).cpu().detach().numpy()
    return(res)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: PyThaiNLP/pythainlp
Commit Name: f79ecd6c4c0bf965d259937d4900cebe54214f10
Time: 2019-02-24
Author: cebril@gmail.com
File Name: pythainlp/ulmfit/__init__.py
Class Name:
Method Name: document_vector


Project Name: dpressel/mead-baseline
Commit Name: 3218a3987ef9f83d1ad5efd6f96d6f6c741c3cfa
Time: 2019-09-27
Author: dpressel@gmail.com
File Name: python/eight_mile/pytorch/layers.py
Class Name:
Method Name: viterbi


Project Name: dpressel/mead-baseline
Commit Name: 9b72ec0d4963412e9790b06d22f051a9723af33c
Time: 2019-02-24
Author: blester125@users.noreply.github.com
File Name: python/baseline/pytorch/crf.py
Class Name:
Method Name: viterbi