出现这个问题,有几种解决办法,可以调低一下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. java中String的final类原因

    public final class String implements java.io.Serializable, Comparable<String>, CharSequence { ...

  2. Python协程的引入与原理分析

    相关概念 并发:指一个时间段内,有几个程序在同一个cpu上运行,但是任意时刻只有一个程序在cpu上运行.比如说在一秒内cpu切换了100个进程,就可以认为cpu的并发是100. 并行:值任意时刻点上, ...

  3. Docker 核心技术之仓库

    Docker 仓库简介 什么是Docker仓库 Docker仓库就是存放docker镜像并有docker pull方法下载的云环境 Docker仓库分为公有仓库和私有仓库. 公有仓库指Docker H ...

  4. springboot使用RestHighLevelClient批量插入

    1.引入maven(注意版本要一致) <dependency> <groupId>org.springframework.boot</groupId> <ar ...

  5. [ffmpeg] 多输入滤波同步方式(framesync)

    滤波也不总是单一的输入,也存在对多个输入流进行滤波的需求,最常见的就是对视频添加可视水印,水印的组成通常为原视频以及作为水印的图片或者小动画,在ffmpeg中可以使用overlay滤波器进行水印添加. ...

  6. java回调函数,看完就懂

    java回调函数在网上了看了些例子,比较绕,不够清晰,自己写的一个例子比较通俗,java回调其实很简单. 举个例子我是类B,我有个方法叫b(),现在我要调用类A中的方法a(),写个代码就是: publ ...

  7. python学习日记(OOP数据封装)

    class Student(object): def __init__(self,name,score): self.name = name self.score = score li = Stude ...

  8. beego框架开发投票网站(1) beego基础之运行逻辑

    本文档需结合beego官方文档食用 博主也仅仅是边学边记录,不保证内容的正确性,请当做通俗读物来看待 首先 beego是一个基于go语言的框架 其次 beego是一个mvc框架 框架可以理解为对底层又 ...

  9. MySQL逻辑备份into outfile

    MySQL 备份之 into outfile 逻辑数据导出(备份) 用法: select xxx into outfile '/path/file' from table_name; mysql> ...

  10. nginx 提示the "ssl" directive is deprecated, use the "listen ... ssl" directive instead

    该问题是由于新版nginx采用新的方式进行监听https请求了 解决方式 在listen中改为 listen 443 ssl; 删除ssl配置 # ssl on; 完美解决: 解决完成前后的配置如下 ...