Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5071cf53
提交
5071cf53
authored
12月 26, 2011
作者:
James Bergstra
提交者:
Frederic
1月 23, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
comments in blas.py
上级
f85856b2
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
28 行增加
和
14 行删除
+28
-14
blas.py
theano/tensor/blas.py
+28
-14
没有找到文件。
theano/tensor/blas.py
浏览文件 @
5071cf53
...
@@ -6,18 +6,26 @@ Learn more about BLAS here:
...
@@ -6,18 +6,26 @@ Learn more about BLAS here:
The standard BLAS libraries implement what is called "legacy BLAS" in that
The standard BLAS libraries implement what is called "legacy BLAS" in that
document.
document.
This documentation section describes Theano's BLAS optimization
This documentation describes Theano's BLAS optimization pipeline.
pipeline.
Where there is a discrepancy between how things do work and how they *should*
Where there is a discrepancy between how things do work and how they *should*
work, both aspects should be documented. It helps keep a broader agenda in view
work, both aspects should be documented.
even while fixing little bugs etc. from day to day.
There are four kinds of BLAS Ops in Theano:
- Python implementations (this file)
- SciPy-based (blas_scipy)
- C-based (blas_c)
- CUDA-based (theano.sandbox.cuda.blas)
:note: Unfortunately (because it's confusing) this file currently contains Ops
that contain both Python and C versions. I think it would be better to
move the C implementations to blas_c so that this file is pure Python.
-JB
Ops
Ops
===
===
There are two BLAS calls wrapped in this module: GEMM and GEMV.
GEMM: Dot22, Dot22Scalar, GemmRelated, Gemm
GEMM: Dot22, Dot22Scalar, GemmRelated, Gemm
-------------------------------------------
-------------------------------------------
...
@@ -45,16 +53,17 @@ GEMV: Gemv
...
@@ -45,16 +53,17 @@ GEMV: Gemv
The BLAS GEMV operation implements Z <- a X Y + b Z,
The BLAS GEMV operation implements Z <- a X Y + b Z,
where X is a matrix, Y, and Z are vectors, and a and b are scalars.
where X is a matrix, Y, and Z are vectors, and a and b are scalars.
Gemv implements the GEMV call in all its generality.
GER: Ger
--------
The BLAS GER operation implements Z <- a X' Y + Z,
where X and Y are vectors, and matrix Z gets a rank-1 update.
Other Notable BLAS-related Ops
Other Notable BLAS-related Ops
------------------------------
------------------------------
GpuOuter is currently a wrapper around GER. GER is a useful special case of
GEMM, and in the future it would be good to have a GER Op. With a GER Op here,
the GpuOuter could be turned into a GpuGER.
SYRK is another useful special case of GEMM. Particularly SYRK preserves
SYRK is another useful special case of GEMM. Particularly SYRK preserves
symmetry in the matrix that it updates. See how the linear-algebra module uses
symmetry in the matrix that it updates. See how the linear-algebra module uses
symmetry hints before implementing this Op, so that this Op is compatible with
symmetry hints before implementing this Op, so that this Op is compatible with
...
@@ -64,14 +73,19 @@ that system.
...
@@ -64,14 +73,19 @@ that system.
Optimizations
Optimizations
=============
=============
The current optimization pipeline is not exactly clear to me. Instead I will
The optimization pipeline works something like this:
describe how it should work.
The high level pipeline is:
1. identify dot22 from dot
1. identify dot22 from dot
2. identify gemm from dot22
2. identify gemm from dot22
3. identify dot22scalar from dot22 that are not gemm
3. identify dot22scalar from dot22 that are not gemm
4. specialize gemm to gemv where applicable
4. specialize gemm to gemv where applicable
5. specialize gemm to ger where applicable
6. specialize dot22 -> gemv or ger where applicable
:note: GEMM is the most canonical BLAS signature that we deal with so far, it
would be good to turn most things into GEMM (dot, inner, outer, dot22,
dot22scalar), and then to specialize from gemm to the various other L2 and
L3 operations.
Identify Dot22
Identify Dot22
--------------
--------------
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论