# \`\_\_origin\_\_\` \`AttributeError\` when using \`torch.library.custom\_op\`

**URL:** <https://discuss.pytorch.org/t/origin-attributeerror-when-using-torch-library-custom-op/216810>\
**Category:** jit\
**Created:** [February 18, 2025, 6:49am UTC](https://discuss.pytorch.org/t/origin-attributeerror-when-using-torch-library-custom-op/216810 "2025-02-18T06:49:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avi\_Chapman](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/avi_chapman/32/10688_2.png) [@Avi\_Chapman](https://discuss.pytorch.org/u/Avi_Chapman)\
**Post date:** [February 18, 2025, 6:49am UTC](https://discuss.pytorch.org/t/origin-attributeerror-when-using-torch-library-custom-op/216810/1 "2025-02-18T06:49:43Z")

</div>

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:

```auto
@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.
