Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8b7aecd5
提交
8b7aecd5
authored
1月 13, 2015
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
ac0fdcfc
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
165 行增加
和
37 行删除
+165
-37
presentation.tex
doc/nextml2015/presentation.tex
+165
-37
没有找到文件。
doc/nextml2015/presentation.tex
浏览文件 @
8b7aecd5
...
@@ -166,6 +166,32 @@ Montréal, Canada \newline
...
@@ -166,6 +166,32 @@ Montréal, Canada \newline
\end{itemize}
\end{itemize}
\end{frame}
\end{frame}
\begin{frame}
{
Theano
}
High-level domain-specific language tailored to numeric computation.
\begin{itemize}
\item
Syntax as close to NumPy as possible
\item
Compiles most common expressions to C for CPU and/or GPU
\item
Limited expressivity means more opportunities optimizations
\begin{itemize}
\item
No subroutines -> global optimization
\item
Strongly typed -> compiles to C
\item
Array oriented -> easy parallelism
\item
Support for looping and branching in expressions
\end{itemize}
\item
Automatic speed and stability optimizations
\item
Can reuse other technologies for best performance.
\begin{itemize}
\item
BLAS, SciPy, Cython, Numba, PyCUDA, CUDA
\end{itemize}
\item
Automatic differentiation and R op
\item
Sparse matrices
\end{itemize}
\end{frame}
%% \begin{frame}{Why scripting for GPUs?}
%% \begin{frame}{Why scripting for GPUs?}
%% \begin{bf}They complement each other\end{bf}
%% \begin{bf}They complement each other\end{bf}
...
@@ -185,15 +211,6 @@ Montréal, Canada \newline
...
@@ -185,15 +211,6 @@ Montréal, Canada \newline
%% \end{frame}
%% \end{frame}
\begin{frame}
{
Overview of Library
}
Theano is many things
\begin{itemize}
\item
Language
\item
Compiler
\item
Python library
\end{itemize}
\end{frame}
\begin{frame}
{
Project status?
}
\begin{frame}
{
Project status?
}
\begin{itemize}
\begin{itemize}
\item
Mature: Theano has been developed and used since January 2008 (7 yrs old)
\item
Mature: Theano has been developed and used since January 2008 (7 yrs old)
...
@@ -211,8 +228,16 @@ Montréal, Canada \newline
...
@@ -211,8 +228,16 @@ Montréal, Canada \newline
\end{frame}
\end{frame}
\begin{frame}
{
Overview
}
\begin{frame}
{
Overview of Library
}
Theano language:
Theano is many things
\begin{itemize}
\item
Language
\item
Compiler
\item
Python library
\end{itemize}
\end{frame}
\begin{frame}
{
Overview Language
}
\begin{itemize}
\begin{itemize}
\item
Operations on scalar, vector, matrix, tensor, and sparse variables
\item
Operations on scalar, vector, matrix, tensor, and sparse variables
\item
Linear algebra
\item
Linear algebra
...
@@ -222,30 +247,6 @@ Montréal, Canada \newline
...
@@ -222,30 +247,6 @@ Montréal, Canada \newline
\end{itemize}
\end{itemize}
\end{frame}
\end{frame}
\begin{frame}
{
Theano
}
High-level domain-specific language tailored to numeric computation.
\begin{itemize}
\item
Syntax as close to NumPy as possible
\item
Compiles most common expressions to C for CPU and/or GPU
\item
Limited expressivity means more opportunities optimizations
\begin{itemize}
\item
No subroutines -> global optimization
\item
Strongly typed -> compiles to C
\item
Array oriented -> easy parallelism
\item
Support for looping and branching in expressions
\end{itemize}
\item
Automatic speed and stability optimizations
\item
Can reuse other technologies for best performance.
\begin{itemize}
\item
BLAS, SciPy, Cython, Numba, PyCUDA, CUDA
\end{itemize}
\item
Automatic differentiation and R op
\item
Sparse matrices
\end{itemize}
\end{frame}
\begin{frame}
[fragile]
\begin{frame}
[fragile]
\frametitle
{
Overview
}
\frametitle
{
Overview
}
...
@@ -538,6 +539,7 @@ modes regard as fine.
...
@@ -538,6 +539,7 @@ modes regard as fine.
\item
T.scalar, T.vector, T.matrix resolve to 32 bit or 64 bit depending on theano’s floatX flag
\item
T.scalar, T.vector, T.matrix resolve to 32 bit or 64 bit depending on theano’s floatX flag
\item
floatX is float64 by default, set it to float32
\item
floatX is float64 by default, set it to float32
\item
Set device flag to gpu (or a specific gpu, like gpu0)
\item
Set device flag to gpu (or a specific gpu, like gpu0)
\item
flag: warn
\_
float64=
{
'ignore', 'warn', 'raise', 'pdb'
}
\end{itemize}
\end{itemize}
\end{frame}
\end{frame}
...
@@ -859,6 +861,115 @@ print f([0, 1, 2])
...
@@ -859,6 +861,115 @@ print f([0, 1, 2])
\end{frame}
\end{frame}
\begin{frame}
\frametitle
{
Scan
}
Allow looping (for, map, while)
Allow recursion (reduce)
Allow recursion with dependency on many of the previous time step
Optimize some cases live moving computation outside of scan.
When not to use scan:
If only needed for ``vectorization'' or ``broadcasting''. tensor and
numpy.ndarray support them natively. This will be much better.
You do a fixed number of iteration that is very small (2,3). You are probably better to just unroll the graph to do it.
The Scan grad is Backpropagation
\_
through
\_
time(BPTT)
\end{frame}
\begin{frame}
[fragile]
\frametitle
{
Scan Example1: Computing tanh(v.dot(W) + b) * d where b is binomial
}
\lstset
{
language=Python,
commentstyle=
\itshape\color
{
blue
}
,
stringstyle=
\color
{
violet
}
,
}
\begin{lstlisting}
import theano
import theano.tensor as T
import numpy as np
# define tensor variables
X = T.matrix("X")
W = T.matrix("W")
b
_
sym = T.vector("b
_
sym")
# define shared random stream
trng = T.shared
_
randomstreams.RandomStreams(1234)
d=trng.binomial(size=W[1].shape)
results, updates = theano.scan(lambda v: T.tanh(T.dot(v, W) + b
_
sym) * d, sequences=X)
compute
_
with
_
bnoise = theano.function(inputs=[X, W, b
_
sym], outputs=[results],
updates=updates, allow
_
input
_
downcast=True)
x = np.eye(10, 2, dtype=theano.config.floatX)
w = np.ones((2, 2), dtype=theano.config.floatX)
b = np.ones((2), dtype=theano.config.floatX)
print compute
_
with
_
bnoise(x, w, b)
\end{lstlisting}
\end{frame}
\begin{frame}
[fragile]
\frametitle
{
Scan Example2: Computing pow(A, k)
}
\lstset
{
language=Python,
commentstyle=
\itshape\color
{
blue
}
,
stringstyle=
\color
{
violet
}
,
}
\begin{lstlisting}
import theano
import theano.tensor as T
theano.config.warn.subtensor
_
merge
_
bug = False
k = T.iscalar("k")
A = T.vector("A")
def inner
_
fct(prior
_
result, B):
return prior
_
result * B
# Symbolic description of the result
result, updates = theano.scan(fn=inner
_
fct,
outputs
_
info=T.ones
_
like(A),
non
_
sequences=A, n
_
steps=k)
# Scan has provided us with A ** 1 through A ** k. Keep only the last
# value. Scan notices this and does not waste memory saving them.
final
_
result = result[-1]
power = theano.function(inputs=[A, k], outputs=final
_
result,
updates=updates)
print power(range(10), 2)
#[ 0. 1. 4. 9. 16. 25. 36. 49. 64. 81.]
\end{lstlisting}
\end{frame}
\begin{frame}
[fragile]
\frametitle
{
Scan signature
}
\lstset
{
language=Python,
commentstyle=
\itshape\color
{
blue
}
,
stringstyle=
\color
{
violet
}
,
}
\begin{lstlisting}
result, updates = theano.scan(fn=inner
_
fct,
outputs
_
info=T.ones
_
like(A),
non
_
sequences=A, n
_
steps=k)
\end{lstlisting}
\begin{itemize}
\item
updates are needed if there is random number generated in the
\item
Just pass them to the call theano.function(..., updates=updates)
\item
The innfer function of scan take argument like this:
\item
scan: sequence, outputs
\_
info, nonsequence
\end{itemize}
\end{frame}
\section
{
RNN
}
\section
{
RNN
}
\begin{frame}
\begin{frame}
...
@@ -878,8 +989,25 @@ Theano/Pylearn2/libgpuarry provide an environment for machine learning that is:
...
@@ -878,8 +989,25 @@ Theano/Pylearn2/libgpuarry provide an environment for machine learning that is:
\section
{
Exercices
}
\section
{
Exercices
}
\begin{frame}
{
Exercices
}
\begin{frame}
{
Exercices
}
Work through the ``01
\_
buildbing
\_
expressions'' directory now.
\begin{itemize}
Available at ``git~clone~https://github.com/nouiz/ccw
\_
tutorial
\_
theano.git''.
\item
Theano exercice: Work through the ``01
\_
buildbing
\_
expressions'',
``02
\_
compiling
\_
and
\_
running'',
``03
\_
modifying'' and/or ``04
\_
debugging''
directory now.
Available at ``git~clone~https://github.com/abergeron/ccw
\_
tutorial
\_
theano.git''.
\item
Scan exercices:
\url
{
http://deeplearning.net/software/theano/tutorial/loop.html
\#
exercise
}
\item
Modif LSTM: Add the V
\_
o parameter and use it.
\item
Modif LSTM: Add to have 2 LSTM layers. The new one take the
input in the reverse order. Then you concatenate the mean of the
outputs of both LSTM to the logistic regression. (No solutions provided)
\end{itemize}
Deep Learning Tutorial on LSTM:
\url
{
http://deeplearning.net/tutorial/lstm.html
}
(It have the papers
\end{frame}
\end{frame}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论