Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tensor-likes #19

Open
patrick-kidger opened this issue May 26, 2021 · 0 comments
Open

Support tensor-likes #19

patrick-kidger opened this issue May 26, 2021 · 0 comments

Comments

@patrick-kidger
Copy link
Owner

patrick-kidger commented May 26, 2021

That is, classes supporting the __torch_function__ protocol.

This shouldn't be too difficult -- most of the necessary work has already been done.

  • There's some places where we have torch.Tensor hardcoded, for example in instance checks and some type annotations, that would need adjusting to accept tensor-likes.
  • TensorTypeMixin would need exposing as a public part of the interface.
  • The documentation needs updating to show how this is possible. Once the above changes are made it should just be:
from torchtyping import TensorTypeMixin

class TensorLike:
    ...

class TensorLikeType(TensorLike, TensorTypeMixin):
    base_cls = TensorLike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant