mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-19 20:52:23 +03:00
Fix type of mask
The call here was creating a float64 array, which was turning many downstream scores into float64s. Later on these values were assigned to a float32 array in backprop, and numerical underflow caused things to go to zero. That's almost certainly not the only reason things go to zero, but it is incorrect.
This commit is contained in:
parent
8452d117ef
commit
cb2364cf83
|
@ -373,7 +373,7 @@ def ant_scorer_forward(
|
||||||
warnings.filterwarnings('ignore', category=RuntimeWarning)
|
warnings.filterwarnings('ignore', category=RuntimeWarning)
|
||||||
mask = xp.log(
|
mask = xp.log(
|
||||||
(xp.expand_dims(ant_range, 1) - xp.expand_dims(ant_range, 0)) >= 1
|
(xp.expand_dims(ant_range, 1) - xp.expand_dims(ant_range, 0)) >= 1
|
||||||
).astype(float)
|
).astype('f')
|
||||||
|
|
||||||
scores = pw_prod + pw_sum + mask
|
scores = pw_prod + pw_sum + mask
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user