#Import the NumPy library
import numpy as np
def sum_last_two_axes(A):
A_T = np.transpose(A, axes=(0, 1, 3, 2)).reshape(A.shape[:-2] + (-1,))
sum_arr = np.sum(A_T, axis=-1)
return sum_arr
# example usage
A = np.random.randint(0,10,(3,4,3,4))
sum_arr = sum_last_two_axes(A)
print(sum_arr)