From 952c87409eafb9312ca62b1a940c8635d539dc74 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 13 Mar 2018 02:12:01 +0100 Subject: [PATCH] Use openblas.sgemm in parser --- spacy/_ml.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/_ml.py b/spacy/_ml.py index e5d1cfc63..a6686c177 100644 --- a/spacy/_ml.py +++ b/spacy/_ml.py @@ -144,8 +144,8 @@ class PrecomputableAffine(Model): self.nF = nF def begin_update(self, X, drop=0.): - Yf = self.ops.xp.dot(X, - self.W.reshape((self.nF*self.nO*self.nP, self.nI)).T) + Yf = self.ops.gemm(X, + self.W.reshape((self.nF*self.nO*self.nP, self.nI)), trans2=True) Yf = Yf.reshape((Yf.shape[0], self.nF, self.nO, self.nP)) Yf = self._add_padding(Yf) @@ -165,7 +165,7 @@ class PrecomputableAffine(Model): # Reuse the buffer dWopfi = Wopfi; dWopfi.fill(0.) - self.ops.xp.dot(dY.T, Xf, out=dWopfi) + self.ops.gemm(dY, Xf, out=dWopfi, trans1=True) dWopfi = dWopfi.reshape((self.nO, self.nP, self.nF, self.nI)) # (o, p, f, i) --> (f, o, p, i) self.d_W += dWopfi.transpose((2, 0, 1, 3))