Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
88648d8d
提交
88648d8d
authored
11月 30, 2016
作者:
Pascal Lamblin
提交者:
GitHub
11月 30, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5300 from nouiz/cxx
Fix tests when no compiler.
上级
268503ac
6801dde1
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
72 行增加
和
5 行删除
+72
-5
test_mode.py
theano/compile/tests/test_mode.py
+5
-0
test_cc.py
theano/gof/tests/test_cc.py
+3
-0
test_compute_test_value.py
theano/gof/tests/test_compute_test_value.py
+1
-1
test_fg.py
theano/gof/tests/test_fg.py
+4
-0
test_vm.py
theano/gof/tests/test_vm.py
+6
-0
test_basic_sympy.py
theano/scalar/tests/test_basic_sympy.py
+7
-2
scan_op.py
theano/scan_module/scan_op.py
+5
-0
scan_perform.c
theano/scan_module/scan_perform.c
+0
-0
scan_perform.pyx
theano/scan_module/scan_perform.pyx
+3
-1
scan_perform_ext.py
theano/scan_module/scan_perform_ext.py
+8
-1
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+8
-0
test_corr.py
theano/tensor/nnet/tests/test_corr.py
+10
-0
test_corr3d.py
theano/tensor/nnet/tests/test_corr3d.py
+12
-0
没有找到文件。
theano/compile/tests/test_mode.py
浏览文件 @
88648d8d
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
from
nose.plugins.skip
import
SkipTest
import
theano
import
theano
from
theano.compile.mode
import
Mode
,
AddFeatureOptimizer
from
theano.compile.mode
import
Mode
,
AddFeatureOptimizer
from
theano.gof.toolbox
import
NoOutputFromInplace
from
theano.gof.toolbox
import
NoOutputFromInplace
...
@@ -18,6 +21,8 @@ def test_no_output_from_implace():
...
@@ -18,6 +21,8 @@ def test_no_output_from_implace():
op
=
fct_no_opt
.
maker
.
fgraph
.
outputs
[
0
]
.
owner
.
op
op
=
fct_no_opt
.
maker
.
fgraph
.
outputs
[
0
]
.
owner
.
op
assert
(
hasattr
(
op
,
'destroy_map'
)
and
0
in
op
.
destroy_map
)
assert
(
hasattr
(
op
,
'destroy_map'
)
and
0
in
op
.
destroy_map
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
# Ensure that the elemwise op that produces the output is not inplace when
# Ensure that the elemwise op that produces the output is not inplace when
# using a mode that includes the optimization
# using a mode that includes the optimization
opt
=
AddFeatureOptimizer
(
NoOutputFromInplace
())
opt
=
AddFeatureOptimizer
(
NoOutputFromInplace
())
...
...
theano/gof/tests/test_cc.py
浏览文件 @
88648d8d
...
@@ -390,6 +390,9 @@ def test_shared_input_output():
...
@@ -390,6 +390,9 @@ def test_shared_input_output():
# Test bug reported on the mailing list by Alberto Orlandi
# Test bug reported on the mailing list by Alberto Orlandi
# https://groups.google.com/d/topic/theano-users/6dLaEqc2R6g/discussion
# https://groups.google.com/d/topic/theano-users/6dLaEqc2R6g/discussion
# The shared variable is both an input and an output of the function.
# The shared variable is both an input and an output of the function.
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
inc
=
theano
.
tensor
.
iscalar
(
'inc'
)
inc
=
theano
.
tensor
.
iscalar
(
'inc'
)
state
=
theano
.
shared
(
0
)
state
=
theano
.
shared
(
0
)
state
.
name
=
'state'
state
.
name
=
'state'
...
...
theano/gof/tests/test_compute_test_value.py
浏览文件 @
88648d8d
...
@@ -331,7 +331,7 @@ class TestComputeTestValue(unittest.TestCase):
...
@@ -331,7 +331,7 @@ class TestComputeTestValue(unittest.TestCase):
assert
(
str
(
e
)
.
startswith
(
"shape mismatch"
)
or
assert
(
str
(
e
)
.
startswith
(
"shape mismatch"
)
or
str
(
e
)
.
startswith
(
"operands could not be broadcast "
str
(
e
)
.
startswith
(
"operands could not be broadcast "
"together with shapes"
)
or
"together with shapes"
)
or
str
(
e
)
.
startswith
(
"could not broadcast input"
))
str
(
e
)
.
startswith
(
"could not broadcast input"
))
,
str
(
e
)
finally
:
finally
:
theano
.
config
.
compute_test_value
=
orig_compute_test_value
theano
.
config
.
compute_test_value
=
orig_compute_test_value
...
...
theano/gof/tests/test_fg.py
浏览文件 @
88648d8d
...
@@ -3,6 +3,8 @@ import os
...
@@ -3,6 +3,8 @@ import os
import
pickle
import
pickle
import
unittest
import
unittest
from
nose.plugins.skip
import
SkipTest
import
theano
import
theano
from
theano.compat
import
PY3
from
theano.compat
import
PY3
from
theano.gof
import
CachedConstantError
,
FunctionGraph
from
theano.gof
import
CachedConstantError
,
FunctionGraph
...
@@ -32,6 +34,8 @@ class TFunctionGraph(unittest.TestCase):
...
@@ -32,6 +34,8 @@ class TFunctionGraph(unittest.TestCase):
# In the past, we where removing some not used variable from
# In the past, we where removing some not used variable from
# fgraph.variables event if the apply had other output used in
# fgraph.variables event if the apply had other output used in
# the graph. This caused a crash.
# the graph. This caused a crash.
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
# This test run the pickle that reproduce this case.
# This test run the pickle that reproduce this case.
with
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
with
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
...
...
theano/gof/tests/test_vm.py
浏览文件 @
88648d8d
...
@@ -209,6 +209,8 @@ def test_partial_function():
...
@@ -209,6 +209,8 @@ def test_partial_function():
utt
.
assert_allclose
(
f
(
5
),
np
.
array
([
32.
,
16.
,
1.7857142857142858
]))
utt
.
assert_allclose
(
f
(
5
),
np
.
array
([
32.
,
16.
,
1.7857142857142858
]))
check_partial_function
(
vm
.
VM_Linker
(
allow_partial_eval
=
True
,
use_cloop
=
False
))
check_partial_function
(
vm
.
VM_Linker
(
allow_partial_eval
=
True
,
use_cloop
=
False
))
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
check_partial_function
(
'cvm'
)
check_partial_function
(
'cvm'
)
...
@@ -223,6 +225,8 @@ def test_partial_function_with_output_keys():
...
@@ -223,6 +225,8 @@ def test_partial_function_with_output_keys():
assert
f
(
5
,
output_subset
=
[
'a'
])[
'a'
]
==
f
(
5
)[
'a'
]
assert
f
(
5
,
output_subset
=
[
'a'
])[
'a'
]
==
f
(
5
)[
'a'
]
check_partial_function_output_keys
(
vm
.
VM_Linker
(
allow_partial_eval
=
True
,
use_cloop
=
False
))
check_partial_function_output_keys
(
vm
.
VM_Linker
(
allow_partial_eval
=
True
,
use_cloop
=
False
))
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
check_partial_function_output_keys
(
'cvm'
)
check_partial_function_output_keys
(
'cvm'
)
...
@@ -243,6 +247,8 @@ def test_partial_function_with_updates():
...
@@ -243,6 +247,8 @@ def test_partial_function_with_updates():
assert
y
.
get_value
()
==
10
assert
y
.
get_value
()
==
10
check_updates
(
vm
.
VM_Linker
(
allow_partial_eval
=
True
,
use_cloop
=
False
))
check_updates
(
vm
.
VM_Linker
(
allow_partial_eval
=
True
,
use_cloop
=
False
))
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
check_updates
(
'cvm'
)
check_updates
(
'cvm'
)
...
...
theano/scalar/tests/test_basic_sympy.py
浏览文件 @
88648d8d
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
import
theano
from
theano.scalar.basic_sympy
import
SymPyCCode
from
theano.scalar.basic_sympy
import
SymPyCCode
from
theano.scalar.basic
import
floats
from
theano.scalar.basic
import
floats
import
theano
from
nose.plugins.skip
import
SkipTest
try
:
try
:
import
sympy
import
sympy
xs
=
sympy
.
Symbol
(
'x'
)
xs
=
sympy
.
Symbol
(
'x'
)
ys
=
sympy
.
Symbol
(
'y'
)
ys
=
sympy
.
Symbol
(
'y'
)
except
ImportError
:
except
ImportError
:
from
nose.plugins.skip
import
SkipTest
raise
SkipTest
(
'optional package sympy disabled'
)
raise
SkipTest
(
'optional package sympy disabled'
)
xt
,
yt
=
floats
(
'xy'
)
xt
,
yt
=
floats
(
'xy'
)
def
test_SymPyCCode
():
def
test_SymPyCCode
():
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
op
=
SymPyCCode
([
xs
,
ys
],
xs
+
ys
)
op
=
SymPyCCode
([
xs
,
ys
],
xs
+
ys
)
e
=
op
(
xt
,
yt
)
e
=
op
(
xt
,
yt
)
g
=
theano
.
gof
.
FunctionGraph
([
xt
,
yt
],
[
e
])
g
=
theano
.
gof
.
FunctionGraph
([
xt
,
yt
],
[
e
])
...
...
theano/scan_module/scan_op.py
浏览文件 @
88648d8d
...
@@ -1436,6 +1436,11 @@ class Scan(PureOp):
...
@@ -1436,6 +1436,11 @@ class Scan(PureOp):
outs
[
j
][
0
][
pos
[
j
]]
=
\
outs
[
j
][
0
][
pos
[
j
]]
=
\
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
output_storage
[
offset_out
+
j
]
.
storage
[
0
]
except
ValueError
as
e
:
except
ValueError
as
e
:
if
i
==
0
:
# First iteration, so don't change the
# error message as it can't be the
# case we write about.
raise
ne
=
ValueError
(
ne
=
ValueError
(
"An output of the scan has changed shape. "
"An output of the scan has changed shape. "
"This may be caused by a pushout optimization."
"This may be caused by a pushout optimization."
...
...
theano/scan_module/scan_perform.c
浏览文件 @
88648d8d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
theano/scan_module/scan_perform.pyx
浏览文件 @
88648d8d
...
@@ -62,7 +62,7 @@ import copy
...
@@ -62,7 +62,7 @@ import copy
def get_version():
def get_version():
return 0.29
4
return 0.29
5
@cython.boundscheck(False)
@cython.boundscheck(False)
def perform(
def perform(
...
@@ -547,6 +547,8 @@ def perform(
...
@@ -547,6 +547,8 @@ def perform(
try:
try:
outs[j][0][pos[j]] = output_storage[j+offset_out].storage[0]
outs[j][0][pos[j]] = output_storage[j+offset_out].storage[0]
except ValueError as e:
except ValueError as e:
if i == 0:
raise
raise ValueError(
raise ValueError(
"An output of the scan has changed shape. "
"An output of the scan has changed shape. "
"This may be caused by a pushout optimization."
"This may be caused by a pushout optimization."
...
...
theano/scan_module/scan_perform_ext.py
浏览文件 @
88648d8d
"""
To update the scan Cython code in Theano you must
- update the version in this file and scan_perform.py
- call "cd theano/scan_module/; cython scan_perform.pyx; patch scan_perform.c numpy_api_changes.diff"
"""
from
__future__
import
absolute_import
,
print_function
,
division
from
__future__
import
absolute_import
,
print_function
,
division
import
errno
import
errno
import
logging
import
logging
...
@@ -17,7 +24,7 @@ from theano.gof import cmodule
...
@@ -17,7 +24,7 @@ from theano.gof import cmodule
_logger
=
logging
.
getLogger
(
'theano.scan_module.scan_perform'
)
_logger
=
logging
.
getLogger
(
'theano.scan_module.scan_perform'
)
version
=
0.29
4
# must match constant returned in function get_version()
version
=
0.29
5
# must match constant returned in function get_version()
need_reload
=
False
need_reload
=
False
...
...
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
88648d8d
...
@@ -456,6 +456,9 @@ class TestAbstractConvNoOptim(BaseTestConv2d):
...
@@ -456,6 +456,9 @@ class TestAbstractConvNoOptim(BaseTestConv2d):
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
mode
=
theano
.
Mode
(
optimizer
=
None
)
mode
=
theano
.
Mode
(
optimizer
=
None
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx to test conv2d"
)
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
self
.
run_fwd
(
inputs_shape
=
i
,
filters_shape
=
f
,
subsample
=
s
,
verify_grad
=
True
,
provide_shape
=
provide_shape
,
verify_grad
=
True
,
provide_shape
=
provide_shape
,
border_mode
=
b
,
filter_flip
=
flip
,
border_mode
=
b
,
filter_flip
=
flip
,
...
@@ -490,6 +493,9 @@ class TestCpuConv2d(BaseTestConv2d):
...
@@ -490,6 +493,9 @@ class TestCpuConv2d(BaseTestConv2d):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
,
fd
=
(
1
,
1
)):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
,
fd
=
(
1
,
1
)):
if
fd
!=
(
1
,
1
):
if
fd
!=
(
1
,
1
):
raise
SkipTest
(
"No dilation implementation for basic cpu ConvOp."
)
raise
SkipTest
(
"No dilation implementation for basic cpu ConvOp."
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx to test conv2d"
)
mode
=
self
.
mode
mode
=
self
.
mode
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
fwd_OK
=
True
fwd_OK
=
True
...
@@ -679,6 +685,8 @@ class TestCpuConv3d(BaseTestConv3d):
...
@@ -679,6 +685,8 @@ class TestCpuConv3d(BaseTestConv3d):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
,
fd
=
(
1
,
1
,
1
)):
def
tcase
(
self
,
i
,
f
,
s
,
b
,
flip
,
provide_shape
,
fd
=
(
1
,
1
,
1
)):
if
fd
!=
(
1
,
1
,
1
):
if
fd
!=
(
1
,
1
,
1
):
raise
SkipTest
(
"No dilation implementation for basic cpu Conv3D."
)
raise
SkipTest
(
"No dilation implementation for basic cpu Conv3D."
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx to test conv2d"
)
mode
=
self
.
mode
mode
=
self
.
mode
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
o
=
self
.
get_output_shape
(
i
,
f
,
s
,
b
,
fd
)
fwd_OK
=
True
fwd_OK
=
True
...
...
theano/tensor/nnet/tests/test_corr.py
浏览文件 @
88648d8d
...
@@ -37,6 +37,8 @@ class TestCorr2D(utt.InferShapeTester):
...
@@ -37,6 +37,8 @@ class TestCorr2D(utt.InferShapeTester):
:param image_shape: The constant shape info passed to corrMM.
:param image_shape: The constant shape info passed to corrMM.
:param filter_shape: The constant shape info passed to corrMM.
:param filter_shape: The constant shape info passed to corrMM.
"""
"""
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx to test conv2d"
)
N_image_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
N_image_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
for
x
in
image_shape
]
for
x
in
image_shape
]
N_filter_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
N_filter_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
...
@@ -265,6 +267,8 @@ class TestCorr2D(utt.InferShapeTester):
...
@@ -265,6 +267,8 @@ class TestCorr2D(utt.InferShapeTester):
def
rand
(
shape
,
dtype
=
'float64'
):
def
rand
(
shape
,
dtype
=
'float64'
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
dtype
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
dtype
)
return
r
*
2
-
1
return
r
*
2
-
1
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx to test conv2d"
)
ops
=
[
corr
.
CorrMM
,
corr
.
CorrMM_gradWeights
,
corr
.
CorrMM_gradInputs
]
ops
=
[
corr
.
CorrMM
,
corr
.
CorrMM_gradWeights
,
corr
.
CorrMM_gradInputs
]
a_shapes
=
[[
4
,
5
,
6
,
3
],
[
1
,
5
,
6
,
3
],
[
1
,
5
,
6
,
3
]]
a_shapes
=
[[
4
,
5
,
6
,
3
],
[
1
,
5
,
6
,
3
],
[
1
,
5
,
6
,
3
]]
...
@@ -288,6 +292,8 @@ class TestCorr2D(utt.InferShapeTester):
...
@@ -288,6 +292,8 @@ class TestCorr2D(utt.InferShapeTester):
def
test_infer_shape_forward
(
self
):
def
test_infer_shape_forward
(
self
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
raise
SkipTest
(
"CorrMM don't work in FAST_COMPILE"
)
raise
SkipTest
(
"CorrMM don't work in FAST_COMPILE"
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
*
shape
):
def
rand
(
*
shape
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
...
@@ -319,6 +325,8 @@ class TestCorr2D(utt.InferShapeTester):
...
@@ -319,6 +325,8 @@ class TestCorr2D(utt.InferShapeTester):
def
test_infer_shape_gradW
(
self
):
def
test_infer_shape_gradW
(
self
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
raise
SkipTest
(
"CorrMM don't work in FAST_COMPILE"
)
raise
SkipTest
(
"CorrMM don't work in FAST_COMPILE"
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
*
shape
):
def
rand
(
*
shape
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
...
@@ -357,6 +365,8 @@ class TestCorr2D(utt.InferShapeTester):
...
@@ -357,6 +365,8 @@ class TestCorr2D(utt.InferShapeTester):
def
test_infer_shape_gradI
(
self
):
def
test_infer_shape_gradI
(
self
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
raise
SkipTest
(
"CorrMM don't work in FAST_COMPILE"
)
raise
SkipTest
(
"CorrMM don't work in FAST_COMPILE"
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
*
shape
):
def
rand
(
*
shape
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
...
...
theano/tensor/nnet/tests/test_corr3d.py
浏览文件 @
88648d8d
...
@@ -37,6 +37,9 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -37,6 +37,9 @@ class TestCorr3D(utt.InferShapeTester):
:param image_shape: The constant shape info passed to corr3dMM.
:param image_shape: The constant shape info passed to corr3dMM.
:param filter_shape: The constant shape info passed to corr3dMM.
:param filter_shape: The constant shape info passed to corr3dMM.
"""
"""
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
N_image_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
N_image_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
for
x
in
image_shape
]
for
x
in
image_shape
]
N_filter_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
N_filter_shape
=
[
T
.
get_scalar_constant_value
(
T
.
as_tensor_variable
(
x
))
...
@@ -276,6 +279,9 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -276,6 +279,9 @@ class TestCorr3D(utt.InferShapeTester):
"""
"""
Checks dtype upcast for Corr3dMM methods.
Checks dtype upcast for Corr3dMM methods.
"""
"""
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
shape
,
dtype
=
'float64'
):
def
rand
(
shape
,
dtype
=
'float64'
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
dtype
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
dtype
)
return
r
*
2
-
1
return
r
*
2
-
1
...
@@ -302,6 +308,8 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -302,6 +308,8 @@ class TestCorr3D(utt.InferShapeTester):
def
test_infer_shape_forward
(
self
):
def
test_infer_shape_forward
(
self
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
raise
SkipTest
(
"Corr3dMM don't work in FAST_COMPILE"
)
raise
SkipTest
(
"Corr3dMM don't work in FAST_COMPILE"
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
*
shape
):
def
rand
(
*
shape
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
...
@@ -333,6 +341,8 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -333,6 +341,8 @@ class TestCorr3D(utt.InferShapeTester):
def
test_infer_shape_gradW
(
self
):
def
test_infer_shape_gradW
(
self
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
raise
SkipTest
(
"Corr3dMM don't work in FAST_COMPILE"
)
raise
SkipTest
(
"Corr3dMM don't work in FAST_COMPILE"
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
*
shape
):
def
rand
(
*
shape
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
...
@@ -372,6 +382,8 @@ class TestCorr3D(utt.InferShapeTester):
...
@@ -372,6 +382,8 @@ class TestCorr3D(utt.InferShapeTester):
def
test_infer_shape_gradI
(
self
):
def
test_infer_shape_gradI
(
self
):
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
if
theano
.
config
.
mode
==
"FAST_COMPILE"
:
raise
SkipTest
(
"Corr3dMM don't work in FAST_COMPILE"
)
raise
SkipTest
(
"Corr3dMM don't work in FAST_COMPILE"
)
if
not
theano
.
config
.
cxx
:
raise
SkipTest
(
"Need cxx for this test"
)
def
rand
(
*
shape
):
def
rand
(
*
shape
):
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
r
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float64'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论