c638823db4caa6c562423903807b5eac652b2e23,thinc/layers/staticvectors.py,,forward,#,28

Before Change


def forward(model: Model[InT, OutT], ids: InT, is_train: bool) -> Tuple[OutT, Callable]:
    column = model.get_attr("column")
    W = cast(Array2d, model.get_param("W"))
    vector_table = _get_vectors(model.ops, model.get_attr("lang"))
    if ids.ndim >= 2:
        ids = model.ops.as_contig(ids[:, column])
    vectors = vector_table[ids * (ids < vector_table.shape[0])]

After Change



def forward(model: Model[InT, OutT], ids: InT, is_train: bool) -> Tuple[OutT, Callable]:
    if model.has_attr("dropout_rate"):
        dropout = model.get_attr("dropout_rate")
    else:
        dropout = None
    column = model.get_attr("column")
    W = cast(Array2d, model.get_param("W"))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: explosion/thinc
Commit Name: c638823db4caa6c562423903807b5eac652b2e23
Time: 2020-01-24
Author: honnibal+gh@gmail.com
File Name: thinc/layers/staticvectors.py
Class Name:
Method Name: forward


Project Name: explosion/thinc
Commit Name: ab43f5af3bc8300a62fea518c7fcf9f6d23570d8
Time: 2020-01-24
Author: honnibal+gh@gmail.com
File Name: thinc/layers/staticvectors.py
Class Name:
Method Name: init


Project Name: riga/tfdeploy
Commit Name: aead7cf4711ce834a9a067c4bb6db11893c2a96b
Time: 2016-12-23
Author: marcelrieger@me.com
File Name: tfdeploy.py
Class Name: Operation
Method Name: __init__