您的位置:首页 > 编程语言 > Python开发

Python常用函数

2016-01-25 02:27 573 查看
1. 序列整数(range函数)



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

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: