Closed AdilZouitine closed 3 years ago
Yep, that sounds good to me. I'd be very happy to accept a PR on this.
In passing: The syntax currently used is TensorType[3, 3, -1, torch.float32]
not TensorType[(3, 3, -1), torch.float32]
(taken from your example). If you particularly want the second syntax then I'd be happy to have that in as well.
The different arguments in the []
are distinguished by type rather than position. This was a deliberate choice to
TensorType[float]
rather than something like TensorType[(...,), float]
.TensorType["channels": 4]
to be able to put both name and size to a dimension.In passing: The syntax currently used is
TensorType[3, 3, -1, torch.float32]
notTensorType[(3, 3, -1), torch.float32]
(taken from your example).The different arguments in the
[]
are distinguished by type rather than position. This was a deliberate choice to
- (a) make it easy to do just
TensorType[float]
rather than something likeTensorType[(...,), float]
.- (b) make it possible to use slice syntax like
TensorType["channels": 4]
to be able to put both name and size to a dimension.
I understand your choice! (I will therefore modify my example) 😄
Closed by #6.
Hi, I would like to thank you for this cool library. I was desperate not to find a shape typing for pytorch and I had planned to code it myself if it didn't exist.
I think your api is great, however I find that specifying the dimension of any shape to
-1
is not very intuitive (I saw that you have many other ways to declare it). One idea is to declare a dimension with any shape using typing.Any. As the librarynbtyping
does :In this case we have typed our array with no constraints on the last dimension. If we apply this modification to your library:
What do you think of this? If you're interested I can try to make a pull request!
I thank you again for developing this wonderful library.