Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
fdf7913b
提交
fdf7913b
authored
3月 31, 2015
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2707 from abergeron/relative_import
Relative import
上级
2d733797
07d4461d
显示空白字符变更
内嵌
并排
正在显示
20 个修改的文件
包含
78 行增加
和
94 行删除
+78
-94
__init__.py
theano/sandbox/gpuarray/__init__.py
+2
-2
basic_ops.py
theano/sandbox/gpuarray/basic_ops.py
+1
-1
blas.py
theano/sandbox/gpuarray/blas.py
+1
-1
conv.py
theano/sandbox/gpuarray/conv.py
+3
-3
elemwise.py
theano/sandbox/gpuarray/elemwise.py
+4
-4
kernel_codegen.py
theano/sandbox/gpuarray/kernel_codegen.py
+0
-1
neighbours.py
theano/sandbox/gpuarray/neighbours.py
+4
-5
nnet.py
theano/sandbox/gpuarray/nnet.py
+4
-5
opt.py
theano/sandbox/gpuarray/opt.py
+11
-14
subtensor.py
theano/sandbox/gpuarray/subtensor.py
+4
-4
test_basic_ops.py
theano/sandbox/gpuarray/tests/test_basic_ops.py
+3
-3
test_blas.py
theano/sandbox/gpuarray/tests/test_blas.py
+3
-3
test_conv_cuda_ndarray.py
theano/sandbox/gpuarray/tests/test_conv_cuda_ndarray.py
+3
-3
test_elemwise.py
theano/sandbox/gpuarray/tests/test_elemwise.py
+3
-4
test_neighbours.py
theano/sandbox/gpuarray/tests/test_neighbours.py
+4
-4
test_nnet.py
theano/sandbox/gpuarray/tests/test_nnet.py
+6
-5
test_opt.py
theano/sandbox/gpuarray/tests/test_opt.py
+10
-17
test_scan.py
theano/sandbox/gpuarray/tests/test_scan.py
+3
-5
test_subtensor.py
theano/sandbox/gpuarray/tests/test_subtensor.py
+7
-8
test_type.py
theano/sandbox/gpuarray/tests/test_type.py
+2
-2
没有找到文件。
theano/sandbox/gpuarray/__init__.py
浏览文件 @
fdf7913b
...
@@ -26,9 +26,9 @@ AddConfigVar('gpuarray.sync',
...
@@ -26,9 +26,9 @@ AddConfigVar('gpuarray.sync',
in_c_key
=
True
)
in_c_key
=
True
)
# This is for documentation not to depend on the availability of pygpu
# This is for documentation not to depend on the availability of pygpu
from
type
import
(
GpuArrayType
,
GpuArrayVariable
,
GpuArrayConstant
,
from
.
type
import
(
GpuArrayType
,
GpuArrayVariable
,
GpuArrayConstant
,
GpuArraySharedVariable
,
gpuarray_shared_constructor
)
GpuArraySharedVariable
,
gpuarray_shared_constructor
)
import
opt
from
.
import
opt
def
init_dev
(
dev
):
def
init_dev
(
dev
):
...
...
theano/sandbox/gpuarray/basic_ops.py
浏览文件 @
fdf7913b
...
@@ -20,7 +20,7 @@ try:
...
@@ -20,7 +20,7 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
type
import
GpuArrayType
from
.
type
import
GpuArrayType
def
as_gpuarray_variable
(
x
):
def
as_gpuarray_variable
(
x
):
...
...
theano/sandbox/gpuarray/blas.py
浏览文件 @
fdf7913b
from
theano
import
Op
,
Apply
,
config
from
theano
import
Op
,
Apply
,
config
from
theano.tensor.blas
import
Dot22
,
Gemv
,
Gemm
,
Ger
from
theano.tensor.blas
import
Dot22
,
Gemv
,
Gemm
,
Ger
from
theano.sandbox.gpuarray.basic_ops
import
(
HideC
,
as_gpuarray_variable
)
from
.basic_ops
import
HideC
,
as_gpuarray_variable
try
:
try
:
import
pygpu
import
pygpu
...
...
theano/sandbox/gpuarray/conv.py
浏览文件 @
fdf7913b
...
@@ -3,9 +3,9 @@ import os
...
@@ -3,9 +3,9 @@ import os
import
theano
import
theano
from
theano
import
config
,
gof
from
theano
import
config
,
gof
from
theano.sandbox.gpuarray
.comp
import
NVCC_compiler
from
.comp
import
NVCC_compiler
from
theano.sandbox.gpuarray
.type
import
GpuArrayType
from
.type
import
GpuArrayType
from
theano.sandbox.gpuarray
.basic_ops
import
as_gpuarray_variable
from
.basic_ops
import
as_gpuarray_variable
class
GpuConv
(
gof
.
Op
):
class
GpuConv
(
gof
.
Op
):
...
...
theano/sandbox/gpuarray/elemwise.py
浏览文件 @
fdf7913b
...
@@ -7,9 +7,9 @@ import numpy
...
@@ -7,9 +7,9 @@ import numpy
import
theano
import
theano
from
theano
import
Apply
,
scalar
,
config
from
theano
import
Apply
,
scalar
,
config
from
theano
import
scalar
as
scal
from
theano
import
scalar
as
scal
from
theano.gof.utils
import
MethodNotDefined
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
)
from
theano.sandbox.gpuarray.comp
import
NVCC_compiler
try
:
try
:
import
pygpu
import
pygpu
...
@@ -21,11 +21,11 @@ try:
...
@@ -21,11 +21,11 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
theano.sandbox.gpuarray
.basic_ops
import
(
as_gpuarray_variable
,
HideC
,
from
.basic_ops
import
(
as_gpuarray_variable
,
HideC
,
GpuKernelBase
,
Kernel
)
GpuKernelBase
,
Kernel
)
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
.comp
import
NVCC_compiler
from
.type
import
GpuArrayType
from
theano.gof.utils
import
MethodNotDefined
def
_is_scalar
(
v
):
def
_is_scalar
(
v
):
...
...
theano/sandbox/gpuarray/kernel_codegen.py
浏览文件 @
fdf7913b
""" Helper routines for generating gpu kernels for nvcc.
""" Helper routines for generating gpu kernels for nvcc.
"""
"""
def
nvcc_kernel
(
name
,
params
,
body
):
def
nvcc_kernel
(
name
,
params
,
body
):
"""Return the c code of a kernel function.
"""Return the c code of a kernel function.
...
...
theano/sandbox/gpuarray/neighbours.py
浏览文件 @
fdf7913b
...
@@ -11,12 +11,11 @@ try:
...
@@ -11,12 +11,11 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
theano.sandbox.gpuarray
.basic_ops
import
(
as_gpuarray_variable
,
from
.basic_ops
import
(
as_gpuarray_variable
,
host_from_gpu
,
gpu_from_host
)
host_from_gpu
,
gpu_from_host
)
from
theano.sandbox.gpuarray.opt
import
register_opt
as
register_gpu_opt
from
.opt
import
register_opt
as
register_gpu_opt
,
op_lifter
from
theano.sandbox.gpuarray.opt
import
op_lifter
as
op_lifter
from
.type
import
GpuArrayType
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
.comp
import
NVCC_compiler
from
theano.sandbox.gpuarray.comp
import
NVCC_compiler
class
GpuImages2Neibs
(
Images2Neibs
,
Op
):
class
GpuImages2Neibs
(
Images2Neibs
,
Op
):
...
...
theano/sandbox/gpuarray/nnet.py
浏览文件 @
fdf7913b
...
@@ -2,8 +2,6 @@ import numpy
...
@@ -2,8 +2,6 @@ import numpy
from
theano
import
Op
,
Apply
,
config
from
theano
import
Op
,
Apply
,
config
from
theano.compat.six
import
StringIO
from
theano.compat.six
import
StringIO
from
theano.sandbox.gpuarray.comp
import
NVCC_compiler
try
:
try
:
import
pygpu
import
pygpu
...
@@ -11,9 +9,10 @@ try:
...
@@ -11,9 +9,10 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
theano.sandbox.gpuarray.basic_ops
import
as_gpuarray_variable
from
.basic_ops
import
as_gpuarray_variable
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
.comp
import
NVCC_compiler
from
theano.sandbox.gpuarray.kernel_codegen
import
(
nvcc_kernel
,
from
.type
import
GpuArrayType
from
.kernel_codegen
import
(
nvcc_kernel
,
inline_softmax
,
inline_softmax
,
inline_softmax_fixed_shared
)
inline_softmax_fixed_shared
)
...
...
theano/sandbox/gpuarray/opt.py
浏览文件 @
fdf7913b
...
@@ -18,26 +18,23 @@ from theano.scan_module import scan_utils, scan_op, scan_opt
...
@@ -18,26 +18,23 @@ from theano.scan_module import scan_utils, scan_op, scan_opt
from
theano.compat.python2x
import
all
,
any
from
theano.compat.python2x
import
all
,
any
from
theano.tensor.nnet.conv
import
ConvOp
from
theano.tensor.nnet.conv
import
ConvOp
from
theano.sandbox.gpuarray.type
import
GpuArrayType
from
.type
import
GpuArrayType
,
GpuArrayConstant
from
theano.sandbox.gpuarray.basic_ops
import
(
from
.basic_ops
import
(
host_from_gpu
,
gpu_from_host
,
host_from_gpu
,
gpu_from_host
,
HostFromGpu
,
GpuFromHost
,
HostFromGpu
,
GpuFromHost
,
GpuSplit
,
GpuSplit
,
gpu_alloc
,
GpuAlloc
,
GpuReshape
,
GpuEye
,
gpu_join
,
GpuJoin
,
gpu_alloc
,
GpuAlloc
,
GpuReshape
,
)
GpuEye
,
gpu_join
,
GpuJoin
)
from
theano.sandbox.gpuarray.blas
import
gpu_dot22
,
GpuGemv
,
GpuGemm
,
GpuGer
from
.blas
import
gpu_dot22
,
GpuGemv
,
GpuGemm
,
GpuGer
from
theano.sandbox.gpuarray.conv
import
GpuConv
from
.conv
import
GpuConv
from
theano.sandbox.gpuarray.nnet
import
(
from
.nnet
import
(
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuSoftmaxWithBias
,
GpuSoftmax
GpuSoftmaxWithBias
,
GpuSoftmax
)
)
from
.elemwise
import
(
GpuElemwise
,
_is_scalar
,
from
theano.sandbox.gpuarray.elemwise
import
(
GpuElemwise
,
_is_scalar
,
GpuDimShuffle
,
GpuCAReduceCuda
,
GpuDimShuffle
,
GpuCAReduceCuda
,
GpuCAReduceCPY
)
GpuCAReduceCPY
)
from
theano.sandbox.gpuarray
.subtensor
import
(
GpuIncSubtensor
,
GpuSubtensor
,
from
.subtensor
import
(
GpuIncSubtensor
,
GpuSubtensor
,
GpuAdvancedIncSubtensor1
,
GpuAdvancedIncSubtensor1
,
GpuAdvancedIncSubtensor1_dev20
)
GpuAdvancedIncSubtensor1_dev20
)
from
theano.sandbox.gpuarray.type
import
GpuArrayConstant
gpu_optimizer
=
EquilibriumDB
()
gpu_optimizer
=
EquilibriumDB
()
gpu_cut_copies
=
EquilibriumDB
()
gpu_cut_copies
=
EquilibriumDB
()
...
...
theano/sandbox/gpuarray/subtensor.py
浏览文件 @
fdf7913b
...
@@ -14,10 +14,10 @@ try:
...
@@ -14,10 +14,10 @@ try:
except
ImportError
:
except
ImportError
:
pass
pass
from
theano.sandbox.gpuarray
.type
import
GpuArrayType
from
.type
import
GpuArrayType
from
theano.sandbox.gpuarray
.basic_ops
import
as_gpuarray_variable
,
HideC
from
.basic_ops
import
as_gpuarray_variable
,
HideC
from
theano.sandbox.gpuarray
.elemwise
import
GpuElemwise
from
.elemwise
import
GpuElemwise
from
theano.sandbox.gpuarray
.comp
import
NVCC_compiler
from
.comp
import
NVCC_compiler
class
GpuSubtensor
(
HideC
,
Subtensor
):
class
GpuSubtensor
(
HideC
,
Subtensor
):
...
...
theano/sandbox/gpuarray/tests/test_basic_ops.py
浏览文件 @
fdf7913b
...
@@ -34,16 +34,16 @@ if cuda_ndarray.cuda_available and not theano.sandbox.gpuarray.pygpu_activated:
...
@@ -34,16 +34,16 @@ if cuda_ndarray.cuda_available and not theano.sandbox.gpuarray.pygpu_activated:
if
not
theano
.
sandbox
.
gpuarray
.
pygpu_activated
:
if
not
theano
.
sandbox
.
gpuarray
.
pygpu_activated
:
raise
SkipTest
(
"pygpu disabled"
)
raise
SkipTest
(
"pygpu disabled"
)
from
theano.sandbox.gpuarray
.type
import
(
GpuArrayType
,
from
.
.type
import
(
GpuArrayType
,
gpuarray_shared_constructor
)
gpuarray_shared_constructor
)
from
theano.sandbox.gpuarray
.basic_ops
import
(
from
.
.basic_ops
import
(
host_from_gpu
,
gpu_from_host
,
host_from_gpu
,
gpu_from_host
,
gpu_alloc
,
GpuAlloc
,
gpu_alloc
,
GpuAlloc
,
gpu_from_cuda
,
gpu_from_cuda
,
cuda_from_gpu
,
HostFromGpu
,
cuda_from_gpu
,
HostFromGpu
,
GpuFromHost
,
GpuReshape
,
GpuFromHost
,
GpuReshape
,
gpu_join
,
GpuJoin
,
GpuSplit
,
GpuEye
,
gpu_contiguous
)
gpu_join
,
GpuJoin
,
GpuSplit
,
GpuEye
,
gpu_contiguous
)
from
theano.sandbox.gpuarray
.subtensor
import
GpuSubtensor
from
.
.subtensor
import
GpuSubtensor
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
utt
.
seed_rng
()
utt
.
seed_rng
()
...
...
theano/sandbox/gpuarray/tests/test_blas.py
浏览文件 @
fdf7913b
...
@@ -8,11 +8,11 @@ from theano.tensor.blas import (gemv_inplace, gemm_inplace, ger_destructive,
...
@@ -8,11 +8,11 @@ from theano.tensor.blas import (gemv_inplace, gemm_inplace, ger_destructive,
_dot22
)
_dot22
)
from
theano.tensor.tests.test_blas
import
TestGer
,
BaseGemv
from
theano.tensor.tests.test_blas
import
TestGer
,
BaseGemv
from
theano.sandbox.gpuarray
import
gpuarray_shared_constructor
from
..
import
gpuarray_shared_constructor
from
theano.sandbox.gpuarray.tests
.test_basic_ops
import
(
makeTester
,
rand
,
from
.test_basic_ops
import
(
makeTester
,
rand
,
mode_with_gpu
)
mode_with_gpu
)
from
theano.sandbox.gpuarray
.blas
import
(
gpugemv_inplace
,
gpugemv_no_inplace
,
from
.
.blas
import
(
gpugemv_inplace
,
gpugemv_no_inplace
,
gpugemm_inplace
,
gpugemm_no_inplace
,
gpugemm_inplace
,
gpugemm_no_inplace
,
gpuger_inplace
,
gpuger_no_inplace
,
gpuger_inplace
,
gpuger_no_inplace
,
GpuGer
,
gpu_dot22
)
GpuGer
,
gpu_dot22
)
...
...
theano/sandbox/gpuarray/tests/test_conv_cuda_ndarray.py
浏览文件 @
fdf7913b
...
@@ -22,10 +22,10 @@ from theano.compat.python2x import any
...
@@ -22,10 +22,10 @@ from theano.compat.python2x import any
from
theano.tests.unittest_tools
import
seed_rng
from
theano.tests.unittest_tools
import
seed_rng
# We let that import do the init of the back-end if needed.
# We let that import do the init of the back-end if needed.
from
theano.sandbox.gpuarray.tests
.test_basic_ops
import
(
mode_with_gpu
,
from
.test_basic_ops
import
(
mode_with_gpu
,
mode_without_gpu
)
mode_without_gpu
)
from
theano.sandbox.gpuarray
.type
import
GpuArrayType
from
.
.type
import
GpuArrayType
from
theano.sandbox.gpuarray
.conv
import
GpuConv
from
.
.conv
import
GpuConv
import
pygpu
import
pygpu
gftensor4
=
GpuArrayType
(
'float32'
,
[
False
]
*
4
)
gftensor4
=
GpuArrayType
(
'float32'
,
[
False
]
*
4
)
...
...
theano/sandbox/gpuarray/tests/test_elemwise.py
浏览文件 @
fdf7913b
...
@@ -6,11 +6,10 @@ from theano.tests.unittest_tools import SkipTest
...
@@ -6,11 +6,10 @@ from theano.tests.unittest_tools import SkipTest
from
theano.tensor.tests.test_elemwise
import
(
test_Broadcast
,
test_DimShuffle
,
from
theano.tensor.tests.test_elemwise
import
(
test_Broadcast
,
test_DimShuffle
,
test_CAReduce
,
T_reduce_dtype
)
test_CAReduce
,
T_reduce_dtype
)
from
theano.sandbox.gpuarray.tests.test_basic_ops
import
(
mode_with_gpu
,
from
.test_basic_ops
import
mode_with_gpu
,
rand_gpuarray
rand_gpuarray
)
from
..elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
from
theano.sandbox.gpuarray.elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
GpuCAReduceCuda
,
GpuCAReduceCPY
)
GpuCAReduceCuda
,
GpuCAReduceCPY
)
from
theano.sandbox.gpuarray
.type
import
GpuArrayType
from
.
.type
import
GpuArrayType
from
pygpu.array
import
gpuarray
from
pygpu.array
import
gpuarray
...
...
theano/sandbox/gpuarray/tests/test_neighbours.py
浏览文件 @
fdf7913b
import
unittest
import
unittest
from
theano.tensor.nnet.tests
import
test_neighbours
# We let that import do the init of the back-end if needed.
# We let that import do the init of the back-end if needed.
from
theano.sandbox.gpuarray.tests
.test_basic_ops
import
(
mode_with_gpu
,
from
.test_basic_ops
import
(
mode_with_gpu
,
mode_without_gpu
)
mode_without_gpu
)
import
theano.tensor.nnet.tests.test_neighbours
from
..neighbours
import
GpuImages2Neibs
from
theano.sandbox.gpuarray.neighbours
import
GpuImages2Neibs
class
T_GpuImages2Neibs
(
t
heano
.
tensor
.
nnet
.
tests
.
t
est_neighbours
.
T_Images2Neibs
):
class
T_GpuImages2Neibs
(
test_neighbours
.
T_Images2Neibs
):
mode
=
mode_with_gpu
mode
=
mode_with_gpu
op
=
GpuImages2Neibs
op
=
GpuImages2Neibs
dtypes
=
[
'int64'
,
'float32'
,
'float64'
]
dtypes
=
[
'int64'
,
'float32'
,
'float64'
]
...
...
theano/sandbox/gpuarray/tests/test_nnet.py
浏览文件 @
fdf7913b
...
@@ -9,12 +9,13 @@ import theano.tests.unittest_tools as utt
...
@@ -9,12 +9,13 @@ import theano.tests.unittest_tools as utt
from
theano.sandbox
import
gpuarray
from
theano.sandbox
import
gpuarray
# We let that import do the init of the back-end if needed.
# We let that import do the init of the back-end if needed.
from
theano.sandbox.gpuarray.tests
.test_basic_ops
import
(
mode_with_gpu
,
from
.test_basic_ops
import
(
mode_with_gpu
,
mode_without_gpu
)
mode_without_gpu
)
from
theano.sandbox.gpuarray
.nnet
import
(
from
.
.nnet
import
(
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmax1HotWithBiasDx
)
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuSoftmaxWithBias
,
GpuSoftmax
)
def
test_GpuCrossentropySoftmaxArgmax1HotWithBias
():
def
test_GpuCrossentropySoftmaxArgmax1HotWithBias
():
...
@@ -203,7 +204,7 @@ def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
...
@@ -203,7 +204,7 @@ def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
f_gpu
=
theano
.
function
([
x
],
z
,
mode
=
mode_with_gpu
)
f_gpu
=
theano
.
function
([
x
],
z
,
mode
=
mode_with_gpu
)
assert
f
.
maker
.
fgraph
.
toposort
()[
-
1
]
.
op
==
T
.
nnet
.
softmax_with_bias
assert
f
.
maker
.
fgraph
.
toposort
()[
-
1
]
.
op
==
T
.
nnet
.
softmax_with_bias
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
theano
.
sandbox
.
gpuarray
.
nnet
.
GpuSoftmaxWithBias
)
GpuSoftmaxWithBias
)
def
cmp
(
n
,
m
):
def
cmp
(
n
,
m
):
# print "test_softmax",n,m
# print "test_softmax",n,m
...
@@ -261,7 +262,7 @@ def softmax_unittest_template(dtypeInput):
...
@@ -261,7 +262,7 @@ def softmax_unittest_template(dtypeInput):
f_gpu
=
theano
.
function
([
x
],
z
,
mode
=
mode_with_gpu
)
f_gpu
=
theano
.
function
([
x
],
z
,
mode
=
mode_with_gpu
)
assert
f
.
maker
.
fgraph
.
toposort
()[
-
1
]
.
op
==
T
.
nnet
.
softmax
assert
f
.
maker
.
fgraph
.
toposort
()[
-
1
]
.
op
==
T
.
nnet
.
softmax
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
-
2
]
.
op
,
theano
.
sandbox
.
gpuarray
.
nnet
.
GpuSoftmax
)
GpuSoftmax
)
def
cmp
(
n
,
m
):
def
cmp
(
n
,
m
):
if
dtypeInput
==
'float32'
:
if
dtypeInput
==
'float32'
:
...
...
theano/sandbox/gpuarray/tests/test_opt.py
浏览文件 @
fdf7913b
...
@@ -3,19 +3,16 @@ import numpy
...
@@ -3,19 +3,16 @@ import numpy
import
theano
import
theano
from
theano
import
tensor
from
theano
import
tensor
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
import
theano.sandbox.gpuarray
from
theano.sandbox.gpuarray.type
import
(
GpuArrayType
,
gpuarray_shared_constructor
)
from
theano.sandbox.gpuarray.basic_ops
import
(
GpuAlloc
,
GpuReshape
,
gpu_alloc
,
gpu_from_host
,
host_from_gpu
)
from
theano.sandbox.gpuarray.elemwise
import
(
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuElemwise
)
from
theano.sandbox.gpuarray.subtensor
import
GpuSubtensor
from
theano.sandbox.gpuarray.tests.test_basic_ops
import
(
rand_gpuarray
,
mode_with_gpu
,
mode_without_gpu
)
from
theano.tests.unittest_tools
import
SkipTest
from
theano.tests.unittest_tools
import
SkipTest
from
theano.tensor.tests.test_basic
import
TestSpecifyShape
from
theano.tensor.tests
import
test_basic
import
theano.sandbox.gpuarray
from
..type
import
GpuArrayType
,
gpuarray_shared_constructor
from
..basic_ops
import
(
GpuAlloc
,
GpuReshape
,
gpu_alloc
,
gpu_from_host
,
host_from_gpu
)
from
..elemwise
import
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuElemwise
from
..subtensor
import
GpuSubtensor
from
.test_basic_ops
import
rand_gpuarray
,
mode_with_gpu
,
mode_without_gpu
def
test_local_assert
():
def
test_local_assert
():
...
@@ -135,10 +132,9 @@ def test_rebroadcast():
...
@@ -135,10 +132,9 @@ def test_rebroadcast():
assert
isinstance
(
rebr
.
outputs
[
0
]
.
type
,
GpuArrayType
)
assert
isinstance
(
rebr
.
outputs
[
0
]
.
type
,
GpuArrayType
)
class
TestSpecifyShape
(
TestSpecifyShape
):
class
TestSpecifyShape
(
test_basic
.
TestSpecifyShape
):
mode
=
mode_with_gpu
mode
=
mode_with_gpu
input_type
=
GpuArrayType
input_type
=
GpuArrayType
pass
def
test_print_op
():
def
test_print_op
():
...
@@ -146,9 +142,6 @@ def test_print_op():
...
@@ -146,9 +142,6 @@ def test_print_op():
b
=
tensor
.
fmatrix
()
b
=
tensor
.
fmatrix
()
f
=
theano
.
function
([
b
],
theano
.
printing
.
Print
()(
b
)
*
2
,
f
=
theano
.
function
([
b
],
theano
.
printing
.
Print
()(
b
)
*
2
,
mode
=
mode_with_gpu
)
mode
=
mode_with_gpu
)
theano
.
printing
.
debugprint
(
f
)
# print f.maker.fgraph.toposort()
#[GpuFromHost(<TensorType(float32, matrix)>), <theano.printing.Print object at 0x3581210>(GpuFromHost.0), GpuElemwise{mul}(CudaNdarray{[[ 2.]]}, <theano.printing.Print object at 0x3581210>.0), HostFromGpu(GpuElemwise{mul}.0)]
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
topo
[
0
]
.
op
==
gpu_from_host
assert
topo
[
0
]
.
op
==
gpu_from_host
assert
isinstance
(
topo
[
1
]
.
op
,
theano
.
printing
.
Print
)
assert
isinstance
(
topo
[
1
]
.
op
,
theano
.
printing
.
Print
)
...
...
theano/sandbox/gpuarray/tests/test_scan.py
浏览文件 @
fdf7913b
...
@@ -5,12 +5,10 @@ import theano
...
@@ -5,12 +5,10 @@ import theano
from
theano.tests
import
unittest_tools
as
utt
from
theano.tests
import
unittest_tools
as
utt
import
theano.sandbox.rng_mrg
import
theano.sandbox.rng_mrg
from
theano.sandbox.gpuarray.basic_ops
import
(
from
..basic_ops
import
gpu_from_host
,
GpuFromHost
,
HostFromGpu
gpu_from_host
,
GpuFromHost
,
HostFromGpu
from
..elemwise
import
GpuElemwise
)
from
theano.sandbox.gpuarray.elemwise
import
GpuElemwise
from
theano.sandbox.gpuarray.tests
.test_basic_ops
import
mode_with_gpu
from
.test_basic_ops
import
mode_with_gpu
class
T_Scan
(
TestCase
):
class
T_Scan
(
TestCase
):
...
...
theano/sandbox/gpuarray/tests/test_subtensor.py
浏览文件 @
fdf7913b
import
numpy
import
numpy
import
theano
import
theano
from
theano
import
tensor
from
theano.compile
import
DeepCopyOp
from
theano.tensor.tests.test_subtensor
import
T_subtensor
from
theano.tensor.tests.test_subtensor
import
T_subtensor
from
theano.sandbox.gpuarray.basic_ops
import
(
HostFromGpu
,
GpuFromHost
)
from
..basic_ops
import
HostFromGpu
,
GpuFromHost
from
theano.sandbox.gpuarray
.subtensor
import
(
GpuIncSubtensor
,
GpuSubtensor
,
from
.
.subtensor
import
(
GpuIncSubtensor
,
GpuSubtensor
,
GpuAdvancedIncSubtensor1
)
GpuAdvancedIncSubtensor1
)
from
..type
import
gpuarray_shared_constructor
from
theano.sandbox.gpuarray.type
import
gpuarray_shared_constructor
from
.test_basic_ops
import
mode_with_gpu
from
theano.sandbox.gpuarray.tests.test_basic_ops
import
mode_with_gpu
from
theano.compile
import
DeepCopyOp
from
theano
import
tensor
class
G_subtensor
(
T_subtensor
):
class
G_subtensor
(
T_subtensor
):
...
...
theano/sandbox/gpuarray/tests/test_type.py
浏览文件 @
fdf7913b
...
@@ -5,9 +5,9 @@ import numpy
...
@@ -5,9 +5,9 @@ import numpy
import
theano
import
theano
from
theano.compile
import
DeepCopyOp
from
theano.compile
import
DeepCopyOp
from
theano.sandbox.gpuarray.tests
.test_basic_ops
import
rand_gpuarray
from
.test_basic_ops
import
rand_gpuarray
from
theano.sandbox.gpuarray
.type
import
GpuArrayType
from
.
.type
import
GpuArrayType
def
test_deep_copy
():
def
test_deep_copy
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论