spaCy
spaCy copied to clipboard
Doc.tensor into user_hooks
I want to customize Doc.tensor
property by user_hooks
like Doc.vector
, because sometimes calculation of the tensor is expensive (e.g. tok2vec pipe in spacy-transformers)
Hi @tamuhey, sorry for the late follow-up! Looks like we lost track of this one. I think it should be doable to extend the user hooks to include a value for tensor. As far as I understand, we'd need to refactor tensor
into a property
instead of calling the value doc.tensor
directly, and then you could consult user_hooks
first, in a similar fashion as how it's done for doc.vector
.
Is this still something you'd need? Do you feel like contributing a PR?
I'll try to create PR for this issue