aa7c004df5c781fc3b5b8131d7a9e64fd196203e,se3_cnn/blocks/gated_block.py,GatedBlock,forward,#GatedBlock#Any#,78

Before Change


                g = self.gate_act(g)
                begin_g = 0  // index of first scalar gate capsule

            zs = []

            for n, mul in enumerate(self.repr_out):
                if mul == 0:
                    continue
                dim = 2 * n + 1

                // crop out capsules of order n
                field_y = y[:, begin_y: begin_y + mul * dim]  // [batch, feature * repr, x, y, z]
                begin_y += mul * dim

                if n == 0:
                    // Scalar activation
                    if self.scalar_act is not None:
                        field = self.scalar_act(field_y)
                    else:
                        field = field_y
                else:
                    if self.gate_act is not None:
                        // reshape channels in capsules and capsule entries
                        field_y = field_y.contiguous()
                        field_y = field_y.view(nbatch, mul, dim, nx, ny, nz)  // [batch, feature, repr, x, y, z]

                        // crop out corresponding scalar gates
                        field_g = g[:, begin_g: begin_g + mul]  // [batch, feature, x, y, z]
                        begin_g += mul
                        // reshape channels for broadcasting
                        field_g = field_g.contiguous()
                        field_g = field_g.view(nbatch, mul, 1, nx, ny, nz)  // [batch, feature, repr, x, y, z]

                        // scale non-scalar capsules by gate values
                        field = field_y * field_g  // [batch, feature, repr, x, y, z]
                        field = field.view(nbatch, mul * dim, nx, ny, nz)  // [batch, feature * repr, x, y, z]
                    else:
                        field = field_y

                zs.append(field)

            z = torch.cat(zs, dim=1)

        // dropout
        if self.dropout is not None:
            z = self.dropout(z)

After Change


                g = self.gate_act(g)
                begin_g = 0  // index of first scalar gate capsule

            z = y.new_empty((y.size(0), size_out, y.size(2), y.size(3), y.size(4)))
            begin_y = 0  // index of first capsule

            for n, mul in enumerate(self.repr_out):
                if mul == 0:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: mariogeiger/se3cnn
Commit Name: aa7c004df5c781fc3b5b8131d7a9e64fd196203e
Time: 2018-05-26
Author: geiger.mario@gmail.com
File Name: se3_cnn/blocks/gated_block.py
Class Name: GatedBlock
Method Name: forward


Project Name: rusty1s/pytorch_geometric
Commit Name: 1118c16d3852beec9c0b18804d43a1fa01ef6786
Time: 2020-11-02
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/models/tgn.py
Class Name: TGN
Method Name: reset_state


Project Name: mariogeiger/se3cnn
Commit Name: 65f5a9006cf5e7e8daef6187e7987d7792f0feb6
Time: 2018-06-12
Author: geiger.mario@gmail.com
File Name: se3_cnn/non_linearities/gated_activation.py
Class Name: GatedActivation
Method Name: forward