Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
fe07fe2c
提交
fe07fe2c
authored
12月 09, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix white space.
上级
0a3f92f8
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
10 行增加
和
11 行删除
+10
-11
type.py
theano/sandbox/cuda/type.py
+10
-11
没有找到文件。
theano/sandbox/cuda/type.py
浏览文件 @
fe07fe2c
...
@@ -24,7 +24,7 @@ class CudaNdarrayType(Type):
...
@@ -24,7 +24,7 @@ class CudaNdarrayType(Type):
That variable type is `CudaNdarrayVariable` defined in the ``var.py`` file beside this one.
That variable type is `CudaNdarrayVariable` defined in the ``var.py`` file beside this one.
:note:
:note:
The var file depends on the file basic_ops.py, which depends on this file.
The var file depends on the file basic_ops.py, which depends on this file.
A cyclic dependency is avoided by not hardcoding ``Variable = CudaNdarrayVariable``.
A cyclic dependency is avoided by not hardcoding ``Variable = CudaNdarrayVariable``.
"""
"""
...
@@ -32,17 +32,17 @@ class CudaNdarrayType(Type):
...
@@ -32,17 +32,17 @@ class CudaNdarrayType(Type):
Constant
=
None
Constant
=
None
""" This will be set to `CudaNdarrayConstant` defined in ``var.py``
""" This will be set to `CudaNdarrayConstant` defined in ``var.py``
:note:
:note:
The var file depends on the file basic_ops.py, which depends on this file.
The var file depends on the file basic_ops.py, which depends on this file.
A cyclic dependency is avoided by not hardcoding this class.
A cyclic dependency is avoided by not hardcoding this class.
"""
"""
SharedVariable
=
None
SharedVariable
=
None
""" This will be set to `CudaNdarraySharedVariable` defined in ``var.py``
""" This will be set to `CudaNdarraySharedVariable` defined in ``var.py``
:note:
:note:
The var file depends on the file basic_ops.py, which depends on this file.
The var file depends on the file basic_ops.py, which depends on this file.
A cyclic dependency is avoided by not hardcoding this class.
A cyclic dependency is avoided by not hardcoding this class.
"""
"""
def
__init__
(
self
,
broadcastable
,
name
=
None
,
dtype
=
None
):
def
__init__
(
self
,
broadcastable
,
name
=
None
,
dtype
=
None
):
...
@@ -95,7 +95,7 @@ class CudaNdarrayType(Type):
...
@@ -95,7 +95,7 @@ class CudaNdarrayType(Type):
#we must convert that to bytes in case we
#we must convert that to bytes in case we
#will view the element as a different type.
#will view the element as a different type.
elem_size
=
numpy
.
zeros
(
0
,
dtype
=
a
.
dtype
)
.
dtype
.
itemsize
elem_size
=
numpy
.
zeros
(
0
,
dtype
=
a
.
dtype
)
.
dtype
.
itemsize
for
stri
,
shp
in
zip
(
a
.
_strides
,
a
.
shape
):
for
stri
,
shp
in
zip
(
a
.
_strides
,
a
.
shape
):
if
stri
<
0
:
if
stri
<
0
:
low
+=
(
stri
*
elem_size
)
*
(
shp
-
1
)
low
+=
(
stri
*
elem_size
)
*
(
shp
-
1
)
...
@@ -131,7 +131,7 @@ class CudaNdarrayType(Type):
...
@@ -131,7 +131,7 @@ class CudaNdarrayType(Type):
def
dtype_specs
(
self
):
def
dtype_specs
(
self
):
"""Return a tuple (python type, c type, numpy typenum) that corresponds to
"""Return a tuple (python type, c type, numpy typenum) that corresponds to
self.dtype.
self.dtype.
This function is used internally as part of C code generation.
This function is used internally as part of C code generation.
"""
"""
#TODO: add more type correspondances for e.g. int32, int64, float32,
#TODO: add more type correspondances for e.g. int32, int64, float32,
...
@@ -165,7 +165,7 @@ class CudaNdarrayType(Type):
...
@@ -165,7 +165,7 @@ class CudaNdarrayType(Type):
This read-only property is the preferred way to get the number of dimensions
This read-only property is the preferred way to get the number of dimensions
of a `CudaNdarrayType`.
of a `CudaNdarrayType`.
"""
"""
def
make_variable
(
self
,
name
=
None
):
def
make_variable
(
self
,
name
=
None
):
...
@@ -212,7 +212,7 @@ class CudaNdarrayType(Type):
...
@@ -212,7 +212,7 @@ class CudaNdarrayType(Type):
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
nd
=
self
.
ndim
nd
=
self
.
ndim
print
>>
sio
,
"""
print
>>
sio
,
"""
assert(py_
%(name)
s->ob_refcnt >= 2); // There should be at least one ref from the container object,
assert(py_
%(name)
s->ob_refcnt >= 2); // There should be at least one ref from the container object,
// and one ref from the local scope.
// and one ref from the local scope.
if (CudaNdarray_Check(py_
%(name)
s))
if (CudaNdarray_Check(py_
%(name)
s))
...
@@ -281,7 +281,7 @@ class CudaNdarrayType(Type):
...
@@ -281,7 +281,7 @@ class CudaNdarrayType(Type):
"""Override `CLinkerOp.c_sync` """
"""Override `CLinkerOp.c_sync` """
return
"""
return
"""
//std::cerr << "sync
\\
n";
//std::cerr << "sync
\\
n";
if (NULL ==
%(name)
s) {
if (NULL ==
%(name)
s) {
// failure: sync None to storage
// failure: sync None to storage
Py_XDECREF(py_
%(name)
s);
Py_XDECREF(py_
%(name)
s);
py_
%(name)
s = Py_None;
py_
%(name)
s = Py_None;
...
@@ -353,4 +353,3 @@ def CudaNdarray_pickler(cnda):
...
@@ -353,4 +353,3 @@ def CudaNdarray_pickler(cnda):
return
(
CudaNdarray_unpickler
,
(
numpy
.
asarray
(
cnda
),))
return
(
CudaNdarray_unpickler
,
(
numpy
.
asarray
(
cnda
),))
copy_reg
.
pickle
(
cuda
.
CudaNdarray
,
CudaNdarray_pickler
,
CudaNdarray_unpickler
)
copy_reg
.
pickle
(
cuda
.
CudaNdarray
,
CudaNdarray_pickler
,
CudaNdarray_unpickler
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论