from re import A from typing import List, Tuple, Union import numpy as np def reshape_matrix( a: List[List[Union[int, float]]], new_shape: Tuple[int, int] ) -> List[List[Union[int, float]]]: flattened = [num for row in a for num in row] r, c = new_shape # 检查元素总数是否匹配 if r * c != len(flattened): re...