在使用 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. HTML5 下拉控件绑定数据

    <select id="CommunityList" class="form-control" > <option>請選擇社團</ ...

  2. Python 查看模块的帮助文档,方法和帮助信息

    参考链接:https://blog.csdn.net/u013810296/article/details/55509284 这里介绍下python自带的查看帮助功能,可以在编程时不中断地迅速找到所需 ...

  3. 一、NodeJS入门——准备工作(1)——NodeJS的安装

    目录 1.介绍 2.nodejs下载 3.nodejs安装 4.nodejs的简单实用 5.nodejs的经典入门:hello world 6.总结 1    介绍 这是一系列的内容主要是关于我在学习 ...

  4. Java中的集合类(List,Set.Map)

    1.List 1.1 Arraylist 与 LinkedList 区别 是否保证线程安全: ArrayList 和 LinkedList 都是不同步的,也就是不保证线程安全: 底层数据结构: Arr ...

  5. java request.getInputStream中文乱码解决方案

    请求时要指定为UTF-8,中文码码完美解决 /** * * 得到请求body字符串,一般用于content-type:application/json * */ public static Strin ...

  6. 在verilog中使用格雷码

    格雷码的一些知识: https://baike.baidu.com/item/%E6%A0%BC%E9%9B%B7%E7%A0%81/6510858?fr=aladdin 绿色框起来的是0--15的格 ...

  7. vue+element 根据内容计算单元格的宽度

    需求是这样的,之前我也写过,就是前端渲染的表格数据是动态渲染表格的行和列, 那么就必然出现了一个问题,当列超过一定的个数的时候,会出现横向滚动条, 那么怎么让表格整体看起来自然协调一些呢,老大要求表格 ...

  8. 中国工业的下一个十年在哪里?APS系统或将引领智能化转型

    为什么众多的ERP软件公司没有推出相关产品,当然可以肯定的是并非客户没有此观念,如果一定要说,也只能说目前的需求还不是非常强烈,从ERP厂商非常急切的与APS公司合作,甚至有高价购买APS公司代码的情 ...

  9. 使用 Python 生成二维码

    在“一带一路”国际合作高峰论坛举行期间, 20 国青年投票选出中国的“新四大发明”:高铁.扫码支付.共享单车和网购.其中扫码支付指手机通过扫描二维码跳转到支付页面,再进行付款.这种新的支付方式,造就二 ...

  10. linux 下 Google配置SwitchyOmega

     本文是在linux配置shadowssocks中配置的,windows也可以 通过上一篇文章我们学会了如何科学上网, 但是我们使用SwitchyOmega时选择的是proxy的代理模式 就是说我们不 ...