cf8a3fb30547d6e980ecd8182f64a51df8e55c62,python/dgl/backend/pytorch/tensor.py,,pad_packed_tensor,#,228
Before Change
index = []
for i, l in enumerate(lengths):
index.extend(range(i * max_len, i * max_len + l))
index = th .tensor(index).to(device)
return scatter_row(x, index, input).view(batch_size, max_len, *old_shape[1:])
def pack_padded_tensor(input, lengths):
After Change
def pad_packed_tensor(input, lengths, value, l_min=None):
old_shape = input.shape
device = input.device
if not is_tensor(lengths) :
lengths = th.tensor(lengths, dtype=th.int64, device=device)
else:
lengths = lengths.to(device)
max_len = as_scalar(lengths.max())
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: dmlc/dgl
Commit Name: cf8a3fb30547d6e980ecd8182f64a51df8e55c62
Time: 2021-02-10
Author: expye@outlook.com
File Name: python/dgl/backend/pytorch/tensor.py
Class Name:
Method Name: pad_packed_tensor
Project Name: mariogeiger/se3cnn
Commit Name: f66d3c5ed7b7fa96424fd0d8214594042d9ba3ff
Time: 2019-07-09
Author: geiger.mario@gmail.com
File Name: se3cnn/SO3.py
Class Name:
Method Name: spherical_harmonics
Project Name: dmlc/dgl
Commit Name: cf8a3fb30547d6e980ecd8182f64a51df8e55c62
Time: 2021-02-10
Author: expye@outlook.com
File Name: python/dgl/backend/pytorch/tensor.py
Class Name:
Method Name: pack_padded_tensor