d0ccc3e02e1a9015d05cade8dfc61896948275c7,fairseq/models/lstm.py,LSTMDecoder,reorder_incremental_state,#LSTMDecoder#Any#Any#,568

Before Change


        if incremental_state is None or len(incremental_state) == 0:
            return
        prev_hiddens, prev_cells, input_feed = self.get_cached_state(incremental_state)
        cached_state = (prev_hiddens, prev_cells, [input_feed])
        new_state = [self.reorder_state(state, new_order) for state in cached_state]
        prev_hiddens_tensor = torch.stack(new_state[0])
        prev_cells_tensor = torch.stack(new_state[1])
        cached_state_new = torch.jit.annotate(
            Dict[str, Optional[Tensor]],
            {"prev_hiddens": prev_hiddens_tensor, "prev_cells": prev_cells_tensor, "input_feed": new_state[2][0]})
        self.set_incremental_state(incremental_state, "cached_state", cached_state_new),
        return

After Change


        if incremental_state is None or len(incremental_state) == 0:
            return
        prev_hiddens, prev_cells, input_feed = self.get_cached_state(incremental_state)
        prev_hiddens = [p.index_select(0, new_order) for p in prev_hiddens]
        prev_cells = [p.index_select(0, new_order) for p in prev_cells]
        if input_feed is not None:
            input_feed = input_feed.index_select(0, new_order)
        cached_state_new = torch.jit.annotate(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pytorch/fairseq
Commit Name: d0ccc3e02e1a9015d05cade8dfc61896948275c7
Time: 2020-06-22
Author: myleott@fb.com
File Name: fairseq/models/lstm.py
Class Name: LSTMDecoder
Method Name: reorder_incremental_state


Project Name: OpenNMT/OpenNMT-py
Commit Name: 58cb18761fc72e5f9b8dd92a222a14b0240d8436
Time: 2017-08-20
Author: srush@seas.harvard.edu
File Name: onmt/Translator.py
Class Name: Translator
Method Name: translate


Project Name: cornellius-gp/gpytorch
Commit Name: 9b664bd7cd8dbb9657626166ba61887ed06774d7
Time: 2017-09-13
Author: gpleiss@gmail.com
File Name: gpytorch/utils/toeplitz.py
Class Name:
Method Name: index_coef_to_sparse