edd70b9132cbc32f866ee3aabbb023166c3dbe32,thinc/neural/_classes/affine.py,,_alloc_mem_if_able,#Any#,19

Before Change




def _alloc_mem_if_able(model, *args, **kwargs):
    weights = [desc for (name, desc) in model.descriptions.items()
               if isinstance(desc, describe.Weights)]
    shapes = {}
    for param in weights:
        shape = tuple([getattr(model, dim, None) for dim in param.shape])

After Change




def _alloc_mem_if_able(model, *args, **kwargs):
    if model.nO is None or model.nI is None:
        return None
    else:
        model.mem = Memory(model.nO * model.nI + model.nO)
        model.W = model.mem.add(name, (model.nO, model.nI))
        model.b = model.mem.add(name, (model.nO,))


def _init_weights_if_able(model, *args, **kwargs):
    if model.mem:
        for name, desc in model.description.items():
            if isinstance(desc, Weights):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: explosion/thinc
Commit Name: edd70b9132cbc32f866ee3aabbb023166c3dbe32
Time: 2017-01-12
Author: honnibal+gh@gmail.com
File Name: thinc/neural/_classes/affine.py
Class Name:
Method Name: _alloc_mem_if_able


Project Name: nipy/dipy
Commit Name: 14d296009281bee1b55ed42adffd6e8fe7975d6a
Time: 2018-08-13
Author: marc.cote.19@gmail.com
File Name: dipy/viz/tests/test_ui.py
Class Name:
Method Name: test_ui_radio_button


Project Name: nipy/dipy
Commit Name: 14d296009281bee1b55ed42adffd6e8fe7975d6a
Time: 2018-08-13
Author: marc.cote.19@gmail.com
File Name: dipy/viz/tests/test_ui.py
Class Name:
Method Name: test_ui_checkbox