d37529ed234ea9173ed35f6797a51a85378ecfca,fairseq/models/fairseq_incremental_decoder.py,FairseqIncrementalDecoder,reorder_incremental_state,#FairseqIncrementalDecoder#Any#Any#,62

Before Change


        previous time step. A typical use case is beam search, where the input
        order changes between time steps based on the selection of beams.
        
        seen = set()
        for module in self.modules():
            if (
                module != self
                and hasattr(module, "reorder_incremental_state")

After Change


        
        seen: Dict[int, Optional[Tensor]] = {}
        for _, module in self.named_modules():
            if hasattr(module, "reorder_incremental_state"):
                if id(module) not in seen and module is not self:
                    seen[id(module)] = None
                    result = module.reorder_incremental_state(incremental_state, new_order)
                    if result is not None:
                        incremental_state = result

    def set_beam_size(self, beam_size):
        Sets the beam size in the decoder and all children.
        if getattr(self, "_beam_size", -1) != beam_size:
            seen = set()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pytorch/fairseq
Commit Name: d37529ed234ea9173ed35f6797a51a85378ecfca
Time: 2020-04-07
Author: chenliu8@fb.com
File Name: fairseq/models/fairseq_incremental_decoder.py
Class Name: FairseqIncrementalDecoder
Method Name: reorder_incremental_state


Project Name: keras-team/keras
Commit Name: 555ca942df407b8c1bf1d48383c60fa1bf09cc1d
Time: 2019-08-28
Author: francois.chollet@gmail.com
File Name: keras/engine/network.py
Class Name: Network
Method Name: losses


Project Name: pytorch/fairseq
Commit Name: d369c8801913a0f88cfcc9b78db3410d24285c37
Time: 2020-04-06
Author: chenliu8@fb.com
File Name: fairseq/models/fairseq_incremental_decoder.py
Class Name: FairseqIncrementalDecoder
Method Name: reorder_incremental_state