Don't overwrite model in initialization, when loading

This commit is contained in:
Matthew Honnibal 2017-05-27 15:50:40 -05:00
parent 99316fa631
commit 8de9829f09

View File

@ -19,6 +19,8 @@ import numpy
def _init_for_precomputed(W, ops):
if (W**2).sum() != 0.:
return
reshaped = W.reshape((W.shape[1], W.shape[0] * W.shape[2]))
ops.xavier_uniform_init(reshaped)
W[:] = reshaped.reshape(W.shape)
@ -247,6 +249,7 @@ def doc2feats(cols=None):
model.cols = cols
return model
def print_shape(prefix):
def forward(X, drop=0.):
return X, lambda dX, **kwargs: dX