'Typing: How to specify shape of array
How can I specify the "typing shape" of an array?
I have a function that returns a numpy array of shape (2, 2):
import numpy as np
def some_function() -> np.ndarray:
return np.array([[1, 2], [3, 4]])
I would like to specify the shape in the returning type.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
