d6b3b7a69897018d92900be9fb9a0511c7c0b0ab,theano/tensor/opt_uncanonicalize.py,,local_alloc_dimshuffle,#Any#,106

Before Change


        if getattr(input_, "owner", None) and isinstance(input_.owner.op, DimShuffle):
            // check if it only adds dimension to the left
            pattern = input_.type.broadcastable
            if not pattern[0]:
                return False
            j = 0
            for i, bool_ in enumerate(pattern):
                if not bool_:
                    j = i
                    break
            if sum(pattern[j:]) == 0:
                return input_.inputs
            else :
                return False

After Change


        if input_.owner and isinstance(input_.owner.op, DimShuffle):
            // check if it only adds dimension to the left
            new_order = input_.owner.op.new_order
            flag = False
            for i, dim in enumerate(new_order_bool):
                if i == 0 and dim == "x":
                    flag = True
                elif dim == "x" and flag:
                    continue
                elif i > 0 and flag:
                    flag = False
                elif i > 0 and not dim == "x":
                    continue
                else:
                    return False
            return input_.inputs
    return False
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: Theano/Theano
Commit Name: d6b3b7a69897018d92900be9fb9a0511c7c0b0ab
Time: 2016-09-30
Author: oli.mastro@gmail.com
File Name: theano/tensor/opt_uncanonicalize.py
Class Name:
Method Name: local_alloc_dimshuffle


Project Name: Scitator/catalyst
Commit Name: 1a73a1367fedfa8368b6c42103e60e1b370bc14a
Time: 2019-04-19
Author: scitator@gmail.com
File Name: catalyst/contrib/criterion/focal_loss.py
Class Name: FocalLoss
Method Name: forward


Project Name: nilmtk/nilmtk
Commit Name: 7f007ac656dc5d24606f06544d11dc50748324ef
Time: 2014-05-01
Author: jack-list@xlk.org.uk
File Name: nilmtk/pipeline/energynode.py
Class Name: EnergyNode
Method Name: process