Fix depth=0, maxout pieces=0

This commit is contained in:
Matthw Honnibal 2019-11-19 11:17:56 +01:00
parent 511ced11ff
commit 31af39f851

View File

@ -493,13 +493,16 @@ cdef class precompute_hiddens:
if self.activation == "relu":
mask = state_vector >= 0.
state_vector *= mask
else:
mask = None
def backprop_nonlinearity(d_best, sgd=None):
if isinstance(d_best, numpy.ndarray):
ops = NumpyOps()
else:
ops = CupyOps()
mask_ = ops.asarray(mask)
if mask is not None:
mask_ = ops.asarray(mask)
# This will usually be on GPU
d_best = ops.asarray(d_best)