【Theano】复习Numpy
来源:互联网 发布:建行黄金软件下载 编辑:程序博客网 时间:2024/06/04 22:47
1.机器学习的约定
考虑如下例子:
numpy.asarray([[1., 2], [3, 4], [5, 6]])numpy.asarray([[1., 2], [3, 4], [5, 6]]).shape
这是一个3x2的矩阵,那么访问第三行第一列的元素为:
numpy.asarray([[1., 2], [3, 4], [5, 6]])[2, 0]
2.广播
Numpy在算术运算中对不同形状阵列数组进行了广播操作。这意味着,一般是较小的数组(或标量)是通过广播跨越较大的阵列以使它们具有兼容的形状。
下面的例子显示广播的一个实例:
a = numpy.asarray([1.0, 2.0, 3.0])b = 2.0a * b
广播(broadcasting)处理规则:
- 让所有输入数组都向其中维数最多的数组看齐, shape 属性中不足的部分都通过在前面加 1 补齐。
- 输出数组的 shape 属性是输入数组的 shape 属性在各个轴上的最大值。
- 如果输入数组的某个轴长度为 1 或与输出数组对应轴的长度相同,这个数组就能够用来计算,否则出错。
- 当输入数组的某个轴长度为 1 时,沿着此轴运算时都用此轴上的第一组值。
>>> a=np.arange(0,50,10)>>> a=a.reshape(-1,1)>>> aarray([[ 0], [10], [20], [30], [40]])>>> a.shape(5L, 1L)>>> b=np.arange(3)>>> barray([0, 1, 2])>>> b.shape(3L,)>>> c=a+b>>> carray([[ 0, 1, 2], [10, 11, 12], [20, 21, 22], [30, 31, 32], [40, 41, 42]])
0 0
- 【Theano】复习Numpy
- Theano 0.6 文档[1] - NumPy 复习
- python +numpy,theano,cifar
- numpy,theano中的函数
- theano,numpy和scipy
- Theano学习二----numpy
- Numpy and Theano broadcasting
- theano,numpy tile函数
- Theano 学习numpy.asarray(), theano.shared()
- python +numpy,theano,cifar 2
- windows64 配置numpy,scipy,theano
- theano中的numpy.random和theano.tensor中的RandomStream
- Python配置第三方库numpy、scipy、theano
- win32 python3.4.1 下安装Numpy、matplotlib、Scipy、theano、sklearn
- 循环神经网络在Python 、Numpy和Theano中的实现
- Theano 中文文档 0.9 - 7.1.2 NumPy新手
- theano
- Theano
- mysql设计外键关联
- hdu2289(简单二分)
- 创建索引锁的表
- Install Apache, PHP, APC, & MySQL on Amazon EC2 with Amazon Linux AMI
- C语言字符串与集合的关系
- 【Theano】复习Numpy
- leetcode -day17 Path Sum I II & Flatten Binary Tree to Linked List & Minimum Depth of Binary Tree
- 2014-05-17查看本机的某个端口是否被占,并查找占用该端口的进程,关闭该进程
- 进程间通信的介绍
- STM32学习之路-中断优先级<NIVC(2)>
- 可以了
- JSP内置对象讲解
- php中安全模式safe_mode配置教程--不理解,从未接触过
- jsp常见状态代码