When I try to use torch.library.custom_op
to decorate an existing function in the spconv
library, I get an error AttributeError: __origin__
.
The method I am decorating is an exact copy of the ops.get_indices_pairs
method. I’ve added return typehinting and a metakernal.
My code looks like this:
@torch.library.custom_op("mylib::get_indice_pairs", mutates_args=())
def get_indice_pairs(...) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
...
@get_indice_pairs.register_fake
def _(...) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
return torch.empty(), torch.empty(), torch.empty()
Can anyone shed any light on this? The fact that it is looking for __origin__
would seem to indicate to me that it is about a generics issue, but I have no idea how.