About those axes

I have seen a lot of blogs that explain abstractly what direction, coordinate axis, etc. It is estimated that the author himself is also confused. Especially when I saw this blog , I suddenly realized it. When using this parameter, be sure to remember what each dimension of the matrix you operate represents. !
E.g:

   # 使用一张图片测试神经网络的性能
   img = test_images[1]
   print(img.shape)
-->(28, 28)
   # tensorflow中要求(batch_size,rows,cols)三元组的形式输入模型中,因此必须在第一个维度上拓展出新的来。则axis=0
   img = (np.expand_dims(img,0))
   print(img.shape)
-->(1,28,28)

Guess you like

Origin www.cnblogs.com/hotech/p/12730506.html