d1f6748120abc8b1b0bfccd2e6ccc4142ba127d0,allennlp/modules/conditional_random_field.py,ConditionalRandomField,_joint_likelihood,#ConditionalRandomField#Any#Any#Any#,238

Before Change


            current_tag, next_tag = tags[i], tags[i+1]

            // The scores for transitioning from current_tag to next_tag
            transition_score = (
                    broadcast_transitions
                    // Choose the current_tag-th row for each input
                    .gather(1, current_tag.view(batch_size, 1, 1).expand(batch_size, 1, num_tags))
                    // Squeeze down to (batch_size, num_tags)
                    .squeeze(1)
                    // Then choose the next_tag-th column for each of those
                    .gather(1, next_tag.view(batch_size, 1))
                    // And squeeze down to (batch_size,)
                    .squeeze(1)
            )

            // The score for using current_tag
            emit_score = logits[i].gather(1, current_tag.view(batch_size, 1)).squeeze(1)

After Change


        // Transition from last state to "stop" state. To start with, we need to find the last tag
        // for each instance.
        last_tag_index = mask.sum(0).long() - 1
        last_tags = tags.gather(0, last_tag_index.view(1, batch_size)).squeeze(0)

        // Compute score of transitioning to `stop_tag` from each "last tag".
        if self.include_start_end_transitions:
            last_transition_score = self.end_transitions.index_select(0, last_tags)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: allenai/allennlp
Commit Name: d1f6748120abc8b1b0bfccd2e6ccc4142ba127d0
Time: 2018-08-29
Author: lauraruis@Live.nl
File Name: allennlp/modules/conditional_random_field.py
Class Name: ConditionalRandomField
Method Name: _joint_likelihood


Project Name: allenai/allennlp
Commit Name: b70e026702c590618552ab857fc6661662ab72f2
Time: 2018-08-21
Author: mattg@allenai.org
File Name: allennlp/modules/attention/linear_attention.py
Class Name: LinearAttention
Method Name: _forward_internal


Project Name: cornellius-gp/gpytorch
Commit Name: 60a342edc8b501802135df44869353cc8604d838
Time: 2018-01-11
Author: gpleiss@gmail.com
File Name: gpytorch/kernels/rbf_kernel.py
Class Name: RBFKernel
Method Name: forward