a8f7adae8546cfac4473bd514b0070367d725f2e,allennlp/models/semantic_parsing/nlvr/nlvr_semantic_parser.py,NlvrSemanticParser,__init__,#NlvrSemanticParser#Any#Any#Any#Any#Any#,46

Before Change


        self._sentence_embedder = sentence_embedder
        self._denotation_accuracy = Average()
        self._consistency = Average()
        self._encoder = encoder
        self._rule_namespace = rule_namespace

        self._action_embedder = Embedding(num_embeddings=vocab.get_vocab_size(self._rule_namespace),
                                          embedding_dim=action_embedding_dim)

        // This is what we pass as input in the first step of decoding, when we don"t have a
        // previous action.
        self._first_action_embedding = torch.nn.Parameter(torch.FloatTensor(action_embedding_dim))
        torch.nn.init.normal(self._first_action_embedding)

    @overrides
    def forward(self):  // type: ignore

After Change


        Dropout on the encoder outputs.
    rule_namespace : ``str``, optional (default=rule_labels)
        The vocabulary namespace to use for production rules.  The default corresponds to the
        default used in the dataset reader, so you likely don"t need to modify this.
    
    def __init__(self,
                 vocab: Vocabulary,
                 sentence_embedder: TextFieldEmbedder,
                 action_embedding_dim: int,
                 encoder: Seq2SeqEncoder,
                 dropout: float = 0.0,
                 rule_namespace: str = "rule_labels") -> None:
        super(NlvrSemanticParser, self).__init__(vocab=vocab)

        self._sentence_embedder = sentence_embedder
        self._denotation_accuracy = Average()
        self._consistency = Average()
        self._encoder = encoder
        if dropout > 0:
            self._dropout = torch.nn.Dropout(p=dropout)
        else:
            self._dropout = lambda x: x
        self._rule_namespace = rule_namespace

        self._action_embedder = Embedding(num_embeddings=vocab.get_vocab_size(self._rule_namespace),
                                          embedding_dim=action_embedding_dim)

        // This is what we pass as input in the first step of decoding, when we don"t have a
        // previous action.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 14

Instances


Project Name: allenai/allennlp
Commit Name: a8f7adae8546cfac4473bd514b0070367d725f2e
Time: 2018-05-13
Author: pradeep.dasigi@gmail.com
File Name: allennlp/models/semantic_parsing/nlvr/nlvr_semantic_parser.py
Class Name: NlvrSemanticParser
Method Name: __init__


Project Name: allenai/allennlp
Commit Name: a8f7adae8546cfac4473bd514b0070367d725f2e
Time: 2018-05-13
Author: pradeep.dasigi@gmail.com
File Name: allennlp/models/semantic_parsing/nlvr/nlvr_semantic_parser.py
Class Name: NlvrSemanticParser
Method Name: __init__


Project Name: rusty1s/pytorch_geometric
Commit Name: e60669c5aa467d5c11a508c01b37c4ed8e352fa6
Time: 2021-02-15
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/conv/supergat_conv.py
Class Name: SuperGATConv
Method Name: __init__


Project Name: rusty1s/pytorch_geometric
Commit Name: 7b4892781e2198ad99a8655da03133505619040a
Time: 2020-06-28
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/conv/arma_conv.py
Class Name: ARMAConv
Method Name: __init__