mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-19 20:52:23 +03:00
Remove unused function
This commit is contained in:
parent
5c98c4c3b9
commit
23344857b9
|
@ -41,21 +41,6 @@ def topk(xp, arr, k, axis=None):
|
||||||
return svals, oidxs
|
return svals, oidxs
|
||||||
|
|
||||||
|
|
||||||
def logsumexp(xp, arr, axis=None):
|
|
||||||
"""Emulate torch.logsumexp by returning the log of summed exponentials
|
|
||||||
along each row in the given dimension.
|
|
||||||
|
|
||||||
Reduces a 2d array to 1d."""
|
|
||||||
# from slide 5 here:
|
|
||||||
# https://www.slideshare.net/ryokuta/cupy
|
|
||||||
|
|
||||||
# Note: this was added to reproduce loss calculation in coref-hoi. If loss
|
|
||||||
# can be calculated using another method this is not necessary.
|
|
||||||
hi = arr.max(axis=axis)
|
|
||||||
hi = xp.expand_dims(hi, 1)
|
|
||||||
return hi.squeeze() + xp.log(xp.exp(arr - hi).sum(axis=axis))
|
|
||||||
|
|
||||||
|
|
||||||
# from model.py, refactored to be non-member
|
# from model.py, refactored to be non-member
|
||||||
def get_predicted_antecedents(xp, antecedent_idx, antecedent_scores):
|
def get_predicted_antecedents(xp, antecedent_idx, antecedent_scores):
|
||||||
"""Get the ID of the antecedent for each span. -1 if no antecedent."""
|
"""Get the ID of the antecedent for each span. -1 if no antecedent."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user