Theano(2) Algebra
2015-08-16 21:45
197 查看
Algebra 代数 [ˈældʒəbrə]
http://deeplearning.net/software/theano/tutorial/adding.html
(1)Scalars 向量加法
x = theano.tensor.dscalar('x')
y = theano.tensor.dscalar('y')
z = x + y
f = theano.function([x, y], z)
(2)矩阵加法
x = theano.tensor.dmatrix('x')
y = theano.tensor.dmatrix('y')
z = x + y
f = theano.function([x, y], z)
(3)练习
import theano
a = theano.tensor.vector() # 容易忘记写括号
b = theano.tensor.vector() # 同上
out = a**2 + b**2 + 2*a*b # 注意书写格式
f = theano.function([a, b], out) # 注意向量a和b的写法
print(f([1, 2], [4, 5])) # 写一个例子测试一下
http://deeplearning.net/software/theano/tutorial/adding.html
(1)Scalars 向量加法
x = theano.tensor.dscalar('x')
y = theano.tensor.dscalar('y')
z = x + y
f = theano.function([x, y], z)
(2)矩阵加法
x = theano.tensor.dmatrix('x')
y = theano.tensor.dmatrix('y')
z = x + y
f = theano.function([x, y], z)
(3)练习
import theano
a = theano.tensor.vector() # 容易忘记写括号
b = theano.tensor.vector() # 同上
out = a**2 + b**2 + 2*a*b # 注意书写格式
f = theano.function([a, b], out) # 注意向量a和b的写法
print(f([1, 2], [4, 5])) # 写一个例子测试一下
相关文章推荐
- 3.3 typedef__第3章 数据 《C和指针》
- 【Android】自定义圆形ImageView(圆形头像 可指定大小)
- 【POJ 3241】曼哈顿最小生成树(模板整理)
- 光场相机 标定微透镜阵列
- 新技术成长型企业往往经过四个发展阶段
- 代理商与经销商的区别
- 泛型 学习记录1
- Java 编程下的二分法查找
- 滑雪(poj 1088)
- 优化SQL语句 2
- Win32汇编--Windows 的内存安排--------2015年9月28日 00:01:54
- 清除缓存功能
- OC基础
- vmware下克隆系统
- android onTouchEvent 左右手势滑动事件处理
- 复制一个Dialog后DoModal()返回-1
- c 语言 逆波兰计算器 C语言程序设计中的例子
- c++继承与派生
- Microsoft Dynamics server 2015 所有的SQL server 2012 视图 介绍及功能
- Microsoft Dynamics server 2015 所有的SQL server 2012 视图 介绍及功能