Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
dd91c021
提交
dd91c021
authored
9月 13, 2013
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make sure to properly hide the tensro C implementations.
上级
c12e1612
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
31 行增加
和
15 行删除
+31
-15
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+25
-0
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+3
-12
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+3
-3
没有找到文件。
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
dd91c021
...
@@ -28,6 +28,31 @@ def as_gpuarray_variable(x):
...
@@ -28,6 +28,31 @@ def as_gpuarray_variable(x):
def
as_gpuarray
(
x
):
def
as_gpuarray
(
x
):
return
gpuarray
.
array
(
x
,
copy
=
False
)
return
gpuarray
.
array
(
x
,
copy
=
False
)
class
HideC
(
object
):
def
__hide
(
*
args
):
raise
MethodNotDefined
()
c_code
=
__hide
c_code_cleanup
=
__hide
c_headers
=
__hide
c_header_dirs
=
__hide
c_libraries
=
__hide
c_lib_dirs
=
__hide
c_support_code
=
__hide
c_support_code_apply
=
__hide
c_compile_args
=
__hide
c_no_compile_args
=
__hide
c_init_code
=
__hide
def
c_code_cache_version
(
self
):
return
()
def
c_code_cache_version_apply
(
self
,
node
):
return
self
.
c_code_cache_version
()
class
HostFromGpu
(
Op
):
class
HostFromGpu
(
Op
):
def
__eq__
(
self
,
other
):
def
__eq__
(
self
,
other
):
...
...
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
dd91c021
...
@@ -12,7 +12,7 @@ try:
...
@@ -12,7 +12,7 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
theano.sandbox.gpuarray.basic_ops
import
as_gpuarray_variable
from
theano.sandbox.gpuarray.basic_ops
import
as_gpuarray_variable
,
HideC
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
theano.gof.utils
import
MethodNotDefined
from
theano.gof.utils
import
MethodNotDefined
...
@@ -42,7 +42,7 @@ def as_C_string_const(s):
...
@@ -42,7 +42,7 @@ def as_C_string_const(s):
return
'
\n
'
.
join
(
'"
%
s
\\
n"'
%
(
l
.
replace
(
'"'
,
'
\\
"'
))
return
'
\n
'
.
join
(
'"
%
s
\\
n"'
%
(
l
.
replace
(
'"'
,
'
\\
"'
))
for
l
in
s
.
split
(
'
\n
'
))
for
l
in
s
.
split
(
'
\n
'
))
class
GpuElemwise
(
Elemwise
):
class
GpuElemwise
(
HideC
,
Elemwise
):
nin
=
property
(
lambda
self
:
self
.
scalar_op
.
nin
)
nin
=
property
(
lambda
self
:
self
.
scalar_op
.
nin
)
nout
=
property
(
lambda
self
:
self
.
scalar_op
.
nout
)
nout
=
property
(
lambda
self
:
self
.
scalar_op
.
nout
)
...
@@ -138,15 +138,6 @@ class GpuElemwise(Elemwise):
...
@@ -138,15 +138,6 @@ class GpuElemwise(Elemwise):
res
.
append
(
"static const gpukernel *
%
s_c_k = NULL;"
%
(
nodename
,))
res
.
append
(
"static const gpukernel *
%
s_c_k = NULL;"
%
(
nodename
,))
return
'
\n
'
.
join
(
res
)
return
'
\n
'
.
join
(
res
)
def
hide
(
self
,
*
args
):
raise
MethodNotDefined
()
c_headers
=
hide
c_support_code
=
hide
c_support_code_apply
=
hide
c_code_cache_version_apply
=
hide
c_code
=
hide
def
perform
(
self
,
node
,
inputs
,
output_storage
):
def
perform
(
self
,
node
,
inputs
,
output_storage
):
# Try to reuse the kernel from a previous call to hopefully
# Try to reuse the kernel from a previous call to hopefully
# avoid recompiling
# avoid recompiling
...
@@ -180,7 +171,7 @@ class SupportCodeError(Exception):
...
@@ -180,7 +171,7 @@ class SupportCodeError(Exception):
"""
"""
class
GpuDimShuffle
(
DimShuffle
):
class
GpuDimShuffle
(
HideC
,
DimShuffle
):
def
make_node
(
self
,
input
):
def
make_node
(
self
,
input
):
res
=
DimShuffle
.
make_node
(
self
,
input
)
res
=
DimShuffle
.
make_node
(
self
,
input
)
otype
=
GpuArrayType
(
dtype
=
res
.
outputs
[
0
]
.
type
.
dtype
,
otype
=
GpuArrayType
(
dtype
=
res
.
outputs
[
0
]
.
type
.
dtype
,
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
dd91c021
...
@@ -12,10 +12,10 @@ try:
...
@@ -12,10 +12,10 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
type
import
GpuArrayType
from
t
heano.sandbox.gpuarray.t
ype
import
GpuArrayType
from
basic_ops
import
as_gpuarray_variable
from
theano.sandbox.gpuarray.basic_ops
import
as_gpuarray_variable
,
HideC
class
GpuSubtensor
(
Subtensor
):
class
GpuSubtensor
(
HideC
,
Subtensor
):
def
make_node
(
self
,
x
,
*
inputs
):
def
make_node
(
self
,
x
,
*
inputs
):
rval
=
tensor
.
Subtensor
.
make_node
(
self
,
x
,
*
inputs
)
rval
=
tensor
.
Subtensor
.
make_node
(
self
,
x
,
*
inputs
)
otype
=
GpuArrayType
(
dtype
=
rval
.
outputs
[
0
]
.
type
.
dtype
,
otype
=
GpuArrayType
(
dtype
=
rval
.
outputs
[
0
]
.
type
.
dtype
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论