-
Notifications
You must be signed in to change notification settings - Fork 1.5k
type annotation NdarrayOrTensor #2823
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
NdarrayOrTensor should be replaced by a type variable such as NdarrayTensor
this will ensure advanced type checks for correctness however it might not be supported by all the tools such as pytype, mypy
Additional context
MONAI/monai/config/type_definitions.py
Lines 65 to 76 in 93d467d
| NdarrayTensor = TypeVar("NdarrayTensor", np.ndarray, torch.Tensor) | |
| """NdarrayTensor | |
| Generic type which can represent either a numpy.ndarray or a torch.Tensor | |
| Unlike Union can create a dependence between parameter(s) / return(s) | |
| """ | |
| NdarrayOrTensor = Union[np.ndarray, torch.Tensor] | |
| """NdarrayOrTensor | |
| Union of numpy.ndarray and torch.Tensor to be used for typing | |
| """ |
this is a follow up of #2815
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request