import numpy as np mat_A = np.random.randn(3, 4) mat_B = np.random.randn(3, 4) # matrix subtraction — manual, step by step out = np.zeros((3, 4)) for i in range(mat_A.shape[0]): for j in range(mat_A.shape[1]): out[i, j] = mat_A[i, j] - mat_B[i, j] print(out) __ __