Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a9f0edf3
提交
a9f0edf3
authored
10月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply isort to tests.tensor sub-package top-level modules
上级
6c8cb50e
隐藏空白字符变更
内嵌
并排
正在显示
31 个修改的文件
包含
294 行增加
和
351 行删除
+294
-351
_test_mpi_roundtrip.py
tests/tensor/_test_mpi_roundtrip.py
+6
-3
test_basic.py
tests/tensor/test_basic.py
+97
-103
test_blas.py
tests/tensor/test_blas.py
+22
-27
test_blas_c.py
tests/tensor/test_blas_c.py
+5
-9
test_blas_scipy.py
tests/tensor/test_blas_scipy.py
+2
-5
test_casting.py
tests/tensor/test_casting.py
+15
-15
test_complex.py
tests/tensor/test_complex.py
+9
-13
test_elemwise.py
tests/tensor/test_elemwise.py
+9
-16
test_extra_ops.py
tests/tensor/test_extra_ops.py
+23
-26
test_fft.py
tests/tensor/test_fft.py
+1
-3
test_fourier.py
tests/tensor/test_fourier.py
+2
-5
test_gc.py
tests/tensor/test_gc.py
+1
-2
test_inc_subtensor.py
tests/tensor/test_inc_subtensor.py
+0
-2
test_io.py
tests/tensor/test_io.py
+6
-4
test_keepdims.py
tests/tensor/test_keepdims.py
+1
-1
test_merge.py
tests/tensor/test_merge.py
+4
-4
test_misc.py
tests/tensor/test_misc.py
+2
-0
test_mpi.py
tests/tensor/test_mpi.py
+6
-5
test_nlinalg.py
tests/tensor/test_nlinalg.py
+16
-20
test_opt.py
tests/tensor/test_opt.py
+7
-8
test_opt_uncanonicalize.py
tests/tensor/test_opt_uncanonicalize.py
+7
-10
test_raw_random.py
tests/tensor/test_raw_random.py
+8
-10
test_shared_randomstreams.py
tests/tensor/test_shared_randomstreams.py
+3
-4
test_sharedvar.py
tests/tensor/test_sharedvar.py
+4
-7
test_slinalg.py
tests/tensor/test_slinalg.py
+5
-8
test_sort.py
tests/tensor/test_sort.py
+12
-7
test_subtensor.py
tests/tensor/test_subtensor.py
+11
-16
test_type_other.py
tests/tensor/test_type_other.py
+2
-1
test_utils.py
tests/tensor/test_utils.py
+2
-2
test_var.py
tests/tensor/test_var.py
+4
-12
test_xlogx.py
tests/tensor/test_xlogx.py
+2
-3
没有找到文件。
tests/tensor/_test_mpi_roundtrip.py
浏览文件 @
a9f0edf3
# Run using
# mpiexec -np 2 python _test_mpi_roundtrip.py
from
sys
import
exit
,
stderr
,
stdout
import
numpy
as
np
from
mpi4py
import
MPI
import
theano
from
theano.configparser
import
change_flags
from
theano.tensor.io
import
send
,
recv
,
mpi_cmps
from
theano.gof.sched
import
sort_schedule_fn
import
numpy
as
np
from
sys
import
stdout
,
stderr
,
exit
from
theano.tensor.io
import
mpi_cmps
,
recv
,
send
comm
=
MPI
.
COMM_WORLD
...
...
tests/tensor/test_basic.py
浏览文件 @
a9f0edf3
import
builtins
import
itertools
import
operator
import
os
import
warnings
import
builtins
import
pytest
from
copy
import
copy
,
deepcopy
from
functools
import
partial
,
reduce
from
tempfile
import
mkstemp
import
numpy
as
np
import
pytest
from
numpy.testing
import
assert_allclose
,
assert_almost_equal
,
assert_array_equal
import
theano
import
theano.tensor
as
tt
from
tempfile
import
mkstemp
from
copy
import
copy
,
deepcopy
from
functools
import
partial
,
reduce
from
numpy.testing
import
assert_array_equal
,
assert_allclose
,
assert_almost_equal
from
theano
import
change_flags
from
tests
import
unittest_tools
as
utt
from
theano
import
change_flags
,
compile
,
config
,
function
,
gof
,
shared
from
theano.compat
import
operator_div
from
theano
import
compile
,
config
,
function
,
gof
,
shared
from
theano.compile
import
DeepCopyOp
from
theano.compile.mode
import
get_default_mode
from
theano.scalar
import
autocast_float
_as
,
autocast_float
from
theano.scalar
import
autocast_float
,
autocast_float_as
from
theano.tensor
import
(
wvector
,
bvector
,
argmin
,
max_and_argmax
,
cscalar
,
join
,
horizontal_stack
,
vertical_stack
,
argmax
,
get_vector_length
,
fscalar
,
sum
,
tensor3
,
vector
,
Alloc
,
AllocDiag
,
AllocEmpty
,
ARange
,
Argmax
,
Choose
,
DimShuffle
,
Dot
,
ExtractDiag
,
Eye
,
Join
,
MaxAndArgmax
,
Mean
,
NoneConst
,
PermuteRowElements
,
Rebroadcast
,
Reshape
,
ScalarFromTensor
,
Shape
,
SpecifyShape
,
Split
,
Tensor
,
TensorFromScalar
,
TensorType
,
Tile
,
Tri
,
add
,
addbroadcast
,
allclose
,
alloc
,
arange
,
argmax
,
argmin
,
as_tensor_variable
,
tensor_from_scalar
,
ARange
,
batched_dot
,
bvector
,
choose
,
clip
,
constant
,
cscalar
,
default
,
diag
,
dot
,
batched_dot
,
dmatrix
,
dot
,
dscalar
,
dscalars
,
dtensor3
,
dtensor4
,
dvector
,
eq
,
exp
,
extract_constant
,
eye
,
fill
,
flatnonzero
,
flatten
,
inverse_permutation
,
tensor4
,
permute_row_elements
,
fmatrix
,
fscalar
,
fscalars
,
fvector
,
get_scalar_constant_value
,
get_vector_length
,
grad
,
hessian
,
horizontal_stack
,
imatrix
,
inplace
,
inverse_permutation
,
iscalar
,
matrix
,
minimum
,
iscalars
,
isclose
,
itensor3
,
ivector
,
join
,
lscalar
,
lvector
,
matrices
,
matrix
,
max
,
max_and_argmax
,
maximum
,
mgrid
,
min
,
minimum
,
mul
,
neq
,
Reshape
,
nonzero
,
nonzero_values
,
numeric_grad
,
ogrid
,
opt
,
patternbroadcast
,
permute_row_elements
,
power
,
ptp
,
reshape
,
roll
,
row
,
scal
,
scalar
,
scalar_from_tensor
,
scalars
,
second
,
shape
,
smallest
,
stack
,
stacklists
,
sub
,
Tensor
,
sum
,
swapaxes
,
switch
,
tensor3
,
tensor4
,
tensor_copy
,
tensor_from_scalar
,
tensordot
,
TensorType
,
Tri
,
tile
,
tri
,
tril
,
triu
,
true_div
,
unbroadcast
,
var
,
Argmax
,
Join
,
shape
,
MaxAndArgmax
,
lscalar
,
vector
,
vertical_stack
,
wvector
,
zvector
,
exp
,
get_scalar_constant_value
,
ivector
,
reshape
,
scalar_from_tensor
,
scal
,
iscalars
,
arange
,
dscalars
,
fvector
,
imatrix
,
numeric_grad
,
opt
,
lvector
,
true_div
,
max
,
min
,
Split
,
roll
,
tile
,
patternbroadcast
,
Eye
,
Shape
,
Dot
,
PermuteRowElements
,
ScalarFromTensor
,
TensorFromScalar
,
dtensor4
,
Rebroadcast
,
Alloc
,
dtensor3
,
SpecifyShape
,
Mean
,
itensor3
,
Tile
,
switch
,
ExtractDiag
,
AllocDiag
,
nonzero
,
flatnonzero
,
nonzero_values
,
stacklists
,
DimShuffle
,
hessian
,
ptp
,
power
,
swapaxes
,
choose
,
Choose
,
NoneConst
,
AllocEmpty
,
isclose
,
allclose
,
mgrid
,
ogrid
,
extract_constant
,
)
from
tests
import
unittest_tools
as
utt
imported_scipy_special
=
False
mode_no_scipy
=
get_default_mode
()
...
...
tests/tensor/test_blas.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
import
theano
import
theano.tensor
as
tt
import
theano.tensor.blas_scipy
from
copy
import
copy
from
itertools
import
product
import
numpy
as
np
import
pytest
from
numpy
import
(
arange
,
array
,
...
...
@@ -25,38 +18,40 @@ from numpy import (
)
from
numpy.testing
import
assert_array_almost_equal
from
theano
import
In
,
shared
,
config
import
theano
import
theano.tensor
as
tt
import
theano.tensor.blas_scipy
from
tests
import
unittest_tools
from
tests.tensor.test_basic
import
as_tensor_variable
,
compile
,
inplace
,
inplace_func
from
theano
import
In
,
config
,
shared
from
theano.tensor.blas
import
(
Dot22
,
Dot22Scalar
,
Gemm
,
Gemv
,
Ger
,
InconsistencyError
,
_as_scalar
,
_dot22
,
_dot22scalar
,
res_is_a
,
_as_scalar
,
_is_real_matrix
,
_gemm_canonicalize
,
_factor_canonicalized
,
Gemm
,
Gemv
,
_gemm_canonicalize
,
_is_real_matrix
,
gemm
,
gemm_inplace
,
gemm_no_inplace
,
InconsistencyError
,
Ger
,
gemv
,
gemv_inplace
,
gemv_no_inplace
,
ger
,
ger_destructive
,
Dot22
,
Dot22Scalar
,
gemm
,
local_dot22_to_dot22scalar
,
gemv_no_inplace
,
gemv
,
gemv_inplace
,
local_gemm_to_ger
,
res_is_a
,
)
from
theano.tensor.nnet
import
sigmoid
from
theano.tensor.opt
import
in2out
from
tests
import
unittest_tools
from
tests.tensor.test_basic
import
as_tensor_variable
,
inplace_func
,
compile
,
inplace
if
config
.
mode
==
"FAST_COMPILE"
:
mode_not_fast_compile
=
"FAST_RUN"
...
...
tests/tensor/test_blas_c.py
浏览文件 @
a9f0edf3
import
sys
import
pytest
import
numpy
as
np
import
pytest
import
theano
import
theano.tensor
as
tensor
from
tests
import
unittest_tools
from
tests.tensor.test_blas
import
BaseGemv
,
TestBlasStrides
from
tests.unittest_tools
import
OptimizationTestMixin
from
theano.tensor.blas
import
Ger
from
theano.tensor.blas_c
import
CGe
r
from
theano.tensor.blas_c
import
CGe
mv
,
CGer
,
check_force_gemv_init
from
theano.tensor.blas_scipy
import
ScipyGer
from
theano.tensor.blas_c
import
CGemv
,
check_force_gemv_init
from
tests
import
unittest_tools
from
tests.unittest_tools
import
OptimizationTestMixin
from
tests.tensor.test_blas
import
BaseGemv
,
TestBlasStrides
mode_blas_opt
=
theano
.
compile
.
get_default_mode
()
.
including
(
"BlasOpt"
,
"specialize"
,
"InplaceBlasOpt"
,
"c_blas"
...
...
tests/tensor/test_blas_scipy.py
浏览文件 @
a9f0edf3
import
numpy
as
np
import
pytest
import
theano
import
theano.tensor
as
tensor
from
theano.tensor.blas_scipy
import
ScipyGer
from
tests.tensor.test_blas
import
TestBlasStrides
,
gemm_no_inplace
from
tests.unittest_tools
import
OptimizationTestMixin
from
t
ests.tensor.test_blas
import
gemm_no_inplace
,
TestBlasStrides
from
t
heano.tensor.blas_scipy
import
ScipyGer
@pytest.mark.skipif
(
not
theano
.
tensor
.
blas_scipy
.
have_fblas
,
reason
=
"fblas needed"
)
...
...
tests/tensor/test_casting.py
浏览文件 @
a9f0edf3
import
numpy
as
np
import
theano
import
theano.tensor.basic
as
basic
from
theano
import
function
from
theano.tensor.basic
import
(
_convert_to_int32
,
_convert_to_int8
,
_convert_to_int16
,
_convert_to_int64
,
_convert_to_float32
,
_convert_to_float64
,
)
from
theano.compile
import
In
from
theano.tensor
import
(
TensorType
,
bvector
,
ivector
,
fvector
,
dvector
,
zmatrix
,
cast
,
TensorType
,
dmatrix
,
dvector
,
fvector
,
ivector
,
zmatrix
,
)
from
theano.tensor.basic
import
(
_convert_to_float32
,
_convert_to_float64
,
_convert_to_int8
,
_convert_to_int16
,
_convert_to_int32
,
_convert_to_int64
,
)
from
theano.compile
import
In
class
TestCasting
:
...
...
tests/tensor/test_complex.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
import
pytest
import
theano
from
tests
import
unittest_tools
as
utt
from
theano.tensor
import
(
real
,
imag
,
zvector
,
dvector
,
cast
,
complex
,
complex_from_polar
,
cvector
,
dvector
,
fmatrix
,
fvector
,
cvector
,
imag
,
imatrix
,
complex
,
complex_from_pola
r
,
real
,
zvecto
r
,
)
from
tests
import
unittest_tools
as
utt
class
TestRealImag
:
def
test_basic
(
self
):
...
...
tests/tensor/test_elemwise.py
浏览文件 @
a9f0edf3
import
math
import
six.moves.cPickle
as
pickle
import
pytest
from
copy
import
copy
import
numpy
as
np
import
pytest
import
six.moves.cPickle
as
pickle
import
tests.unittest_tools
as
utt
import
theano
import
theano.tensor
as
tt
import
tests.unittest_tools
as
utt
from
copy
import
copy
from
theano
import
gof
,
scalar
,
config
from
tests
import
unittest_tools
from
theano
import
config
,
gof
,
scalar
from
theano.compile.mode
import
Mode
,
get_default_mode
from
theano.tensor
import
TensorType
,
as_tensor_variable
from
theano.compile.mode
import
get_default_mode
,
Mode
from
theano.tensor.elemwise
import
(
CAReduce
,
Elemwise
,
DimShuffle
,
Elemwise
,
Prod
,
ProdWithoutZeros
,
Sum
,
)
from
theano.tensor.type
import
values_eq_approx_remove_nan
from
theano.tensor.nnet
import
sigmoid
from
tests
import
unittest_tools
from
theano.tensor.type
import
values_eq_approx_remove_nan
def
FunctionGraph
(
i
,
o
):
...
...
tests/tensor/test_extra_ops.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
import
pytest
import
theano
from
tests
import
unittest_tools
as
utt
from
theano
import
config
,
function
from
theano
import
tensor
as
tt
from
theano.tensor.extra_ops
import
(
SearchsortedOp
,
searchsorted
,
CumOp
,
cumsum
,
cumprod
,
Bartlett
,
CpuContiguous
,
cpu_contiguous
,
bincount
,
CumOp
,
DiffOp
,
diff
,
squeeze
,
compress
,
FillDiagonal
,
FillDiagonalOffset
,
RavelMultiIndex
,
RepeatOp
,
repeat
,
Bartlett
,
SearchsortedOp
,
Unique
,
UnravelIndex
,
bartlett
,
FillDiagonal
,
bincount
,
broadcast_shape
,
compress
,
cpu_contiguous
,
cumprod
,
cumsum
,
diff
,
fill_diagonal
,
FillDiagonalOffset
,
fill_diagonal_offset
,
ravel_multi_index
,
repeat
,
searchsorted
,
squeeze
,
to_one_hot
,
Unique
,
unravel_index
,
UnravelIndex
,
ravel_multi_index
,
RavelMultiIndex
,
broadcast_shape
,
)
from
theano
import
tensor
as
tt
from
theano
import
config
,
function
from
tests
import
unittest_tools
as
utt
def
test_cpu_contiguous
():
...
...
tests/tensor/test_fft.py
浏览文件 @
a9f0edf3
...
...
@@ -3,10 +3,8 @@ import pytest
import
theano
import
theano.tensor
as
tt
from
theano.tensor
import
fft
from
tests
import
unittest_tools
as
utt
from
theano.tensor
import
fft
N
=
16
...
...
tests/tensor/test_fourier.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
import
pytest
import
theano
from
tests
import
unittest_tools
as
utt
from
theano
import
tensor
from
theano.tensor.fourier
import
Fourier
,
fft
from
tests
import
unittest_tools
as
utt
class
TestFourier
(
utt
.
InferShapeTester
):
...
...
tests/tensor/test_gc.py
浏览文件 @
a9f0edf3
import
time
import
six.moves.cPickle
as
pickle
import
numpy
as
np
import
six.moves.cPickle
as
pickle
import
theano
import
theano.tensor
as
tt
...
...
tests/tensor/test_inc_subtensor.py
浏览文件 @
a9f0edf3
import
numpy
as
np
import
pytest
import
theano
import
theano.tensor
as
tt
from
tests
import
unittest_tools
as
utt
...
...
tests/tensor/test_io.py
浏览文件 @
a9f0edf3
import
theano
import
pytest
from
theano
import
tensor
,
function
,
Variable
,
Generic
import
numpy
as
np
import
os
import
numpy
as
np
import
pytest
import
theano
from
theano
import
Generic
,
Variable
,
function
,
tensor
class
TestLoadTensor
:
def
setup_method
(
self
):
...
...
tests/tensor/test_keepdims.py
浏览文件 @
a9f0edf3
...
...
@@ -3,7 +3,7 @@ import pytest
from
six
import
integer_types
import
theano
from
theano
import
tensor
,
function
from
theano
import
function
,
tensor
# this tests other ops to ensure they keep the dimensions of their
...
...
tests/tensor/test_merge.py
浏览文件 @
a9f0edf3
import
numpy
as
np
import
theano.tensor.basic
as
tt
from
theano.gof.type
import
Type
from
theano.gof.graph
import
Variable
,
Apply
import
theano.tensor.basic
as
tt
from
theano.gof.fg
import
FunctionGraph
from
theano.gof.graph
import
Apply
,
Variable
from
theano.gof.op
import
Op
from
theano.gof.opt
import
MergeOptimizer
from
theano.gof.
fg
import
FunctionGraph
from
theano.gof.
type
import
Type
def
is_variable
(
x
):
...
...
tests/tensor/test_misc.py
浏览文件 @
a9f0edf3
import
copy
import
numpy
as
np
import
theano
from
theano
import
tensor
from
theano.tensor.nnet
import
crossentropy_softmax_argmax_1hot_with_bias
...
...
tests/tensor/test_mpi.py
浏览文件 @
a9f0edf3
import
os
import
subprocess
import
pytest
import
theano
from
theano
import
change_flags
from
theano.gof.sched
import
sort_schedule_fn
from
theano.tensor.io
import
(
send
,
recv
,
mpi_cmps
,
MPISend
,
MPISendWait
,
mpi_
send_wait_cmp
,
mpi_
cmps
,
mpi_enabled
,
mpi_send_wait_cmp
,
recv
,
send
,
)
mpi_scheduler
=
sort_schedule_fn
(
*
mpi_cmps
)
mpi_linker
=
theano
.
OpWiseCLinker
(
schedule
=
mpi_scheduler
)
mpi_mode
=
theano
.
Mode
(
linker
=
mpi_linker
)
...
...
tests/tensor/test_nlinalg.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
import
numpy.linalg
import
theano
import
pytest
from
numpy
import
inf
from
numpy.testing
import
assert_array_almost_equal
from
theano
import
tensor
,
function
from
t
heano.tensor.basic
import
_allclose
from
theano
import
config
import
theano
from
t
ests
import
unittest_tools
as
utt
from
theano
import
config
,
function
,
tensor
from
theano.configparser
import
change_flags
from
theano.tensor.basic
import
_allclose
from
theano.tensor.nlinalg
import
(
MatrixInverse
,
matrix_inverse
,
pinv
,
SVD
,
AllocDiag
,
alloc_dia
g
,
Ei
g
,
ExtractDiag
,
extract_diag
,
diag
,
trace
,
MatrixInverse
,
TensorInv
,
alloc_diag
,
det
,
Ei
g
,
dia
g
,
eig
,
eigh
,
extract_diag
,
matrix_dot
,
qr
,
matrix_inverse
,
matrix_power
,
norm
,
pinv
,
qr
,
svd
,
SVD
,
TensorInv
,
tensorinv
,
tensorsolve
,
trace
,
)
from
tests
import
unittest_tools
as
utt
def
test_pseudoinverse_correctness
():
rng
=
np
.
random
.
RandomState
(
utt
.
fetch_seed
())
...
...
tests/tensor/test_opt.py
浏览文件 @
a9f0edf3
...
...
@@ -4,13 +4,13 @@ import time
import
numpy
as
np
import
pytest
from
six
import
StringIO
import
theano
import
theano.scalar
as
scal
import
theano.tensor
as
tt
import
theano.tensor.opt
as
opt
from
six
import
StringIO
from
tests
import
unittest_tools
as
utt
from
theano
import
change_flags
,
compile
,
config
,
function
,
gof
,
pprint
,
shared
from
theano.compile
import
DeepCopyOp
,
deep_copy_op
,
get_mode
from
theano.gof
import
FunctionGraph
...
...
@@ -47,12 +47,15 @@ from theano.tensor import (
vectors
,
)
from
theano.tensor.basic
import
_convert_to_int8
from
theano.tensor.blas
import
Dot22
,
Gemv
from
theano.tensor.blas_c
import
CGemv
from
theano.tensor.elemwise
import
DimShuffle
,
Elemwise
,
Prod
from
theano.tensor.nnet.sigm
import
softplus
from
theano.tensor.opt
import
(
Assert
,
assert_op
,
MakeVector
,
Shape_i
,
assert_op
,
local_add_specialize
,
local_canonicalize_alloc
,
local_dimshuffle_lift
,
...
...
@@ -66,11 +69,7 @@ from theano.tensor.opt import (
mul_canonizer
,
)
from
theano.tensor.type
import
values_eq_approx_remove_nan
from
theano.tensor.blas_c
import
CGemv
from
theano.tensor.blas
import
Dot22
,
Gemv
from
theano.tensor.nnet.sigm
import
softplus
from
tests
import
unittest_tools
as
utt
mode_opt
=
theano
.
config
.
mode
if
mode_opt
==
"FAST_COMPILE"
:
...
...
tests/tensor/test_opt_uncanonicalize.py
浏览文件 @
a9f0edf3
import
numpy
as
np
import
theano
from
t
heano
import
function
,
config
from
theano
import
scalar
import
theano.tensor
as
tensor
from
t
ests
import
unittest_tools
as
utt
from
theano
import
config
,
function
,
scalar
from
theano.gof
import
FunctionGraph
from
theano.gof.opt
import
out2in
# from theano.tensor import matrix,max_and_argmax,MaaxAndArgmax,neg
from
theano.tensor.elemwise
import
CAReduce
,
DimShuffle
,
Elemwise
from
theano.tensor.opt_uncanonicalize
import
(
local_alloc_dimshuffle
,
local_reshape_dimshuffle
,
local_dimshuffle_alloc
,
local_dimshuffle_subtensor
,
local_reshape_dimshuffle
,
)
import
theano.tensor
as
tensor
# from theano.tensor import matrix,max_and_argmax,MaaxAndArgmax,neg
from
theano.tensor.elemwise
import
CAReduce
,
Elemwise
,
DimShuffle
from
tests
import
unittest_tools
as
utt
class
TestMaxAndArgmax
:
...
...
tests/tensor/test_raw_random.py
浏览文件 @
a9f0edf3
import
pickle
import
numpy
as
np
import
pytest
import
theano
from
theano
import
tensor
,
compile
,
config
from
tests
import
unittest_tools
as
utt
from
theano
import
compile
,
config
,
tensor
from
theano.tensor
import
dcol
,
dvector
,
ivector
,
raw_random
from
theano.tensor.raw_random
import
(
RandomFunction
,
random_state_type
,
uniform
,
poisson
,
normal
,
binomial
,
choice
,
random_integers
,
multinomial
,
normal
,
permutation
,
permutation_helper
,
poisson
,
random_integers
,
random_state_type
,
uniform
,
)
from
theano.tensor
import
raw_random
,
ivector
,
dvector
,
dcol
from
tests
import
unittest_tools
as
utt
__docformat__
=
"restructuredtext en"
...
...
tests/tensor/test_shared_randomstreams.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
from
theano
import
function
,
shared
,
tensor
,
config
from
theano.tensor.shared_randomstreams
import
RandomStreams
import
pytest
from
tests
import
unittest_tools
as
utt
from
theano
import
config
,
function
,
shared
,
tensor
from
theano.tensor.shared_randomstreams
import
RandomStreams
class
TestSharedRandomStreams
:
...
...
tests/tensor/test_sharedvar.py
浏览文件 @
a9f0edf3
import
pytest
import
six
from
functools
import
update_wrapper
import
numpy
as
np
import
pytest
import
six
import
theano
import
theano.sparse
from
functools
import
update_wrapper
from
tests
import
unittest_tools
as
utt
from
theano
import
tensor
from
theano.misc.may_share_memory
import
may_share_memory
from
tests
import
unittest_tools
as
utt
utt
.
seed_rng
()
...
...
tests/tensor/test_slinalg.py
浏览文件 @
a9f0edf3
import
itertools
import
pytest
import
numpy
as
np
import
numpy.linalg
import
pytest
import
theano
from
theano
import
tensor
,
function
,
grad
,
config
from
tests
import
unittest_tools
as
utt
from
theano
import
config
,
function
,
grad
,
tensor
from
theano.tensor.slinalg
import
(
Cholesky
,
cholesky
,
CholeskyGrad
,
Solve
,
solve
,
cholesky
,
eigvalsh
,
expm
,
kron
,
solve
,
)
from
tests
import
unittest_tools
as
utt
def
check_lower_triangular
(
pd
,
ch_f
):
ch
=
ch_f
(
pd
)
...
...
tests/tensor/test_sort.py
浏览文件 @
a9f0edf3
from
itertools
import
product
,
chain
from
functools
import
reduce
from
tests
import
unittest_tools
as
utt
from
itertools
import
chain
,
product
import
numpy
as
np
import
pytest
import
theano
from
tests
import
unittest_tools
as
utt
from
theano
import
tensor
from
theano.tensor.sort
import
(
ArgSortOp
,
SortOp
,
TopKOp
,
argsort
,
argtopk
,
sort
,
topk
,
topk_and_argtopk
,
)
from
theano.tensor.sort
import
sort
,
SortOp
from
theano.tensor.sort
import
argsort
,
ArgSortOp
from
theano.tensor.sort
import
topk
,
argtopk
,
topk_and_argtopk
,
TopKOp
_all_dtypes
=
tensor
.
integer_dtypes
+
tensor
.
float_dtypes
...
...
tests/tensor/test_subtensor.py
浏览文件 @
a9f0edf3
import
logging
import
sys
import
pytest
import
numpy
as
np
import
pytest
from
numpy.testing
import
assert_array_equal
from
six
import
StringIO
import
theano
import
theano.scalar
as
scal
import
theano.tensor
as
tt
from
numpy.testing
import
assert_array_equal
from
six
import
StringIO
from
theano
import
config
,
change_flags
from
tests
import
unittest_tools
as
utt
from
tests.tensor.test_basic
import
inplace_func
,
rand
,
randint_ranged
from
theano
import
change_flags
,
config
from
theano.compile
import
DeepCopyOp
from
theano.gof.op
import
get_test_value
from
theano.gof.toolbox
import
is_same_graph
...
...
@@ -27,8 +25,8 @@ from theano.tensor import (
dvector
,
fmatrix
,
fscalar
,
fvector
,
ftensor4
,
fvector
,
iscalar
,
lmatrix
,
lrow
,
...
...
@@ -38,27 +36,24 @@ from theano.tensor import (
)
from
theano.tensor.basic
import
DimShuffle
from
theano.tensor.subtensor
import
(
basic_shape
,
indexed_result_shape
,
Subtensor
,
IncSubtensor
,
AdvancedIncSubtensor
,
AdvancedIncSubtensor1
,
AdvancedSubtensor
,
AdvancedSubtensor1
,
IncSubtensor
,
Subtensor
,
advanced_inc_subtensor
,
advanced_inc_subtensor1
,
advanced_set_subtensor
,
advanced_set_subtensor1
,
basic_shape
,
get_canonical_form_slice
,
inc_subtensor
,
indexed_result_shape
,
set_subtensor
,
)
from
theano.tensor.type_other
import
make_slice
from
tests
import
unittest_tools
as
utt
from
tests.tensor.test_basic
import
inplace_func
,
rand
,
randint_ranged
subtensor_ops
=
(
Subtensor
,
...
...
tests/tensor/test_type_other.py
浏览文件 @
a9f0edf3
...
...
@@ -2,7 +2,7 @@
import
theano
from
theano.gof
import
Constant
from
theano.tensor.type_other
import
MakeSlice
,
make_slice
,
NoneTypeT
,
NoneConst
from
theano.tensor.type_other
import
MakeSlice
,
NoneConst
,
NoneTypeT
,
make_slice
def
test_make_slice_merge
():
...
...
@@ -30,6 +30,7 @@ def test_none_Constant():
# This trigger equals that returned the wrong answer in the past.
import
six.moves.cPickle
as
pickle
import
theano
from
theano
import
tensor
...
...
tests/tensor/test_utils.py
浏览文件 @
a9f0edf3
import
pytest
import
numpy
as
np
import
theano
import
pytest
import
theano
from
theano.tensor.utils
import
hash_from_ndarray
,
shape_of_variables
...
...
tests/tensor/test_var.py
浏览文件 @
a9f0edf3
import
numpy
as
np
import
pytest
from
numpy.testing
import
assert_equal
,
assert_string_equal
import
tests.unittest_tools
as
utt
import
theano
import
theano.tensor
as
tt
from
numpy.testing
import
assert_equal
,
assert_string_equal
from
theano.tensor.var
import
TensorConstant
from
theano.tensor.subtensor
import
(
Subtensor
,
AdvancedSubtensor
,
AdvancedSubtensor1
,
)
from
theano.tensor.elemwise
import
DimShuffle
from
theano.tensor.subtensor
import
AdvancedSubtensor
,
AdvancedSubtensor1
,
Subtensor
from
theano.tensor.type_other
import
MakeSlice
import
tests.unittest_tools
as
utt
from
theano.tensor.var
import
TensorConstant
@pytest.mark.parametrize
(
...
...
tests/tensor/test_xlogx.py
浏览文件 @
a9f0edf3
import
theano
import
numpy.random
import
theano
from
tests
import
unittest_tools
as
utt
from
theano.tensor
import
as_tensor_variable
from
theano.tensor.xlogx
import
xlogx
,
xlogy0
from
tests
import
unittest_tools
as
utt
class
TestXlogX
:
def
setup_method
(
self
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论