82478ffacdd98fcc0750ff086af240a3f37a8b10,src/spn/algorithms/layerwise/layers.py,Product,forward,#Product#Any#,96

Before Change


        if self.cardinality == x.shape[1]:
            return x.sum(1)

        x_split = list(torch.split(x, self.cardinality, dim=1))

        // Check if splits have the same shape (If split cannot be made even, the last chunk will be smaller)
        if x_split[-1].shape != x_split[0].shape:
            // How much is the last chunk smaller
            diff = x_split[0].shape[1] - x_split[-1].shape[1]

            // Pad the last chunk by the difference with zeros (=maginalized nodes)
            x_split[-1] = F.pad(
                x_split[-1], pad=[0, 0, 0, diff], mode="constant", value=0.0
            )

        // Stack along new split axis
        x_split_stack = torch.stack(x_split, dim=2)

        // Sum over feature axis
        result = torch.sum(x_split_stack, dim=1)
        return result

After Change


        result = F.conv2d(x, weight=self._conv_weights, stride=(self.cardinality, 1))

        // Remove simulated channel
        result = result.squeeze(1)
        return result

    def __repr__(self):
        return "Product(in_features={}, cardinality={}, out_shape={})".format(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: SPFlow/SPFlow
Commit Name: 82478ffacdd98fcc0750ff086af240a3f37a8b10
Time: 2019-08-22
Author: steven.lang.mz@gmail.com
File Name: src/spn/algorithms/layerwise/layers.py
Class Name: Product
Method Name: forward


Project Name: fgnt/pb_bss
Commit Name: 32d73ccb0d80db3727775fb9928f5f151ddaaab5
Time: 2015-10-06
Author: cbj@mail.uni-paderborn.de
File Name: nt/speech_enhancement/mask_estimation.py
Class Name:
Method Name: simple_ideal_soft_mask


Project Name: pymc-devs/pymc3
Commit Name: 369d08e119950f356bee2408f6880f7bad1a60d4
Time: 2017-09-17
Author: junpeng.lao@unifr.ch
File Name: pymc3/distributions/multivariate.py
Class Name: Multinomial
Method Name: __init__