Пример функции сжимания Python Numpy с осью
# welcome to softhunt.net
# Python program explaining
# numpy.squeeze function
import numpy as geek
in_arr = geek.arange(9).reshape(1, 3, 3)
print ("Input array : \n", in_arr)
out_arr = geek.squeeze(in_arr, axis = 0)
print ("output array : \n", out_arr)
print("The shapes of Input and Output array : ",in_arr.shape, out_arr.shape)
Outrageous Ostrich