7b05db6f551e7260f76ff456c25c05de07882650,torchnlp/nn/sru.py,SRU,forward,#SRU#Any#Any#,495

Before Change


        assert input_.dim() == 3  // (len, batch, input_size)
        dir_ = 2 if self.bidirectional else 1
        if c0 is None:
            zeros = Variable(input_.data.new(input_.size(1), self.hidden_size * dir_).zero_())
            c0 = [zeros for i in range(self.num_layers)]
        else:
            assert c0.dim() == 3  // (num_layers, batch, hidden_size*dir_)
            c0 = [x.squeeze(0) for x in c0.chunk(self.num_layers, 0)]

After Change


        assert input_.dim() == 3  // (len, batch, input_size)
        dir_ = 2 if self.bidirectional else 1
        if c0 is None:
            zeros = input_.new_zeros(input_.size(1), self.hidden_size * dir_)
            c0 = [zeros for i in range(self.num_layers)]
        else:
            assert c0.dim() == 3  // (num_layers, batch, hidden_size*dir_)
            c0 = [x.squeeze(0) for x in c0.chunk(self.num_layers, 0)]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: PetrochukM/PyTorch-NLP
Commit Name: 7b05db6f551e7260f76ff456c25c05de07882650
Time: 2018-05-05
Author: petrochukm@gmail.com
File Name: torchnlp/nn/sru.py
Class Name: SRU
Method Name: forward


Project Name: PetrochukM/PyTorch-NLP
Commit Name: 7b05db6f551e7260f76ff456c25c05de07882650
Time: 2018-05-05
Author: petrochukm@gmail.com
File Name: torchnlp/nn/sru.py
Class Name: SRUCell
Method Name: forward


Project Name: asappresearch/sru
Commit Name: cece98b06174893b6f793454da2ddd172979239e
Time: 2020-01-29
Author: taolei@csail.mit.edu
File Name: sru/sru_functional.py
Class Name: SRUCell
Method Name: forward