Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d9072951
提交
d9072951
authored
5月 18, 2016
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
context kind is now a bytes.
上级
87cd5536
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
17 行增加
和
17 行删除
+17
-17
dnn.py
theano/gpuarray/dnn.py
+1
-1
elemwise.py
theano/gpuarray/elemwise.py
+1
-1
extra_ops.py
theano/gpuarray/extra_ops.py
+1
-1
neighbours.py
theano/gpuarray/neighbours.py
+1
-1
nnet.py
theano/gpuarray/nnet.py
+4
-4
opt.py
theano/gpuarray/opt.py
+4
-4
subtensor.py
theano/gpuarray/subtensor.py
+1
-1
test_elemwise.py
theano/gpuarray/tests/test_elemwise.py
+2
-2
test_extra_ops.py
theano/gpuarray/tests/test_extra_ops.py
+1
-1
test_opt.py
theano/gpuarray/tests/test_opt.py
+1
-1
没有找到文件。
theano/gpuarray/dnn.py
浏览文件 @
d9072951
...
@@ -125,7 +125,7 @@ def dnn_available(context_name):
...
@@ -125,7 +125,7 @@ def dnn_available(context_name):
ctx
=
get_context
(
context_name
)
ctx
=
get_context
(
context_name
)
if
not
ctx
.
kind
==
'cuda'
:
if
not
ctx
.
kind
==
b
'cuda'
:
dnn_available
.
msg
=
"Not on a CUDA device."
dnn_available
.
msg
=
"Not on a CUDA device."
return
False
return
False
...
...
theano/gpuarray/elemwise.py
浏览文件 @
d9072951
...
@@ -554,7 +554,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
...
@@ -554,7 +554,7 @@ class GpuCAReduceCuda(GpuKernelBase, HideC, CAReduceDtype):
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
x
=
as_gpuarray_variable
(
x
,
infer_context_name
(
x
))
x
=
as_gpuarray_variable
(
x
,
infer_context_name
(
x
))
if
x
.
type
.
context
.
kind
!=
'cuda'
:
if
x
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
TypeError
(
"GpuCAReduceCuda doesn't work for non-cuda devices"
)
raise
TypeError
(
"GpuCAReduceCuda doesn't work for non-cuda devices"
)
ret
=
super
(
GpuCAReduceCuda
,
self
)
.
make_node
(
x
)
ret
=
super
(
GpuCAReduceCuda
,
self
)
.
make_node
(
x
)
self
=
copy
.
copy
(
self
)
self
=
copy
.
copy
(
self
)
...
...
theano/gpuarray/extra_ops.py
浏览文件 @
d9072951
...
@@ -218,7 +218,7 @@ class GpuCumsum(GpuKernelBase, Op):
...
@@ -218,7 +218,7 @@ class GpuCumsum(GpuKernelBase, Op):
return
kernels
return
kernels
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
"cuda only"
)
raise
NotImplementedError
(
"cuda only"
)
x
,
=
inp
x
,
=
inp
z
,
=
out
z
,
=
out
...
...
theano/gpuarray/neighbours.py
浏览文件 @
d9072951
...
@@ -243,7 +243,7 @@ class GpuImages2Neibs(GpuKernelBase, Images2Neibs, Op):
...
@@ -243,7 +243,7 @@ class GpuImages2Neibs(GpuKernelBase, Images2Neibs, Op):
return
kernels
return
kernels
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
name
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
"cuda only"
)
raise
NotImplementedError
(
"cuda only"
)
dtype_ten4
=
node
.
inputs
[
0
]
.
dtype
dtype_ten4
=
node
.
inputs
[
0
]
.
dtype
dtype_neib_shape
=
node
.
inputs
[
1
]
.
dtype
dtype_neib_shape
=
node
.
inputs
[
1
]
.
dtype
...
...
theano/gpuarray/nnet.py
浏览文件 @
d9072951
...
@@ -189,7 +189,7 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
...
@@ -189,7 +189,7 @@ class GpuCrossentropySoftmaxArgmax1HotWithBias(GpuKernelBase, Op):
flags
=
flags
,
objvar
=
k_var
)]
flags
=
flags
,
objvar
=
k_var
)]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
'cuda only'
)
raise
NotImplementedError
(
'cuda only'
)
typecode_x
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
inputs
[
0
]
.
dtype
)
typecode_x
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
inputs
[
0
]
.
dtype
)
typecode_b
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
inputs
[
1
]
.
dtype
)
typecode_b
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
inputs
[
1
]
.
dtype
)
...
@@ -375,7 +375,7 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
...
@@ -375,7 +375,7 @@ class GpuCrossentropySoftmax1HotWithBiasDx(GpuKernelBase, Op):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
"cuda only"
)
raise
NotImplementedError
(
"cuda only"
)
typecode_dx
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
typecode_dx
=
pygpu
.
gpuarray
.
dtype_to_typecode
(
node
.
outputs
[
0
]
.
dtype
)
itemsize_dnll
=
numpy
.
dtype
(
node
.
inputs
[
0
]
.
dtype
)
.
itemsize
itemsize_dnll
=
numpy
.
dtype
(
node
.
inputs
[
0
]
.
dtype
)
.
itemsize
...
@@ -584,7 +584,7 @@ class GpuSoftmax(GpuKernelBase, Op):
...
@@ -584,7 +584,7 @@ class GpuSoftmax(GpuKernelBase, Op):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
"cuda only"
)
raise
NotImplementedError
(
"cuda only"
)
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_x
=
node
.
inputs
[
0
]
.
dtype
work_x
=
work_dtype
(
dtype_x
)
work_x
=
work_dtype
(
dtype_x
)
...
@@ -783,7 +783,7 @@ class GpuSoftmaxWithBias(GpuKernelBase, Op):
...
@@ -783,7 +783,7 @@ class GpuSoftmaxWithBias(GpuKernelBase, Op):
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
return
[
'<numpy_compat.h>'
,
'<gpuarray/types.h>'
]
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
def
c_code
(
self
,
node
,
nodename
,
inp
,
out
,
sub
):
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
'cuda'
:
if
node
.
inputs
[
0
]
.
type
.
context
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
'cuda only'
)
raise
NotImplementedError
(
'cuda only'
)
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_x
=
node
.
inputs
[
0
]
.
dtype
dtype_b
=
node
.
inputs
[
1
]
.
dtype
dtype_b
=
node
.
inputs
[
1
]
.
dtype
...
...
theano/gpuarray/opt.py
浏览文件 @
d9072951
...
@@ -145,7 +145,7 @@ def op_lifter(OP, cuda_only=False):
...
@@ -145,7 +145,7 @@ def op_lifter(OP, cuda_only=False):
# Check if we should replace
# Check if we should replace
if
(
not
replace
or
if
(
not
replace
or
(
cuda_only
and
(
cuda_only
and
get_context
(
context_name
)
.
kind
!=
'cuda'
)):
get_context
(
context_name
)
.
kind
!=
b
'cuda'
)):
return
False
return
False
# tag the inputs with the context in case
# tag the inputs with the context in case
...
@@ -642,7 +642,7 @@ def local_gpua_advanced_subtensor(node, context_name):
...
@@ -642,7 +642,7 @@ def local_gpua_advanced_subtensor(node, context_name):
def
local_gpua_advanced_incsubtensor
(
node
,
context_name
):
def
local_gpua_advanced_incsubtensor
(
node
,
context_name
):
context
=
get_context
(
context_name
)
context
=
get_context
(
context_name
)
# This is disabled on non-cuda contexts
# This is disabled on non-cuda contexts
if
context
.
kind
!=
'cuda'
:
if
context
.
kind
!=
b
'cuda'
:
return
None
return
None
x
,
y
,
ilist
=
node
.
inputs
x
,
y
,
ilist
=
node
.
inputs
...
@@ -673,12 +673,12 @@ def local_gpua_careduce(node, context_name):
...
@@ -673,12 +673,12 @@ def local_gpua_careduce(node, context_name):
if
isinstance
(
node
.
op
.
scalar_op
,
(
scalar
.
Add
,
scalar
.
Mul
,
if
isinstance
(
node
.
op
.
scalar_op
,
(
scalar
.
Add
,
scalar
.
Mul
,
scalar
.
Maximum
,
scalar
.
Minimum
)):
scalar
.
Maximum
,
scalar
.
Minimum
)):
ctx
=
get_context
(
context_name
)
ctx
=
get_context
(
context_name
)
if
ctx
.
kind
==
'opencl'
:
if
ctx
.
kind
==
b
'opencl'
:
op
=
GpuCAReduceCPY
op
=
GpuCAReduceCPY
if
node
.
op
.
scalar_op
not
in
[
scalar
.
add
,
scalar
.
mul
]:
if
node
.
op
.
scalar_op
not
in
[
scalar
.
add
,
scalar
.
mul
]:
# We don't support yet all reduction with cpy code.
# We don't support yet all reduction with cpy code.
return
return
elif
ctx
.
kind
==
'cuda'
:
elif
ctx
.
kind
==
b
'cuda'
:
op
=
GpuCAReduceCuda
op
=
GpuCAReduceCuda
else
:
else
:
return
False
return
False
...
...
theano/gpuarray/subtensor.py
浏览文件 @
d9072951
...
@@ -599,7 +599,7 @@ class GpuAdvancedIncSubtensor1_dev20(GpuKernelBase, GpuAdvancedIncSubtensor1):
...
@@ -599,7 +599,7 @@ class GpuAdvancedIncSubtensor1_dev20(GpuKernelBase, GpuAdvancedIncSubtensor1):
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
ctx
=
self
.
get_params
(
node
)
ctx
=
self
.
get_params
(
node
)
if
ctx
.
kind
!=
'cuda'
:
if
ctx
.
kind
!=
b
'cuda'
:
raise
NotImplementedError
(
"cuda only"
)
raise
NotImplementedError
(
"cuda only"
)
if
(
self
.
set_instead_of_inc
or
if
(
self
.
set_instead_of_inc
or
node
.
inputs
[
0
]
.
ndim
!=
node
.
inputs
[
1
]
.
ndim
or
node
.
inputs
[
0
]
.
ndim
!=
node
.
inputs
[
1
]
.
ndim
or
...
...
theano/gpuarray/tests/test_elemwise.py
浏览文件 @
d9072951
...
@@ -197,7 +197,7 @@ class test_GpuCAReduceCuda(test_GpuCAReduceCPY):
...
@@ -197,7 +197,7 @@ class test_GpuCAReduceCuda(test_GpuCAReduceCPY):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
test_GpuCAReduceCuda
,
self
)
.
setUp
()
super
(
test_GpuCAReduceCuda
,
self
)
.
setUp
()
if
get_context
(
test_ctx_name
)
.
kind
!=
'cuda'
:
if
get_context
(
test_ctx_name
)
.
kind
!=
b
'cuda'
:
raise
SkipTest
(
"Cuda specific tests"
)
raise
SkipTest
(
"Cuda specific tests"
)
...
@@ -212,7 +212,7 @@ class T_gpureduce_dtype(test_elemwise.T_reduce_dtype):
...
@@ -212,7 +212,7 @@ class T_gpureduce_dtype(test_elemwise.T_reduce_dtype):
'float32'
,
'float64'
]
'float32'
,
'float64'
]
def
setUp
(
self
):
def
setUp
(
self
):
if
get_context
(
test_ctx_name
)
.
kind
!=
'cuda'
:
if
get_context
(
test_ctx_name
)
.
kind
!=
b
'cuda'
:
raise
SkipTest
(
"Cuda specific tests"
)
raise
SkipTest
(
"Cuda specific tests"
)
...
...
theano/gpuarray/tests/test_extra_ops.py
浏览文件 @
d9072951
...
@@ -24,7 +24,7 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp):
...
@@ -24,7 +24,7 @@ class TestGpuCumsum(theano.tensor.tests.test_extra_ops.TestCumsumOp):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestGpuCumsum
,
self
)
.
setUp
()
super
(
TestGpuCumsum
,
self
)
.
setUp
()
test_ctx
=
get_context
(
test_ctx_name
)
test_ctx
=
get_context
(
test_ctx_name
)
if
test_ctx
.
kind
!=
'cuda'
:
if
test_ctx
.
kind
!=
b
'cuda'
:
raise
SkipTest
(
"Cuda specific tests"
)
raise
SkipTest
(
"Cuda specific tests"
)
self
.
max_threads_dim0
=
test_ctx
.
maxlsize0
self
.
max_threads_dim0
=
test_ctx
.
maxlsize0
self
.
max_grid_size1
=
test_ctx
.
maxgsize2
self
.
max_grid_size1
=
test_ctx
.
maxgsize2
...
...
theano/gpuarray/tests/test_opt.py
浏览文件 @
d9072951
...
@@ -124,7 +124,7 @@ def test_reduce():
...
@@ -124,7 +124,7 @@ def test_reduce():
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
ops
=
[
type
(
node
.
op
)
for
node
in
topo
]
ops
=
[
type
(
node
.
op
)
for
node
in
topo
]
if
kind
==
'opencl'
and
method
in
[
"max"
,
"min"
]:
if
kind
==
b
'opencl'
and
method
in
[
"max"
,
"min"
]:
assert
not
(
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
)
assert
not
(
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
)
else
:
else
:
assert
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
assert
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论