d6d7cb7db51776b026514a1a2caa4073b9e998ad,thinc/backends/ops.py,Ops,pad,#Ops#Any#,115

Before Change


        shape = [len(seqs)]
        // Find the maximum dimension along each axis. That"s what we"ll pad to.
        dim_sizes = zip(*[seq.shape for seq in seqs])
        shape.extend(max(sizes) for sizes in dim_sizes)
        // Now copy the data into our new buffer.
        output: Array = self.alloc(tuple(shape), dtype=seqs[0].dtype)
        for i, arr in enumerate(seqs):
            // TODO: It would be nice to generalize this to work along different

After Change


        shapes = [tuple(s.shape) for s in seqs]
        dim_sizes = zip(*[shape for shape in shapes])
        max_dims = [max(sizes) for sizes in dim_sizes]
        final_shape = (len(seqs),) + tuple(max_dims)
        output = self.alloc(final_shape, dtype=seqs[0].dtype)
        for i, arr in enumerate(seqs):
            region = [i] + [slice(0, dim) for dim in arr.shape]
            output[region] = arr
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: explosion/thinc
Commit Name: d6d7cb7db51776b026514a1a2caa4073b9e998ad
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/backends/ops.py
Class Name: Ops
Method Name: pad


Project Name: NervanaSystems/nlp-architect
Commit Name: c9e73e23d952569574d23aafad6479caa5828b49
Time: 2018-05-14
Author: amit.yaccobi@intel.com
File Name: examples/np_semantic_segmentation/feature_extraction.py
Class Name: PalmettoClass
Method Name: get_pmi_score


Project Name: reinforceio/tensorforce
Commit Name: 6d07125ef05bcc6c765941a553b513ee28f2a89c
Time: 2020-08-30
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/utils/dicts.py
Class Name: SignatureDict
Method Name: kwargs_to_args