Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c508befc
提交
c508befc
authored
9月 30, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleanup of useless headers.
上级
3ca711b7
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
11 行增加
和
134 行删除
+11
-134
conv.py
theano/sandbox/gpuarray/conv.py
+2
-22
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+4
-35
neighbours.py
theano/sandbox/gpuarray/neighbours.py
+1
-20
nnet.py
theano/sandbox/gpuarray/nnet.py
+4
-47
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+0
-10
没有找到文件。
theano/sandbox/gpuarray/conv.py
浏览文件 @
c508befc
...
@@ -3,10 +3,8 @@ import os
...
@@ -3,10 +3,8 @@ import os
import
theano
import
theano
from
theano
import
config
,
gof
from
theano
import
config
,
gof
from
theano.gof.util
import
MethodNotDefined
try
:
try
:
import
pygpu
from
pygpu
import
gpuarray
from
pygpu
import
gpuarray
except
ImportError
:
except
ImportError
:
pass
pass
...
@@ -227,33 +225,15 @@ class GpuConv(GpuKernelBase, gof.Op):
...
@@ -227,33 +225,15 @@ class GpuConv(GpuKernelBase, gof.Op):
nb
=
0
nb
=
0
if
self
.
kshp
is
not
None
:
if
self
.
kshp
is
not
None
:
nb
=
self
.
kshp
[
1
]
nb
=
self
.
kshp
[
1
]
return
[
'-DTHEANO_KERN_WID='
+
str
(
nb
)]
# ,'-g','-G']
return
[
'-DTHEANO_KERN_WID='
+
str
(
nb
)]
def
c_headers
(
self
):
def
c_headers
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
return
[
'<stdio.h>'
,
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
raise
MethodNotDefined
(
'cuda only'
)
return
[
'<stdint.h>'
,
'<stdio.h>'
,
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
'<gpuarray/ext_cuda.h>'
,
'<gpuarray/types.h>'
]
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
else
:
return
[]
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
# raise this whenever modifying any of the support_code_files
# raise this whenever modifying any of the support_code_files
return
(
0
,
21
)
return
(
0
,
21
)
def
c_init_code
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
return
[
'setup_ext_cuda();'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out_
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out_
,
sub
):
img
,
kern
=
inp
img
,
kern
=
inp
out
,
=
out_
out
,
=
out_
...
...
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
c508befc
from
__future__
import
print_function
from
__future__
import
print_function
import
copy
import
copy
import
os
from
theano.compat
import
izip
from
theano.compat
import
izip
import
numpy
import
numpy
...
@@ -8,7 +7,6 @@ from theano import Apply, scalar, config
...
@@ -8,7 +7,6 @@ from theano import Apply, scalar, config
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
six.moves
import
StringIO
,
xrange
from
six.moves
import
StringIO
,
xrange
from
theano.gof.utils
import
MethodNotDefined
from
theano.gof.utils
import
MethodNotDefined
from
theano.gof.cmodule
import
GCC_compiler
from
theano.scalar
import
Scalar
from
theano.scalar
import
Scalar
from
theano.tensor.elemwise
import
(
Elemwise
,
DimShuffle
,
CAReduceDtype
)
from
theano.tensor.elemwise
import
(
Elemwise
,
DimShuffle
,
CAReduceDtype
)
...
@@ -172,23 +170,8 @@ class GpuElemwise(GpuKernelBase, HideC, Elemwise):
...
@@ -172,23 +170,8 @@ class GpuElemwise(GpuKernelBase, HideC, Elemwise):
kop
=
kop
.
replace
(
npy
,
ga
)
kop
=
kop
.
replace
(
npy
,
ga
)
return
ElemwiseKernel
(
None
,
inps
+
outs
,
kop
,
preamble
=
support_code
)
return
ElemwiseKernel
(
None
,
inps
+
outs
,
kop
,
preamble
=
support_code
)
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
else
:
return
[]
def
c_compiler
(
self
):
return
GCC_compiler
def
c_headers
(
self
):
def
c_headers
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
raise
MethodNotDefined
(
'cuda only'
)
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
'<gpuarray/ext_cuda.h>'
,
'<gpuarray/types.h>'
]
def
c_support_code
(
self
):
def
c_support_code
(
self
):
return
self
.
scalar_op
.
c_support_code
()
return
self
.
scalar_op
.
c_support_code
()
...
@@ -230,11 +213,6 @@ class GpuElemwise(GpuKernelBase, HideC, Elemwise):
...
@@ -230,11 +213,6 @@ class GpuElemwise(GpuKernelBase, HideC, Elemwise):
node
.
outputs
[
0
]
.
type
.
dtype
),
node
.
outputs
[
0
]
.
type
.
dtype
),
objvar
=
'elem_
%
d_
%
s'
%
(
nd
,
nodename
))]
objvar
=
'elem_
%
d_
%
s'
%
(
nd
,
nodename
))]
def
c_init_code
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
return
[
'setup_ext_cuda();'
]
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
raise
MethodNotDefined
(
'cuda only'
)
...
@@ -729,17 +707,8 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -729,17 +707,8 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
return
False
return
False
return
True
return
True
def
c_header_dirs
(
self
):
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
'<gpuarray/ext_cuda.h>'
,
'<gpuarray/types.h>'
]
def
c_init_code
(
self
):
return
[
'setup_ext_cuda();'
]
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
x
,
=
inp
x
,
=
inp
...
@@ -757,6 +726,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -757,6 +726,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
sio
=
StringIO
()
sio
=
StringIO
()
fail
=
sub
[
'fail'
]
fail
=
sub
[
'fail'
]
ctx
=
sub
[
'context'
]
# check input
# check input
print
(
"""
print
(
"""
...
@@ -821,8 +791,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -821,8 +791,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
Py_XDECREF(
%(z)
s);
Py_XDECREF(
%(z)
s);
%(z)
s = pygpu_empty(
%(nd_out)
s, new_dims,
%(z)
s = pygpu_empty(
%(nd_out)
s, new_dims,
%(out_typecode)
s, GA_C_ORDER,
%(out_typecode)
s, GA_C_ORDER,
pygpu_default_context(),
%(ctx)
s, Py_None);
Py_None);
if (NULL ==
%(z)
s)
if (NULL ==
%(z)
s)
{
{
PyErr_Format(PyExc_RuntimeError, "Failed to allocate output");
PyErr_Format(PyExc_RuntimeError, "Failed to allocate output");
...
...
theano/sandbox/gpuarray/neighbours.py
浏览文件 @
c508befc
import
os
import
numpy
import
numpy
from
theano
import
Op
,
Apply
,
config
from
theano
import
Op
,
Apply
,
config
from
theano.gof.util
import
MethodNotDefined
from
theano.tensor.nnet.neighbours
import
Images2Neibs
from
theano.tensor.nnet.neighbours
import
Images2Neibs
import
theano.tensor
as
T
import
theano.tensor
as
T
...
@@ -45,24 +43,7 @@ class GpuImages2Neibs(GpuKernelBase, Images2Neibs, Op):
...
@@ -45,24 +43,7 @@ class GpuImages2Neibs(GpuKernelBase, Images2Neibs, Op):
return
(
10
,
1
)
return
(
10
,
1
)
def
c_headers
(
self
):
def
c_headers
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
raise
MethodNotDefined
(
'cuda only'
)
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
'<gpuarray/ext_cuda.h>'
,
'<gpuarray/types.h>'
]
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
else
:
return
[]
def
c_init_code
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
return
[
'setup_ext_cuda();'
]
def
gpu_kernels
(
self
,
node
,
nodename
):
def
gpu_kernels
(
self
,
node
,
nodename
):
dtype_ten4
=
node
.
inputs
[
0
]
.
dtype
dtype_ten4
=
node
.
inputs
[
0
]
.
dtype
...
...
theano/sandbox/gpuarray/nnet.py
浏览文件 @
c508befc
from
__future__
import
print_function
from
__future__
import
print_function
import
numpy
import
numpy
import
os
from
theano
import
Op
,
Apply
,
config
from
theano
import
Op
,
Apply
,
config
from
six
import
StringIO
from
six
import
StringIO
from
theano.gof.util
import
MethodNotDefined
try
:
try
:
import
pygpu
import
pygpu
from
pygpu
import
gpuarray
from
pygpu
import
gpuarray
...
@@ -43,16 +40,8 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
...
@@ -43,16 +40,8 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
am
=
y_idx
.
type
()
am
=
y_idx
.
type
()
return
Apply
(
self
,
[
x
,
b
,
y_idx
],
[
nll
,
sm
,
am
])
return
Apply
(
self
,
[
x
,
b
,
y_idx
],
[
nll
,
sm
,
am
])
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
'<gpuarray/types.h>'
]
def
gpu_kernels
(
self
,
node
,
nodename
):
def
gpu_kernels
(
self
,
node
,
nodename
):
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_x
=
node
.
inputs
[
0
]
.
dtype
...
@@ -332,16 +321,8 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
...
@@ -332,16 +321,8 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
10
,)
return
(
10
,)
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
'<gpuarray/types.h>'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
typecode_dx
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
typecode_dx
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
...
@@ -545,19 +526,8 @@ class GpuSoftmax(GpuKernelBase, Op):
...
@@ -545,19 +526,8 @@ class GpuSoftmax(GpuKernelBase, Op):
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
14
,)
+
inline_softmax
.
code_version
return
(
14
,)
+
inline_softmax
.
code_version
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
'<gpuarray/ext_cuda.h>'
,
'<gpuarray/types.h>'
]
def
c_init_code
(
self
):
return
[
'setup_ext_cuda();'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_x
=
node
.
inputs
[
0
]
.
dtype
...
@@ -750,21 +720,8 @@ class GpuSoftmaxWithBias (GpuKernelBase, Op):
...
@@ -750,21 +720,8 @@ class GpuSoftmaxWithBias (GpuKernelBase, Op):
def
c_code_cache_version
(
self
):
def
c_code_cache_version
(
self
):
return
(
13
,)
+
inline_softmax
.
code_version
return
(
13
,)
+
inline_softmax
.
code_version
def
c_header_dirs
(
self
):
if
pygpu
.
get_default_context
()
.
kind
==
'opencl'
:
raise
MethodNotDefined
(
'cuda only'
)
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
else
:
return
[]
def
c_headers
(
self
):
def
c_headers
(
self
):
return
[
'cuda.h'
,
'<gpuarray/extension.h>'
,
'<numpy_compat.h>'
,
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
'<gpuarray/ext_cuda.h>'
,
'<gpuarray/types.h>'
]
def
c_init_code
(
self
):
return
[
'setup_ext_cuda();'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_x
=
node
.
inputs
[
0
]
.
dtype
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
c508befc
...
@@ -180,19 +180,9 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
...
@@ -180,19 +180,9 @@ class GpuIncSubtensor(GpuKernelBase, IncSubtensor):
def
_f16_ok
(
self
):
def
_f16_ok
(
self
):
return
self
.
iadd_node
.
op
.
_f16_ok
return
self
.
iadd_node
.
op
.
_f16_ok
def
c_header_dirs
(
self
):
cuda_root
=
config
.
cuda
.
root
if
cuda_root
:
return
[
os
.
path
.
join
(
cuda_root
,
'include'
)]
else
:
return
[]
def
c_headers
(
self
):
def
c_headers
(
self
):
return
self
.
iadd_node
.
op
.
c_headers
()
return
self
.
iadd_node
.
op
.
c_headers
()
def
c_compiler
(
self
):
return
self
.
iadd_node
.
op
.
c_compiler
()
def
c_init_code
(
self
):
def
c_init_code
(
self
):
return
self
.
iadd_node
.
op
.
c_init_code
()
return
self
.
iadd_node
.
op
.
c_init_code
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论