0ac2b33e8c63304a50db7d2b484368299706b58b,slm_lab/agent/net/recurrent.py,RecurrentNet,forward,#RecurrentNet#Any#,144

Before Change


        x = self.state_proc_model(x)
        // Restack to batch_size x seq_len x rnn_input_dim
        x = x.view(-1, self.seq_len, self.rnn_input_dim)
        hid_0 = self.init_hidden(batch_size)
        _, final_hid = self.rnn_model(x, hid_0)
        final_hid.squeeze_(dim=0)
        // return tensor if single tail, else list of tail tensors
        if len(self.model_tails) == 1:
            return self.model_tails[0](final_hid)

After Change


        // Restack to batch_size x seq_len x rnn_input_dim
        x = x.view(-1, self.seq_len, self.rnn_input_dim)
        if self.cell_type == "LSTM":
            _output, (h_n, c_n) = self.rnn_model(x)
        else:
            _output, h_n = self.rnn_model(x)
        hid_x = h_n[-1:].squeeze_(dim=0)  // get final time-layer
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: kengz/SLM-Lab
Commit Name: 0ac2b33e8c63304a50db7d2b484368299706b58b
Time: 2018-11-14
Author: kengzwl@gmail.com
File Name: slm_lab/agent/net/recurrent.py
Class Name: RecurrentNet
Method Name: forward


Project Name: ruotianluo/ImageCaptioning.pytorch
Commit Name: 7e89919dbd6cbc22ae1dd8f1f1988b23af965a01
Time: 2018-05-31
Author: rluo@ttic.edu
File Name: models/TransformerModel.py
Class Name: TransformerModel
Method Name: _sample_beam