29d7182447c4120057c116eb22c06d1d909eb3a1,fairseq/distributed_utils.py,,all_gather_list,#Any#Any#Any#,132

Before Change


    enc_size = len(enc)
    if enc_size + 2 > max_size:
        raise ValueError("encoded data exceeds max_size: {}".format(enc_size + 2))
    assert max_size < 255*256

    cpu_buffer[0] = enc_size // 255  // this encoding works for max_size < 65k
    cpu_buffer[1] = enc_size % 255
    cpu_buffer[2 : enc_size + 2] = torch.ByteTensor(list(enc))

After Change


        result = []
        for i in range(world_size):
            out_buffer = buffer[i * max_size:(i + 1) * max_size]
            enc_size, = struct.unpack(">I", bytes(out_buffer[:header_size].tolist()))
            if enc_size > 0:
                result.append(pickle.loads(bytes(out_buffer[header_size:header_size + enc_size].tolist())))
        return result
    except pickle.UnpicklingError:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: pytorch/fairseq
Commit Name: 29d7182447c4120057c116eb22c06d1d909eb3a1
Time: 2019-12-13
Author: yunwang@fb.com
File Name: fairseq/distributed_utils.py
Class Name:
Method Name: all_gather_list


Project Name: markovmodel/PyEMMA
Commit Name: 9768b213dc0ede97119a46bfc90daa9ae0f249eb
Time: 2017-04-07
Author: m.scherer@fu-berlin.de
File Name: pyemma/_base/serialization/util.py
Class Name: _old_locations
Method Name: __call__


Project Name: tensorflow/models
Commit Name: c987d27ce7922d08f5d50bf0280b102548fac2a0
Time: 2020-08-15
Author: kaushikshiv@google.com
File Name: research/object_detection/dataset_tools/create_ava_actions_tf_record.py
Class Name: Ava
Method Name: get_label_map