9a2903dac097a7f3633f6c828533ed385c7159c9,qucumber/utils/data.py,,extract_refbasis_samples,#Any#Any#,64

Before Change


    :returns: The samples in the data that are only in the reference basis.
    :rtype: torch.Tensor
    
    tmp = []
    num_visible = train_samples.shape[-1]
    for i in range(train_samples.shape[0]):
        flag = 0
        for j in range(num_visible):
            if train_bases[i][j] != "Z":
                flag = 1
                break
        if flag == 0:
            tmp.append(train_samples[i])
    z_samples = torch.zeros(len(tmp), num_visible, dtype=torch.double)
    for i in range(len(tmp)):
        for j in range(num_visible):
            z_samples[i][j] = tmp[i][j]

After Change


    :returns: The samples in the data that are only in the reference basis.
    :rtype: torch.Tensor
    
    idx = (
        torch.tensor(train_bases == "Z", dtype=torch.uint8)
        .all(dim=1)
        .to(train_samples.device)
    )
    z_samples = train_samples[idx]
    return z_samples
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: PIQuIL/QuCumber
Commit Name: 9a2903dac097a7f3633f6c828533ed385c7159c9
Time: 2019-07-17
Author: emerali@users.noreply.github.com
File Name: qucumber/utils/data.py
Class Name:
Method Name: extract_refbasis_samples


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