在使用 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. vue中路由在新的标签页打开

    如下 let routeData = this.$router.resolve({ name: 'commercialPreview', query: {cylType: this.$route.qu ...

  2. Flask应用启动流程

    目录 flask应用启动流程 WSGI 启动流程 flask应用启动流程 WSGI 所有的 python web 框架都要遵循 WSGI 协议 在这里还是要简单回顾一下 WSGI 的核心概念. WSG ...

  3. SpringBoot自动装配原理解析

    本文包含:SpringBoot的自动配置原理及如何自定义SpringBootStar等 我们知道,在使用SpringBoot的时候,我们只需要如下方式即可直接启动一个Web程序: @SpringBoo ...

  4. 未能加载文件或程序集“Spire.Pdf, Version=4.8.8.2020, Culture=neutral, PublicKeyToken=663f351905198cb3”或它的某一个依赖项。未能授予最小权限请求

    问题:运行程序执行到代码报错:未能加载文件或程序集“Spire.Pdf, Version=4.8.8.2020, Culture=neutral, PublicKeyToken=663f3519051 ...

  5. OEL7.6设置光盘YUM源

    先把原来的yum源改名让他失效 mv public-yum-ol7.repo public-yum-ol7.repo.bak 然后新建个yum源 [root@localhost yum.repos.d ...

  6. hadoop hdfs 有内网、公网ip后,本地调试访问不了集群解决

    问题背景: 使用云上的虚拟环境搭建测试集群,导入一些数据,在本地idea做些debug调试,但是发现本地idea连接不上测试环境 集群内部配置hosts映射是内网映射(内网ip与主机名映射),本地只能 ...

  7. docker部署zabbix

    我相信大家都已经会再物理机上跑zabbix并且监控了,那么有没有想过在docker中跑zabbix?下面咱们来看看如何在docker中搭建zabbix并且监控 部署环境 2台物理机机器: zabbix ...

  8. Bash Shell中的特殊位置变量及其应用

    Bash Shell中的特殊位置变量及其应用 众所周知bash shell中有许多特殊的位置变量,灵活使用它们可以更好地发挥Shell脚本的功用. 即位置变量:$1,$2,...来表示,用于让脚本在脚 ...

  9. Leetcode——1. 两数之和

    难度: 简单 题目 Given an array of integers, return indices of the two numbers such that they add up to a s ...

  10. vue - 基础(2)

    <div id="content"> {{ msg }} <div v-text="msg"></div> <div ...