Did u mean to statically restrict shape of the ndarray? For example, if u want a
to be a (3, 4)-shaped float64
array, you can write like this:
from typing import Literal as L
import numpy as np
a: np.ndarray[tuple[L[3], L[4]], np.dtype[np.float64]] = np.zeros((3, 4), dtype=np.float64)
But most of the time u don't have to.