在使用 CNN的时候,报错: TypeError: ('Keyword argument not understood:', 'padding')

将“padding”改为“border_mode”,即可:

原因:padding 是Keras 2.X的语法,而我的PC安装的是 Keras 1.X版本。

二者的API 有一些地方是有变化的。

如下:(从 1.X 到 2.X )

========【Models】

1、Constructor arguments for Model have been renamed:

  • input -> inputs
  • output -> outputs

2、The Sequential model not longer supports the set_input method.

3、For any model saved with Keras 2.0 or higher, weights trained with backend X will be converted to work with backend Y without any manual conversion step.

========【Layers】

1、Dense layer

  • Changed interface:
  • output_dim -> units
  • init -> kernel_initializer
  • added bias_initializer argument
  • W_regularizer -> kernel_regularizer
  • b_regularizer -> bias_regularizer
  • b_constraint -> bias_constraint
  • bias -> use_bias

2、Embedding

Convolutional layers :

Interface changes common to all convolutional layers:

  • nb_filter -> filters
  • float kernel dimension arguments become a single tuple argument, kernel size. E.g. a legacy call Conv2D(10, 3, 3) becomes Conv2D(10, (3, 3))
  • kernel_size can be set to an integer instead of a tuple, e.g. Conv2D(10, 3) is equivalent toConv2D(10, (3, 3)).
  • subsample -> strides. Can also be set to an integer.
  • border_mode -> padding
  • init -> kernel_initializer
  • added bias_initializer argument
  • W_regularizer -> kernel_regularizer
  • b_regularizer -> bias_regularizer
  • b_constraint -> bias_constraint
  • bias -> use_bias
  • dim_ordering -> data_format
  • In the SeparableConv2D layers, init is split into depthwise_initializer andpointwise_initializer.
  • Added dilation_rate argument in Conv2D and Conv1D.
  • 1D convolution kernels are now saved as a 3D tensor (instead of 4D as before).
  • 2D and 3D convolution kernels are now saved in format spatial_dims + (input_depth, depth)), even with data_format="channels_first".

3、Pooling1D

  • pool_length -> pool_size
  • stride -> strides
  • border_mode -> padding

4、Pooling2D,3D

  • border_mode -> padding
  • dim_ordering -> data_format

【Reference】

1、Keras 2.x和1.x的区别 :https://blog.csdn.net/ch1209498273/article/details/78287145

2、Keras 官方发布的 :Keras 2.0 release notes :https://github.com/keras-team/keras/wiki/Keras-2.0-release-notes

Debug 路漫漫-08:Keras 版本升级函数变换导致的问题的更多相关文章

  1. Debug 路漫漫-05

    Debug 路漫漫-05: 1.使用这种方式计算 AUC 指标,结果出来居然是 NAN, —— 分母为(M*N),M或者N必有一个为0 了.(nan出现的情况绝大部分是分母出现0了)   若分子为0的 ...

  2. Debug 路漫漫-03

    Debug 路漫漫-03:SVD++的 Matlab 版本 SVD++ 的 pu 这一项: 圈圈中的这一项,它既然要和pu 相加 的话 ,那么,它的维度也应该是 m*K.(就是维度和Pu一致的 . 而 ...

  3. Debug 路漫漫-01

    运行到子函数时提示报错:  === 这个断点一步步debug下来是顺利的,但是咋就超出数组范围了呢,这会是什么问题. ——sess肯定超过索引了,那个sess(:,2)的值肯定超过V的行数了. ——由 ...

  4. Debug 路漫漫-15:Python: NameError:name 'dataset' is not defined

    在调试 <Outer Product-based Neural Collaborative Filtering>论文的源码(https://github.com/duxy-me/ConvN ...

  5. Debug 路漫漫-02

    重现标准 BTL Model ,using MATLAB: 1. 错误使用 cat要串联的数组的维度不一致.出错 cell2mat (line 83) m{n} = cat(1,c{:,n}); —— ...

  6. Debug 路漫漫-13:Python: pandas IndexError: single positional indexer is out-of-bounds

    在数据预处理过程中,出现:IndexError: single positional indexer is out-of-bounds 原因是在使用 Pandas 读取 dataframe 的时候,分 ...

  7. Debug 路漫漫-11:Python: TypeError: 'generator' object is not subscriptable

    调试程序,出现以下错误: Python: TypeError: 'generator' object is not subscriptable “在Python中,这种一边循环一边计算的机制,称为生成 ...

  8. Debug 路漫漫-10:AttributeError: 'Embedding' object has no attribute 'get_shape'

    CNN的Embedding层报错: 报错:AttributeError: 'Embedding' object has no attribute 'get_shape' 查了下是这个问题: https ...

  9. Debug 路漫漫-07

    201811—201903???   1)关于训练参数是复数的问题    ——q_k ^theta   q_k(是item的特征矩阵)中有可能是负数,而指数 theta 如果是含小数点的话,就会产生复 ...

随机推荐

  1. asp.net SQLite关于各版本的调试

    最近想做一个简版的管理系统,将SQL SERVER数据库切换到SQLite数据库中,采用的是SQLite3的版本数据库. 开发工具:SV2015 UP3 数据库:SQLite3 项目整体结构图 相同的 ...

  2. 检测代码潜在bug和质量之SonarQube

    参数使用 项目分析参数可以在多个地方设置,继承关系如下: 全局分析参数,通过Web UI设置,作用于所有项目(配置–>通用–>通用中设置) 项目分析参数,通过WebUI设置,覆盖全局参数( ...

  3. 在VB编程中,若一行代码太长需要换行时,行尾要加什么符号

    & _ 注意,&与_之间一定要有一个空格 例如: aa="select " & _     "  a,b,c" & _      ...

  4. Java初学者推荐学习书籍PDF免费下载

    场景 Effective Java 中文版Java核心技术 卷Ⅰ 基础知识(第8版)Java语言程序设计-进阶篇(原书第8版)疯狂Java讲义Java从入门到精通 第三版Java编程思想第4版重构-改 ...

  5. Spring面试专题之aop

    1.背景 aop是编程中非常非常重要的一种思想,在spring项目中用的场景也非常广 2.面试问题 2.1.简单的面试问题 1.什么是aop,aop的作用是什么? 面向切面编程(AOP)提供另外一种角 ...

  6. INS-35178错误,AMM及ASMM区别

    遇到这个报错,就使用asmm 一般先装库,再opatch到最新补丁,最后dbca建库,物理内存大于4G不能用AMM只能用ASMM 内存越大,全自动管理就越费劲,出错概率就越高,内存抖动 oracle的 ...

  7. matplotlib 中的 colors 和 cmaps

    matplotlib 中的 148 种颜色 matplotlib 中的 160 种颜色映射 1.matplotlib中的 148 种颜色 import matplotlib as plm import ...

  8. curl-7.21.2

    curl 源码编译 自己定义的库编译 https://blog.csdn.net/initiallht/article/details/92655025 静态库,debug,x86nmake /f M ...

  9. 201871010110-李华《面向对象程序设计(java)》第6-7周学习总结

    项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p ...

  10. 201671030113 李星宇 实验十四 团队项目评审&课程学习总结

    项目 内容 所属课程 [所属课程(https://www.cnblogs.com/nwnu-daizh/) 作业要求 作业要求 课程学习目标 (1)掌握软件项目评审会流程:(2)反思总结课程学习内容 ...