d6d7cb7db51776b026514a1a2caa4073b9e998ad,thinc/backends/ops.py,Ops,pad,#Ops#,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


        if len(set(seq.shape[1:] for seq in seqs)) != 1:
            raise ValueError("Cannot pad sequences that differ on other dimensions")
        // Find the maximum dimension along each axis. That"s what we"ll pad to.
        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: 4

Non-data size: 6

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: THUNLP-MT/THUMT
Commit Name: 410992318552115d2e3de84844bf523012e3e98e
Time: 2019-11-26
Author: cg847519328@163.com
File Name: thumt/utils/hooks.py
Class Name:
Method Name: _evaluate


Project Name: explosion/thinc
Commit Name: 9b19c1ebf37ed88593f91dc084b63e1c7e9aa03d
Time: 2020-01-04
Author: honnibal+gh@gmail.com
File Name: thinc/layers/foreach.py
Class Name:
Method Name: forward


Project Name: kymatio/kymatio
Commit Name: 5c6c50274c11ecbf9be54052394922fabde80923
Time: 2020-02-18
Author: edouard.oyallon@lip6.fr
File Name: kymatio/scattering2d/core/scattering2d.py
Class Name:
Method Name: scattering2d