504166f623fee9ac5004369489c39838c875eab9,thinc/layers/bidirectional.py,,_split,#Any#Any#,47

Before Change




def _split(ops, X_size_at_t):
    X, size_at_t = X_size_at_t
    half = X.shape[-1] // 2
    X_l2r = X[..., :half]
    X_r2l = X[..., half:]
    return ((X_l2r, size_at_t), (X_r2l, size_at_t))


def _sum(ops, X_size_at_t, Y_size_at_t):
    X, size_at_t = X_size_at_t

After Change


    half = Xp.data.shape[-1] // 2
    X_l2r = Xp.data[..., :half]
    X_r2l = Xp.data[..., half:]
    return (Padded(X_l2r, Xp.size_at_t), Padded(X_r2l, Xp.size_at_t))


def _sum(ops: Ops, Xp: Padded, Yp: Padded) -> Padded:
    return Padded(Xp.data + Yp.data, Xp.size_at_t)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: explosion/thinc
Commit Name: 504166f623fee9ac5004369489c39838c875eab9
Time: 2020-01-04
Author: honnibal+gh@gmail.com
File Name: thinc/layers/bidirectional.py
Class Name:
Method Name: _split


Project Name: explosion/thinc
Commit Name: 504166f623fee9ac5004369489c39838c875eab9
Time: 2020-01-04
Author: honnibal+gh@gmail.com
File Name: thinc/layers/bidirectional.py
Class Name:
Method Name: _sum


Project Name: explosion/thinc
Commit Name: 504166f623fee9ac5004369489c39838c875eab9
Time: 2020-01-04
Author: honnibal+gh@gmail.com
File Name: thinc/layers/bidirectional.py
Class Name:
Method Name: _reverse