keras.argmax中axis = -1的含义是什么? [英] What is the meaning of axis=-1 in keras.argmax?

查看:1080
本文介绍了keras.argmax中axis = -1的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Keras的初学者,需要帮助来了解keras.argmax(a, axis=-1)keras.max(a, axis=-1). a.shape = (19, 19, 5, 80)axis=-1是什么意思?还有keras.argmax(a, axis=-1)keras.max(a, axis=-1)的输出是什么?

I am a beginner in Keras and need help to understand keras.argmax(a, axis=-1) and keras.max(a, axis=-1). What is the meaning of axis=-1 when a.shape = (19, 19, 5, 80)? And also what will be the output of keras.argmax(a, axis=-1) and keras.max(a, axis=-1)?

推荐答案

这意味着argmax返回的索引将从最后一个轴获取.

This means that the index that will be returned by argmax will be taken from the last axis.

您的数据具有某些形状(19,19,5,80).这意味着:

Your data has some shape (19,19,5,80). This means:

  • 轴0 = 19个元素
  • 轴1 = 19个元素
  • 第2轴= 5个元素
  • 第3轴= 80个元素

现在,负数的工作方式与python列表,numpy数组等完全相同.负数表示相反的顺序:

Now, negative numbers work exactly like in python lists, in numpy arrays, etc. Negative numbers represent the inverse order:

  • 轴-1 = 80个元素
  • 轴-2 = 5个元素
  • 轴-3 = 19个元素
  • 轴-4 = 19个元素

axis参数传递给argmax函数时,返回的索引将基于该轴.您的结果将失去该特定的轴,但保留其他轴.

When you pass the axis parameter to the argmax function, the indices returned will be based on this axis. Your results will lose this specific axes, but keep the others.

查看每个索引将返回什么形状argmax:

See what shape argmax will return for each index:

  • K.argmax(a,axis= 0 or -4)返回具有0 to 18
  • 值的(19,5,80)
  • K.argmax(a,axis= 1 or -3)返回具有0 to 18
  • 值的(19,5,80)
  • K.argmax(a,axis= 2 or -2)返回具有0 to 4
  • 值的(19,19,80)
  • K.argmax(a,axis= 3 or -1)返回具有0 to 79
  • 中值的(19,19,5)
  • K.argmax(a,axis= 0 or -4) returns (19,5,80) with values from 0 to 18
  • K.argmax(a,axis= 1 or -3) returns (19,5,80) with values from 0 to 18
  • K.argmax(a,axis= 2 or -2) returns (19,19,80) with values from 0 to 4
  • K.argmax(a,axis= 3 or -1) returns (19,19,5) with values from 0 to 79

这篇关于keras.argmax中axis = -1的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆