Download Python/train/3.13/variadic-generics/modern_09.py from SwashBuckler001/idiombench: direct link, hf CLI and curl.
- Browser
- Download file 529 Bytes
-
https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/variadic-generics/modern_09.py
- Command line
-
hf download hf://datasets/SwashBuckler001/idiombench/Python/train/3.13/variadic-generics/modern_09.py
-
curl -L -o modern_09.py https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/variadic-generics/modern_09.py
529 Bytes
| Shape = TypeVarTuple('Shape') | |
| Batch = NewType('Batch', int) | |
| Channels = NewType('Channels', int) | |
| def add_batch_axis(x: Array[*Shape]) -> Array[Batch, *Shape]: ... | |
| def del_batch_axis(x: Array[Batch, *Shape]) -> Array[*Shape]: ... | |
| def add_batch_channels( | |
| x: Array[*Shape] | |
| ) -> Array[Batch, *Shape, Channels]: ... | |
| a: Array[Height, Width] | |
| b = add_batch_axis(a) # Inferred type is Array[Batch, Height, Width] | |
| c = del_batch_axis(b) # Array[Height, Width] | |
| d = add_batch_channels(a) # Array[Batch, Height, Width, Channels] | |