mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-22 22:40:32 +03:00
Fix depth=0, maxout pieces=0
This commit is contained in:
parent
511ced11ff
commit
31af39f851
|
@ -493,13 +493,16 @@ cdef class precompute_hiddens:
|
||||||
if self.activation == "relu":
|
if self.activation == "relu":
|
||||||
mask = state_vector >= 0.
|
mask = state_vector >= 0.
|
||||||
state_vector *= mask
|
state_vector *= mask
|
||||||
|
else:
|
||||||
|
mask = None
|
||||||
|
|
||||||
def backprop_nonlinearity(d_best, sgd=None):
|
def backprop_nonlinearity(d_best, sgd=None):
|
||||||
if isinstance(d_best, numpy.ndarray):
|
if isinstance(d_best, numpy.ndarray):
|
||||||
ops = NumpyOps()
|
ops = NumpyOps()
|
||||||
else:
|
else:
|
||||||
ops = CupyOps()
|
ops = CupyOps()
|
||||||
mask_ = ops.asarray(mask)
|
if mask is not None:
|
||||||
|
mask_ = ops.asarray(mask)
|
||||||
|
|
||||||
# This will usually be on GPU
|
# This will usually be on GPU
|
||||||
d_best = ops.asarray(d_best)
|
d_best = ops.asarray(d_best)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user