def normalize_attr_array(a: Any) -> np.ndarray:
if type(a) is np.ndarray:<EOL><INDENT>return a<EOL><DEDENT>elif type(a) is np.matrix:<EOL><INDENT>if a.shape[<NUM_LIT:0>] == <NUM_LIT:1>:<EOL><INDENT>return np.array(a)[<NUM_LIT:0>, :]<EOL><DEDENT>elif a.shape[<NUM_LIT:1>] == <NUM_LIT:1>:<EOL><INDENT>return np.array(a)[:, <NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>elif type(a) is list or type(a) is tuple:<EOL><INDENT>return np.array(a)<EOL><DEDENT>elif sparse.issparse(a):<EOL><INDENT>return normalize_attr_array(a.todense())<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>
Take all kinds of array-like inputs and normalize to a one-dimensional np.ndarray