Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a081a56f
提交
a081a56f
authored
5月 15, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2912 from nouiz/doc
Doc
上级
51368a6b
297556ce
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
27 行增加
和
33 行删除
+27
-33
examples.txt
doc/tutorial/examples.txt
+9
-3
using_gpu.txt
doc/tutorial/using_gpu.txt
+6
-0
basic.py
theano/tensor/basic.py
+11
-30
extra_ops.py
theano/tensor/extra_ops.py
+1
-0
没有找到文件。
doc/tutorial/examples.txt
浏览文件 @
a081a56f
...
@@ -325,9 +325,10 @@ Here's a brief example. The setup code is:
...
@@ -325,9 +325,10 @@ Here's a brief example. The setup code is:
Here, 'rv_u' represents a random stream of 2x2 matrices of draws from a uniform
Here, 'rv_u' represents a random stream of 2x2 matrices of draws from a uniform
distribution. Likewise, 'rv_n' represents a random stream of 2x2 matrices of
distribution. Likewise, 'rv_n' represents a random stream of 2x2 matrices of
draws from a normal distribution. The distributions that are implemented are
draws from a normal distribution. The distributions that are implemented are
defined in :class:`RandomStreams` and, at a lower level, in :ref:`raw_random<libdoc_tensor_raw_random>`.
defined in :class:`RandomStreams` and, at a lower level,
in :ref:`raw_random<libdoc_tensor_raw_random>`. They only work on CPU.
See `Other Implementations`_ for GPU version.
.. TODO: repair the latter reference on RandomStreams
Now let's use these objects. If we call f(), we get random uniform numbers.
Now let's use these objects. If we call f(), we get random uniform numbers.
The internal state of the random number generator is automatically updated,
The internal state of the random number generator is automatically updated,
...
@@ -459,10 +460,15 @@ Other Random Distributions
...
@@ -459,10 +460,15 @@ Other Random Distributions
There are :ref:`other distributions implemented <libdoc_tensor_raw_random>`.
There are :ref:`other distributions implemented <libdoc_tensor_raw_random>`.
.. _example_other_random:
Other Implementations
Other Implementations
---------------------
---------------------
There is 2 other implementations based on :class:`CURAND <theano.sandbox.cuda.rng_curand>` and :ref:`MRG31k3p <libdoc_rng_mrg>`
There is 2 other implementations based on :class:`CURAND
<theano.sandbox.cuda.rng_curand>` and :ref:`MRG31k3p
<libdoc_rng_mrg>`. The RandomStream only work on the CPU, MRG31k3p
work on the CPU and GPU. CURAND only work on the GPU.
.. _logistic_regression:
.. _logistic_regression:
...
...
doc/tutorial/using_gpu.txt
浏览文件 @
a081a56f
...
@@ -744,3 +744,9 @@ efficiency over the basic solution that is asked here, the two operations would
...
@@ -744,3 +744,9 @@ efficiency over the basic solution that is asked here, the two operations would
have to be jointly optimized explicitly in the code.)
have to be jointly optimized explicitly in the code.)
Modify and execute to support *stride* (i.e. to avoid constraining the input to be *C-contiguous*).
Modify and execute to support *stride* (i.e. to avoid constraining the input to be *C-contiguous*).
Note
----
See :ref:`example_other_random` to know how to handle random numbers
on the GPU.
theano/tensor/basic.py
浏览文件 @
a081a56f
...
@@ -1196,28 +1196,6 @@ def cast(x, dtype):
...
@@ -1196,28 +1196,6 @@ def cast(x, dtype):
##########################
##########################
@constructor
def
old_shape
(
a
):
"""
Return the shape tuple of a TensorType Variable.
It may be either symbolic or nonsymbolic.
If the shape of the expression is not known at graph-construction time,
then a symbolic lvector will be returned, corresponding to the actual
shape at graph-execution time.
"""
va
=
as_tensor_variable
(
a
)
# print 'HERE', va, va.type
if
None
in
va
.
type
.
shape
:
# Some shape components are unknown at this time
return
_shape
(
va
)
else
:
# all shape components are known at compile time, so we return
# a tuple directly. This tuple is like the numpy.ndarray.shape tuple.
return
va
.
type
.
shape
class
MaxAndArgmax
(
Op
):
class
MaxAndArgmax
(
Op
):
"""Calculate the max and argmax over a given axis or over all axes.
"""Calculate the max and argmax over a given axis or over all axes.
"""
"""
...
@@ -3306,13 +3284,15 @@ def addbroadcast(x, *axes):
...
@@ -3306,13 +3284,15 @@ def addbroadcast(x, *axes):
Input theano tensor.
Input theano tensor.
axis : an int or an iterable object such as list or tuple
axis : an int or an iterable object such as list or tuple
of int values
of int values
The dimension along which the tensor x should be broadcastable.
if the length of x along these dimensions is not 1,
The dimension along which the tensor x should be
a ValueError will be raised.
broadcastable. if the length of x along these
dimensions is not 1, a ValueError will be raised.
returns:
returns:
----------
----------
a theano tensor, which is broadcastable along the specified dimensions.
a theano tensor, which is broadcastable along the specified dimensions.
"""
"""
rval
=
Rebroadcast
(
*
[(
axis
,
True
)
for
axis
in
axes
])(
x
)
rval
=
Rebroadcast
(
*
[(
axis
,
True
)
for
axis
in
axes
])(
x
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
...
@@ -3334,13 +3314,15 @@ def unbroadcast(x, *axes):
...
@@ -3334,13 +3314,15 @@ def unbroadcast(x, *axes):
Input theano tensor.
Input theano tensor.
axis : an int or an iterable object such as list or tuple
axis : an int or an iterable object such as list or tuple
of int values
of int values
The dimension along which the tensor x should be unbroadcastable.
if the length of x along these dimensions is not 1,
The dimension along which the tensor x should be
a ValueError will be raised.
unbroadcastable. if the length of x along these
dimensions is not 1, a ValueError will be raised.
returns:
returns:
----------
----------
a theano tensor, which is unbroadcastable along the specified dimensions.
a theano tensor, which is unbroadcastable along the specified dimensions.
"""
"""
rval
=
Rebroadcast
(
*
[(
axis
,
False
)
for
axis
in
axes
])(
x
)
rval
=
Rebroadcast
(
*
[(
axis
,
False
)
for
axis
in
axes
])(
x
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
...
@@ -3363,6 +3345,7 @@ def patternbroadcast(x, broadcastable):
...
@@ -3363,6 +3345,7 @@ def patternbroadcast(x, broadcastable):
Input theano tensor.
Input theano tensor.
broadcastable : an iterable object such as list or tuple
broadcastable : an iterable object such as list or tuple
of bool values
of bool values
a set of boolean values indicating whether a dimension
a set of boolean values indicating whether a dimension
should be broadcastable or not.
should be broadcastable or not.
if the length of x along these dimensions is not 1,
if the length of x along these dimensions is not 1,
...
@@ -5468,8 +5451,6 @@ class Choose(Op):
...
@@ -5468,8 +5451,6 @@ class Choose(Op):
"We currently didn't implemented that case. "
"We currently didn't implemented that case. "
"To make it work, explicitly add dimensions "
"To make it work, explicitly add dimensions "
"of size one for dimensions that will be broadcasted"
)
"of size one for dimensions that will be broadcasted"
)
assert
isinstance
(
node
.
inputs
[
1
],
theano
.
typed_list
.
TypedListVariable
)
bcast
=
[
False
]
*
out_ndim
bcast
=
[
False
]
*
out_ndim
for
idx
,
(
b1
,
b2
)
in
enumerate
(
for
idx
,
(
b1
,
b2
)
in
enumerate
(
...
...
theano/tensor/extra_ops.py
浏览文件 @
a081a56f
...
@@ -456,6 +456,7 @@ def bincount(x, weights=None, minlength=None, assert_nonneg=False):
...
@@ -456,6 +456,7 @@ def bincount(x, weights=None, minlength=None, assert_nonneg=False):
:param assert_nonneg: A flag that inserts an assert_op to check if
:param assert_nonneg: A flag that inserts an assert_op to check if
every input x is nonnegative.
every input x is nonnegative.
Optional.
Optional.
.. versionadded:: 0.6
.. versionadded:: 0.6
"""
"""
compatible_type
=
(
'int8'
,
'int16'
,
'int32'
,
'int64'
,
compatible_type
=
(
'int8'
,
'int16'
,
'int32'
,
'int64'
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论