9b664bd7cd8dbb9657626166ba61887ed06774d7,gpytorch/utils/toeplitz.py,,index_coef_to_sparse,#Any#Any#Any#,6

Before Change


    num_target_points, num_coefficients = value_matrix.size()
    index_list = [[], []]
    value_list = []
    for i in range(num_target_points):
        for j in range(num_coefficients):
            if value_matrix[i, j] == 0:
                continue
            index_list[0].append(i)
            index_list[1].append(index_matrix[i, j])
            value_list.append(value_matrix[i, j])

    index_tensor = torch.LongTensor(index_list)
    value_tensor = torch.FloatTensor(value_list)
    res = torch.sparse.FloatTensor(index_tensor, value_tensor, torch.Size([num_target_points, row_length]))
    return res

After Change


        index_tensor = index_tensor.index_select(1, nonzero_indices)
        value_tensor = value_tensor.index_select(0, nonzero_indices)
    else:
        index_tensor = index_tensor.resize_(2, 1).zero_()
        value_tensor = value_tensor.resize_(1).zero_()

    res = torch.sparse.FloatTensor(index_tensor, value_tensor, torch.Size([num_target_points, row_length]))
    return res
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: cornellius-gp/gpytorch
Commit Name: 9b664bd7cd8dbb9657626166ba61887ed06774d7
Time: 2017-09-13
Author: gpleiss@gmail.com
File Name: gpytorch/utils/toeplitz.py
Class Name:
Method Name: index_coef_to_sparse


Project Name: cornellius-gp/gpytorch
Commit Name: e503f50cb38fb1864fb6d66ba927b0852159428d
Time: 2017-09-22
Author: gpleiss@gmail.com
File Name: gpytorch/utils/interpolation.py
Class Name: Interpolation
Method Name: interpolate


Project Name: stanfordnlp/stanza
Commit Name: 0a687cfb7db7998d9d79d58cd1762041a143a547
Time: 2018-09-17
Author: qipeng@users.noreply.github.com
File Name: models/common/hlstm.py
Class Name: HighwayLSTM
Method Name: __init__


Project Name: Kaixhin/Rainbow
Commit Name: d5a60e49538e4f61fd46468895fa42df2a429d95
Time: 2017-11-11
Author: design@kaixhin.com
File Name: agent.py
Class Name: Agent
Method Name: learn