出现这个问题,有几种解决办法,可以调低一下keras的版本,比如:

pip install keras==2.1

不过还有个更方便的方法,从错误可知softmax中不包含axis这个参数,那么把axis参数替换成dim就可以了。源代码是这样的:

def softmax(x, axis=-1):
"""Softmax of a tensor. # Arguments
x: A tensor or variable.
axis: The dimension softmax would be performed on.
The default is -1 which indicates the last dimension. # Returns
A tensor.
"""
return tf.nn.softmax(x, axis=axis)

更改成这样:

def softmax(x, axis=-1):
"""Softmax of a tensor. # Arguments
x: A tensor or variable.
axis: The dimension softmax would be performed on.
The default is -1 which indicates the last dimension. # Returns
A tensor.
"""
return tf.nn.softmax(x, dim=axis)

就是改了最后一行。

TypeError: softmax() got an unexpected keyword argument 'axis'的更多相关文章

  1. TypeError: parse() got an unexpected keyword argument 'transport_encoding'

    错误: TypeError: parse() got an unexpected keyword argument 'transport_encoding'You are using pip vers ...

  2. TypeError: __init__() got an unexpected keyword argument 't_command'

    python  .\manage.py migrate 报错如下 λ python .\manage.py migrateTraceback (most recent call last): File ...

  3. TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations'

    错误: TypeError: while_loop() got an unexpected keyword argument 'maximum_iterations' 参照https://blog.c ...

  4. TypeError: to_categorical() got an unexpected keyword argument 'nb_classes'

    在学习莫烦教程中keras教程时,报错:TypeError: to_categorical() got an unexpected keyword argument 'nb_classes',代码如下 ...

  5. TypeError: pivot_table() got an unexpected keyword argument 'rows'

    利用Python进行数据分析>第二章,处理MovieLens 1M数据集,有句代码总是报错: mean_rating = data.pivot_table('rating', rows='tit ...

  6. TypeError: parse() got an unexpected keyword argument 'transport_encoding' 安装tensor后报错

    TypeError: parse() got an unexpected keyword argument 'transport_encoding' 巨蛋疼,出这个问题后,老夫真是醉了,mmp,最后在 ...

  7. Python pika, TypeError: exchange_declare() got an unexpected keyword argument 'type' 问题修复

    网上很多写法都是 type='fanout' 这样的.(这里是基于python=3.6版本, pika=0.13.0 版本) credentials = pika.PlainCredentials(' ...

  8. TypeError: _obtain_input_shape() got an unexpected keyword argument 'include_top'

    报错 Traceback (most recent call last): File "D:/PyCharm 5.0.3/WorkSpace/3.Keras/2.Application中五款 ...

  9. Django TypeError: render() got an unexpected keyword argument 'renderer'

    场景: Xadmin添加plugin 来源: 1. xadmin与DjangoUeditor的安装 (第3.3章节) 2. 增加富文本编辑器Ueditor (第14.7章节) 报错: Django T ...

随机推荐

  1. linux下安装多个Tomcat

    编辑环境变量:vi /etc/profile 加入以下代码 ##########first tomcat########### CATALINA_BASE=/usr/local/src/tomcat ...

  2. sql是最成功的第四代语言

    SQL发展的前世今生 很多年前,两名年轻的IBM研究员将一门关系型语言带到了数据库领域,旨在使用声明性的方式来操作数据.从Don Chamberlin和Ramond Boyce发表"SEQU ...

  3. P5057 [CQOI2006]简单题

    题目描述 有一个 n 个元素的数组,每个元素初始均为 0.有 m 条指令,要么让其中一段连续序列数字反转——0 变 1,1 变 0(操作 1),要么询问某个元素的值(操作 2). 例如当 n = 20 ...

  4. 【tool】VLC播放rtmp协议

    您的输入无法被打开: VLC 无法打开 MRL「rtmp://112.35.3.71:47201/api/6276-0.1546939632724.flv」.详情请检查日志.

  5. DAY18、常用模块

    一.random:随机数1.(0,1) 小数:random.random()2.[1,10] 整数:random.randint(1,10)3.[1,10) 整数:random.randrange(1 ...

  6. c提高第四课

    1.一维数组的初始化 , , }; //3个元素 ] = { , , }; //a[3], a[4]自动初始化为0 ] = { }; //全部元素初始化为0 memset(c, , sizeof(c) ...

  7. 搭建Eureka注册中心

    创建一个Spring Boot工程,命名为eureka-server,并在pom.xml中引入必要的依赖,代码如下. <parent> <groupId>org.springf ...

  8. Gym - 101982F Rectangles (扫描线+线段树)

    链接:http://codeforces.com/gym/101982/attachments 思路: 问被覆盖次数为奇数次的矩阵的面积并 扫描线求矩阵面积并我们是上界赋为-1,下界赋为1,因为要求覆 ...

  9. Django 对接 支付宝支付, 回调

    平台 点击这里进入 蚂蚁金服开放平台 沙箱 点击这里进入 沙箱环境 初始界面 设置公钥 下载创建秘钥工具 1.  进入文档中心 这里 2. 选中 电脑网站支付 3. 进入后选中 API 列表 中的 统 ...

  10. BZOJ 2302: [HAOI2011]Problem c(数学+DP)

    题面: bzoj_2302 题解: 令\(dp[i][j]\)表示编号 \(\leq i\)的人有j个的方案数: \(cnt[i]\)表示编号指定为\(i\)的人数,\(sum[i]\)表示编号可以\ ...