Python常用函数
2016-01-25 02:27
573 查看
1. 序列整数(range函数)
2. 断言assert
assert 表达式
如果表达式为Ture,则对程序没有影响,继续运行
如果表达式为False,则会抛出
例子:assert image_shape[1] != filter_shape[1]
这里的image_shape为(500,1,28,28)
filter_shape为(20,1,5,5)
可见image_shape[1] =1 == filter_shape[1] =1
所以,表达式assert image_shape[1] != filter_shape[1]为False,程序出错,抛出AssertionError
2. 断言assert
assert 表达式
如果表达式为Ture,则对程序没有影响,继续运行
如果表达式为False,则会抛出
AssertionError,程序停止运行
例子:assert image_shape[1] != filter_shape[1]
这里的image_shape为(500,1,28,28)
filter_shape为(20,1,5,5)
可见image_shape[1] =1 == filter_shape[1] =1
所以,表达式assert image_shape[1] != filter_shape[1]为False,程序出错,抛出AssertionError
相关文章推荐
- Python如何进行cross validation training
- Python/Keras如何将给定的数据集打乱
- Python-装饰器以及对带有参数的装饰器的理解
- Python 删除列表中的重复数据
- 21行Python代码实现拼写检查器
- 基于Python Shell获取hostname和fqdn释疑
- 谈谈Python进行验证码识别的一些想法
- Python网站验证码识别
- 详解Python验证码识别
- Python开发如何在ubuntu 15.10 上配置vim
- Python编程中对文件和存储器的读写示例
- python黑魔法之编码转换
- Python IDE
- Python之路——线程池
- [Leetcode]126. Word Ladder II python
- Python 各种测试框架简介(二):unittest
- elipse+pydev pydeliciou导入问题
- python read()
- 在eclipes 中配置python
- [Leetcode]127. Word Ladder@python