c6e83948f53bcd5d77b1714b691bbd74d12da613,thinc/initializers.py,,xavier_uniform_init,#,8

Before Change




def xavier_uniform_init(data: Array, *, inplace: bool = False) -> Array:
    xp = get_array_module(data)
    scale = xp.sqrt(6.0 / (data.shape[0] + data.shape[1]))
    if inplace:
        copy_array(data, xp.random.uniform(-scale, scale, data.shape))
        return data
    else:
        return xp.random.uniform(-scale, scale, data.shape)


@registry.initializers("xavier_uniform_init.v0")
def configure_xavier_uniform_init(*, inplace: bool = False) -> Callable[[Array], Array]:
    return partial(xavier_uniform_init, inplace=inplace)

After Change



def xavier_uniform_init(ops: Ops, shape: Shape) -> Array:
    scale = ops.xp.sqrt(6.0 / (shape[0] + shape[1]))
    return ops.asarray(numpy.random.uniform(-scale, scale, shape), dtype="f")


@registry.initializers("xavier_uniform_init.v0")
def configure_xavier_uniform_init() -> Callable[[Shape], Array]:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: explosion/thinc
Commit Name: c6e83948f53bcd5d77b1714b691bbd74d12da613
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/initializers.py
Class Name:
Method Name: xavier_uniform_init


Project Name: explosion/thinc
Commit Name: c6e83948f53bcd5d77b1714b691bbd74d12da613
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/initializers.py
Class Name:
Method Name: uniform_init


Project Name: explosion/thinc
Commit Name: c6e83948f53bcd5d77b1714b691bbd74d12da613
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/initializers.py
Class Name:
Method Name: normal_init


Project Name: explosion/thinc
Commit Name: c6e83948f53bcd5d77b1714b691bbd74d12da613
Time: 2020-01-19
Author: honnibal+gh@gmail.com
File Name: thinc/initializers.py
Class Name:
Method Name: xavier_uniform_init