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

Bug in tensor.Tensor.copy #206

Closed
y-richie-y opened this issue Jul 29, 2023 · 1 comment · Fixed by #208
Closed

Bug in tensor.Tensor.copy #206

y-richie-y opened this issue Jul 29, 2023 · 1 comment · Fixed by #208

Comments

@y-richie-y
Copy link
Collaborator

y-richie-y commented Jul 29, 2023

from discopy import *
spider = markov.Diagram.copy(markov.Ty('n'), 2)
func = tensor.Functor(ob={markov.Ty('n'): tensor.Dim(3)}, ar={}, dom=markov.Category())

func(spider)
    338 @classmethod
    339 def copy(cls, x: int, n: int) -> Matrix:
    340     array = [[i + int(j % n * x) == j
--> 341               for j in range(n * x)] for i in range(x)]
    342     return cls(array, x, n * x)

TypeError: 'Dim' object cannot be interpreted as an integer

The type signature of tensor.Tensor.copy is def copy(cls, x: int, n: int) -> Matrix:, maybe it should be def copy(cls, x: Dim, n: int) -> Matrix: instead?

@toumix toumix mentioned this issue Jul 29, 2023
@y-richie-y
Copy link
Collaborator Author

Nice!

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

Successfully merging a pull request may close this issue.

1 participant