提交 a9f0edf3 authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Apply isort to tests.tensor sub-package top-level modules

上级 6c8cb50e
# Run using # Run using
# mpiexec -np 2 python _test_mpi_roundtrip.py # mpiexec -np 2 python _test_mpi_roundtrip.py
from sys import exit, stderr, stdout
import numpy as np
from mpi4py import MPI from mpi4py import MPI
import theano import theano
from theano.configparser import change_flags from theano.configparser import change_flags
from theano.tensor.io import send, recv, mpi_cmps
from theano.gof.sched import sort_schedule_fn from theano.gof.sched import sort_schedule_fn
import numpy as np from theano.tensor.io import mpi_cmps, recv, send
from sys import stdout, stderr, exit
comm = MPI.COMM_WORLD comm = MPI.COMM_WORLD
......
import builtins
import itertools import itertools
import operator import operator
import os import os
import warnings import warnings
import builtins from copy import copy, deepcopy
from functools import partial, reduce
import pytest from tempfile import mkstemp
import numpy as np import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal, assert_array_equal
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from tests import unittest_tools as utt
from tempfile import mkstemp from theano import change_flags, compile, config, function, gof, shared
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 theano.compat import operator_div from theano.compat import operator_div
from theano import compile, config, function, gof, shared
from theano.compile import DeepCopyOp from theano.compile import DeepCopyOp
from theano.compile.mode import get_default_mode 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 ( from theano.tensor import (
wvector, Alloc,
bvector, AllocDiag,
argmin, AllocEmpty,
max_and_argmax, ARange,
cscalar, Argmax,
join, Choose,
horizontal_stack, DimShuffle,
vertical_stack, Dot,
argmax, ExtractDiag,
get_vector_length, Eye,
fscalar, Join,
sum, MaxAndArgmax,
tensor3, Mean,
vector, NoneConst,
PermuteRowElements,
Rebroadcast,
Reshape,
ScalarFromTensor,
Shape,
SpecifyShape,
Split,
Tensor,
TensorFromScalar,
TensorType,
Tile,
Tri,
add, add,
addbroadcast, addbroadcast,
allclose,
alloc, alloc,
arange,
argmax,
argmin,
as_tensor_variable, as_tensor_variable,
tensor_from_scalar, batched_dot,
ARange, bvector,
choose,
clip, clip,
constant, constant,
cscalar,
default, default,
diag, diag,
dot,
batched_dot,
dmatrix, dmatrix,
dot,
dscalar, dscalar,
dscalars,
dtensor3,
dtensor4,
dvector, dvector,
eq, eq,
exp,
extract_constant,
eye, eye,
fill, fill,
flatnonzero,
flatten, flatten,
inverse_permutation,
tensor4,
permute_row_elements,
fmatrix, fmatrix,
fscalar,
fscalars, fscalars,
fvector,
get_scalar_constant_value,
get_vector_length,
grad, grad,
hessian,
horizontal_stack,
imatrix,
inplace, inplace,
inverse_permutation,
iscalar, iscalar,
matrix, iscalars,
minimum, isclose,
itensor3,
ivector,
join,
lscalar,
lvector,
matrices, matrices,
matrix,
max,
max_and_argmax,
maximum, maximum,
mgrid,
min,
minimum,
mul, mul,
neq, neq,
Reshape, nonzero,
nonzero_values,
numeric_grad,
ogrid,
opt,
patternbroadcast,
permute_row_elements,
power,
ptp,
reshape,
roll,
row, row,
scal,
scalar, scalar,
scalar_from_tensor,
scalars, scalars,
second, second,
shape,
smallest, smallest,
stack, stack,
stacklists,
sub, sub,
Tensor, sum,
swapaxes,
switch,
tensor3,
tensor4,
tensor_copy, tensor_copy,
tensor_from_scalar,
tensordot, tensordot,
TensorType, tile,
Tri,
tri, tri,
tril, tril,
triu, triu,
true_div,
unbroadcast, unbroadcast,
var, var,
Argmax, vector,
Join, vertical_stack,
shape, wvector,
MaxAndArgmax,
lscalar,
zvector, 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 imported_scipy_special = False
mode_no_scipy = get_default_mode() mode_no_scipy = get_default_mode()
......
import pytest
import numpy as np
import theano
import theano.tensor as tt
import theano.tensor.blas_scipy
from copy import copy from copy import copy
from itertools import product from itertools import product
import numpy as np
import pytest
from numpy import ( from numpy import (
arange, arange,
array, array,
...@@ -25,38 +18,40 @@ from numpy import ( ...@@ -25,38 +18,40 @@ from numpy import (
) )
from numpy.testing import assert_array_almost_equal 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 ( from theano.tensor.blas import (
Dot22,
Dot22Scalar,
Gemm,
Gemv,
Ger,
InconsistencyError,
_as_scalar,
_dot22, _dot22,
_dot22scalar, _dot22scalar,
res_is_a,
_as_scalar,
_is_real_matrix,
_gemm_canonicalize,
_factor_canonicalized, _factor_canonicalized,
Gemm, _gemm_canonicalize,
Gemv, _is_real_matrix,
gemm,
gemm_inplace, gemm_inplace,
gemm_no_inplace, gemm_no_inplace,
InconsistencyError, gemv,
Ger, gemv_inplace,
gemv_no_inplace,
ger, ger,
ger_destructive, ger_destructive,
Dot22,
Dot22Scalar,
gemm,
local_dot22_to_dot22scalar, local_dot22_to_dot22scalar,
gemv_no_inplace,
gemv,
gemv_inplace,
local_gemm_to_ger, local_gemm_to_ger,
res_is_a,
) )
from theano.tensor.nnet import sigmoid from theano.tensor.nnet import sigmoid
from theano.tensor.opt import in2out 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": if config.mode == "FAST_COMPILE":
mode_not_fast_compile = "FAST_RUN" mode_not_fast_compile = "FAST_RUN"
......
import sys import sys
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
import theano.tensor as tensor 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 import Ger
from theano.tensor.blas_c import CGer from theano.tensor.blas_c import CGemv, CGer, check_force_gemv_init
from theano.tensor.blas_scipy import ScipyGer 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( mode_blas_opt = theano.compile.get_default_mode().including(
"BlasOpt", "specialize", "InplaceBlasOpt", "c_blas" "BlasOpt", "specialize", "InplaceBlasOpt", "c_blas"
......
import numpy as np import numpy as np
import pytest import pytest
import theano import theano
import theano.tensor as tensor import theano.tensor as tensor
from tests.tensor.test_blas import TestBlasStrides, gemm_no_inplace
from theano.tensor.blas_scipy import ScipyGer
from tests.unittest_tools import OptimizationTestMixin from tests.unittest_tools import OptimizationTestMixin
from tests.tensor.test_blas import gemm_no_inplace, TestBlasStrides from theano.tensor.blas_scipy import ScipyGer
@pytest.mark.skipif(not theano.tensor.blas_scipy.have_fblas, reason="fblas needed") @pytest.mark.skipif(not theano.tensor.blas_scipy.have_fblas, reason="fblas needed")
......
import numpy as np import numpy as np
import theano import theano
import theano.tensor.basic as basic import theano.tensor.basic as basic
from theano import function from theano import function
from theano.tensor.basic import ( from theano.compile import In
_convert_to_int32,
_convert_to_int8,
_convert_to_int16,
_convert_to_int64,
_convert_to_float32,
_convert_to_float64,
)
from theano.tensor import ( from theano.tensor import (
TensorType,
bvector, bvector,
ivector,
fvector,
dvector,
zmatrix,
cast, cast,
TensorType,
dmatrix, 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: class TestCasting:
......
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
from tests import unittest_tools as utt
from theano.tensor import ( from theano.tensor import (
real,
imag,
zvector,
dvector,
cast, cast,
complex,
complex_from_polar,
cvector,
dvector,
fmatrix, fmatrix,
fvector, fvector,
cvector, imag,
imatrix, imatrix,
complex, real,
complex_from_polar, zvector,
) )
from tests import unittest_tools as utt
class TestRealImag: class TestRealImag:
def test_basic(self): def test_basic(self):
......
import math import math
from copy import copy
import six.moves.cPickle as pickle
import pytest
import numpy as np import numpy as np
import pytest
import six.moves.cPickle as pickle
import tests.unittest_tools as utt
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from tests import unittest_tools
import tests.unittest_tools as utt from theano import config, gof, scalar
from theano.compile.mode import Mode, get_default_mode
from copy import copy
from theano import gof, scalar, config
from theano.tensor import TensorType, as_tensor_variable from theano.tensor import TensorType, as_tensor_variable
from theano.compile.mode import get_default_mode, Mode
from theano.tensor.elemwise import ( from theano.tensor.elemwise import (
CAReduce, CAReduce,
Elemwise,
DimShuffle, DimShuffle,
Elemwise,
Prod, Prod,
ProdWithoutZeros, ProdWithoutZeros,
Sum, Sum,
) )
from theano.tensor.type import values_eq_approx_remove_nan
from theano.tensor.nnet import sigmoid from theano.tensor.nnet import sigmoid
from theano.tensor.type import values_eq_approx_remove_nan
from tests import unittest_tools
def FunctionGraph(i, o): def FunctionGraph(i, o):
......
import pytest
import numpy as np import numpy as np
import pytest
import theano 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 ( from theano.tensor.extra_ops import (
SearchsortedOp, Bartlett,
searchsorted,
CumOp,
cumsum,
cumprod,
CpuContiguous, CpuContiguous,
cpu_contiguous, CumOp,
bincount,
DiffOp, DiffOp,
diff, FillDiagonal,
squeeze, FillDiagonalOffset,
compress, RavelMultiIndex,
RepeatOp, RepeatOp,
repeat, SearchsortedOp,
Bartlett, Unique,
UnravelIndex,
bartlett, bartlett,
FillDiagonal, bincount,
broadcast_shape,
compress,
cpu_contiguous,
cumprod,
cumsum,
diff,
fill_diagonal, fill_diagonal,
FillDiagonalOffset,
fill_diagonal_offset, fill_diagonal_offset,
ravel_multi_index,
repeat,
searchsorted,
squeeze,
to_one_hot, to_one_hot,
Unique,
unravel_index, 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(): def test_cpu_contiguous():
......
...@@ -3,10 +3,8 @@ import pytest ...@@ -3,10 +3,8 @@ import pytest
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from theano.tensor import fft
from tests import unittest_tools as utt from tests import unittest_tools as utt
from theano.tensor import fft
N = 16 N = 16
......
import pytest
import numpy as np import numpy as np
import pytest
import theano import theano
from tests import unittest_tools as utt
from theano import tensor from theano import tensor
from theano.tensor.fourier import Fourier, fft from theano.tensor.fourier import Fourier, fft
from tests import unittest_tools as utt
class TestFourier(utt.InferShapeTester): class TestFourier(utt.InferShapeTester):
......
import time import time
import six.moves.cPickle as pickle
import numpy as np import numpy as np
import six.moves.cPickle as pickle
import theano import theano
import theano.tensor as tt import theano.tensor as tt
......
import numpy as np import numpy as np
import pytest import pytest
import theano import theano
import theano.tensor as tt import theano.tensor as tt
from tests import unittest_tools as utt from tests import unittest_tools as utt
......
import theano
import pytest
from theano import tensor, function, Variable, Generic
import numpy as np
import os import os
import numpy as np
import pytest
import theano
from theano import Generic, Variable, function, tensor
class TestLoadTensor: class TestLoadTensor:
def setup_method(self): def setup_method(self):
......
...@@ -3,7 +3,7 @@ import pytest ...@@ -3,7 +3,7 @@ import pytest
from six import integer_types from six import integer_types
import theano import theano
from theano import tensor, function from theano import function, tensor
# this tests other ops to ensure they keep the dimensions of their # this tests other ops to ensure they keep the dimensions of their
......
import numpy as np import numpy as np
import theano.tensor.basic as tt
from theano.gof.type import Type import theano.tensor.basic as tt
from theano.gof.graph import Variable, Apply from theano.gof.fg import FunctionGraph
from theano.gof.graph import Apply, Variable
from theano.gof.op import Op from theano.gof.op import Op
from theano.gof.opt import MergeOptimizer from theano.gof.opt import MergeOptimizer
from theano.gof.fg import FunctionGraph from theano.gof.type import Type
def is_variable(x): def is_variable(x):
......
import copy import copy
import numpy as np import numpy as np
import theano import theano
from theano import tensor from theano import tensor
from theano.tensor.nnet import crossentropy_softmax_argmax_1hot_with_bias from theano.tensor.nnet import crossentropy_softmax_argmax_1hot_with_bias
......
import os import os
import subprocess import subprocess
import pytest import pytest
import theano import theano
from theano import change_flags from theano import change_flags
from theano.gof.sched import sort_schedule_fn from theano.gof.sched import sort_schedule_fn
from theano.tensor.io import ( from theano.tensor.io import (
send,
recv,
mpi_cmps,
MPISend, MPISend,
MPISendWait, MPISendWait,
mpi_send_wait_cmp, mpi_cmps,
mpi_enabled, mpi_enabled,
mpi_send_wait_cmp,
recv,
send,
) )
mpi_scheduler = sort_schedule_fn(*mpi_cmps) mpi_scheduler = sort_schedule_fn(*mpi_cmps)
mpi_linker = theano.OpWiseCLinker(schedule=mpi_scheduler) mpi_linker = theano.OpWiseCLinker(schedule=mpi_scheduler)
mpi_mode = theano.Mode(linker=mpi_linker) mpi_mode = theano.Mode(linker=mpi_linker)
......
import pytest
import numpy as np import numpy as np
import numpy.linalg import numpy.linalg
import theano import pytest
from numpy import inf from numpy import inf
from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_almost_equal
from theano import tensor, function import theano
from theano.tensor.basic import _allclose from tests import unittest_tools as utt
from theano import config from theano import config, function, tensor
from theano.configparser import change_flags from theano.configparser import change_flags
from theano.tensor.basic import _allclose
from theano.tensor.nlinalg import ( from theano.tensor.nlinalg import (
MatrixInverse, SVD,
matrix_inverse,
pinv,
AllocDiag, AllocDiag,
alloc_diag, Eig,
ExtractDiag, ExtractDiag,
extract_diag, MatrixInverse,
diag, TensorInv,
trace, alloc_diag,
det, det,
Eig, diag,
eig, eig,
eigh, eigh,
extract_diag,
matrix_dot, matrix_dot,
qr, matrix_inverse,
matrix_power, matrix_power,
norm, norm,
pinv,
qr,
svd, svd,
SVD,
TensorInv,
tensorinv, tensorinv,
tensorsolve, tensorsolve,
trace,
) )
from tests import unittest_tools as utt
def test_pseudoinverse_correctness(): def test_pseudoinverse_correctness():
rng = np.random.RandomState(utt.fetch_seed()) rng = np.random.RandomState(utt.fetch_seed())
......
...@@ -4,13 +4,13 @@ import time ...@@ -4,13 +4,13 @@ import time
import numpy as np import numpy as np
import pytest import pytest
from six import StringIO
import theano import theano
import theano.scalar as scal import theano.scalar as scal
import theano.tensor as tt import theano.tensor as tt
import theano.tensor.opt as opt import theano.tensor.opt as opt
from tests import unittest_tools as utt
from six import StringIO
from theano import change_flags, compile, config, function, gof, pprint, shared from theano import change_flags, compile, config, function, gof, pprint, shared
from theano.compile import DeepCopyOp, deep_copy_op, get_mode from theano.compile import DeepCopyOp, deep_copy_op, get_mode
from theano.gof import FunctionGraph from theano.gof import FunctionGraph
...@@ -47,12 +47,15 @@ from theano.tensor import ( ...@@ -47,12 +47,15 @@ from theano.tensor import (
vectors, vectors,
) )
from theano.tensor.basic import _convert_to_int8 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.elemwise import DimShuffle, Elemwise, Prod
from theano.tensor.nnet.sigm import softplus
from theano.tensor.opt import ( from theano.tensor.opt import (
Assert, Assert,
assert_op,
MakeVector, MakeVector,
Shape_i, Shape_i,
assert_op,
local_add_specialize, local_add_specialize,
local_canonicalize_alloc, local_canonicalize_alloc,
local_dimshuffle_lift, local_dimshuffle_lift,
...@@ -66,11 +69,7 @@ from theano.tensor.opt import ( ...@@ -66,11 +69,7 @@ from theano.tensor.opt import (
mul_canonizer, mul_canonizer,
) )
from theano.tensor.type import values_eq_approx_remove_nan 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 mode_opt = theano.config.mode
if mode_opt == "FAST_COMPILE": if mode_opt == "FAST_COMPILE":
......
import numpy as np import numpy as np
import theano import theano
import theano.tensor as tensor
from theano import function, config from tests import unittest_tools as utt
from theano import scalar from theano import config, function, scalar
from theano.gof import FunctionGraph from theano.gof import FunctionGraph
from theano.gof.opt import out2in 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 ( from theano.tensor.opt_uncanonicalize import (
local_alloc_dimshuffle, local_alloc_dimshuffle,
local_reshape_dimshuffle,
local_dimshuffle_alloc, local_dimshuffle_alloc,
local_dimshuffle_subtensor, 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: class TestMaxAndArgmax:
......
import pickle import pickle
import numpy as np import numpy as np
import pytest import pytest
import theano import theano
from tests import unittest_tools as utt
from theano import tensor, compile, config from theano import compile, config, tensor
from theano.tensor import dcol, dvector, ivector, raw_random
from theano.tensor.raw_random import ( from theano.tensor.raw_random import (
RandomFunction, RandomFunction,
random_state_type,
uniform,
poisson,
normal,
binomial, binomial,
choice, choice,
random_integers,
multinomial, multinomial,
normal,
permutation, permutation,
permutation_helper, 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" __docformat__ = "restructuredtext en"
......
import pytest
import numpy as np import numpy as np
import pytest
from theano import function, shared, tensor, config
from theano.tensor.shared_randomstreams import RandomStreams
from tests import unittest_tools as utt from tests import unittest_tools as utt
from theano import config, function, shared, tensor
from theano.tensor.shared_randomstreams import RandomStreams
class TestSharedRandomStreams: class TestSharedRandomStreams:
......
import pytest from functools import update_wrapper
import six
import numpy as np import numpy as np
import pytest
import six
import theano import theano
import theano.sparse import theano.sparse
from tests import unittest_tools as utt
from functools import update_wrapper
from theano import tensor from theano import tensor
from theano.misc.may_share_memory import may_share_memory from theano.misc.may_share_memory import may_share_memory
from tests import unittest_tools as utt
utt.seed_rng() utt.seed_rng()
......
import itertools import itertools
import pytest
import numpy as np import numpy as np
import numpy.linalg import numpy.linalg
import pytest
import theano import theano
from tests import unittest_tools as utt
from theano import tensor, function, grad, config from theano import config, function, grad, tensor
from theano.tensor.slinalg import ( from theano.tensor.slinalg import (
Cholesky, Cholesky,
cholesky,
CholeskyGrad, CholeskyGrad,
Solve, Solve,
solve, cholesky,
eigvalsh, eigvalsh,
expm, expm,
kron, kron,
solve,
) )
from tests import unittest_tools as utt
def check_lower_triangular(pd, ch_f): def check_lower_triangular(pd, ch_f):
ch = ch_f(pd) ch = ch_f(pd)
......
from itertools import product, chain
from functools import reduce from functools import reduce
from itertools import chain, product
from tests import unittest_tools as utt
import numpy as np import numpy as np
import pytest import pytest
import theano import theano
from tests import unittest_tools as utt
from theano import tensor 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 _all_dtypes = tensor.integer_dtypes + tensor.float_dtypes
......
import logging import logging
import sys import sys
import pytest
import numpy as np import numpy as np
import pytest
from numpy.testing import assert_array_equal
from six import StringIO
import theano import theano
import theano.scalar as scal import theano.scalar as scal
import theano.tensor as tt import theano.tensor as tt
from tests import unittest_tools as utt
from numpy.testing import assert_array_equal from tests.tensor.test_basic import inplace_func, rand, randint_ranged
from theano import change_flags, config
from six import StringIO
from theano import config, change_flags
from theano.compile import DeepCopyOp from theano.compile import DeepCopyOp
from theano.gof.op import get_test_value from theano.gof.op import get_test_value
from theano.gof.toolbox import is_same_graph from theano.gof.toolbox import is_same_graph
...@@ -27,8 +25,8 @@ from theano.tensor import ( ...@@ -27,8 +25,8 @@ from theano.tensor import (
dvector, dvector,
fmatrix, fmatrix,
fscalar, fscalar,
fvector,
ftensor4, ftensor4,
fvector,
iscalar, iscalar,
lmatrix, lmatrix,
lrow, lrow,
...@@ -38,27 +36,24 @@ from theano.tensor import ( ...@@ -38,27 +36,24 @@ from theano.tensor import (
) )
from theano.tensor.basic import DimShuffle from theano.tensor.basic import DimShuffle
from theano.tensor.subtensor import ( from theano.tensor.subtensor import (
basic_shape,
indexed_result_shape,
Subtensor,
IncSubtensor,
AdvancedIncSubtensor, AdvancedIncSubtensor,
AdvancedIncSubtensor1, AdvancedIncSubtensor1,
AdvancedSubtensor, AdvancedSubtensor,
AdvancedSubtensor1, AdvancedSubtensor1,
IncSubtensor,
Subtensor,
advanced_inc_subtensor, advanced_inc_subtensor,
advanced_inc_subtensor1, advanced_inc_subtensor1,
advanced_set_subtensor, advanced_set_subtensor,
advanced_set_subtensor1, advanced_set_subtensor1,
basic_shape,
get_canonical_form_slice, get_canonical_form_slice,
inc_subtensor, inc_subtensor,
indexed_result_shape,
set_subtensor, set_subtensor,
) )
from theano.tensor.type_other import make_slice 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_ops = (
Subtensor, Subtensor,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import theano import theano
from theano.gof import Constant 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(): def test_make_slice_merge():
...@@ -30,6 +30,7 @@ def test_none_Constant(): ...@@ -30,6 +30,7 @@ def test_none_Constant():
# This trigger equals that returned the wrong answer in the past. # This trigger equals that returned the wrong answer in the past.
import six.moves.cPickle as pickle import six.moves.cPickle as pickle
import theano import theano
from theano import tensor from theano import tensor
......
import pytest
import numpy as np import numpy as np
import theano import pytest
import theano
from theano.tensor.utils import hash_from_ndarray, shape_of_variables from theano.tensor.utils import hash_from_ndarray, shape_of_variables
......
import numpy as np import numpy as np
import pytest import pytest
from numpy.testing import assert_equal, assert_string_equal
import tests.unittest_tools as utt
import theano import theano
import theano.tensor as tt 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.elemwise import DimShuffle
from theano.tensor.subtensor import AdvancedSubtensor, AdvancedSubtensor1, Subtensor
from theano.tensor.type_other import MakeSlice from theano.tensor.type_other import MakeSlice
from theano.tensor.var import TensorConstant
import tests.unittest_tools as utt
@pytest.mark.parametrize( @pytest.mark.parametrize(
......
import theano
import numpy.random import numpy.random
import theano
from tests import unittest_tools as utt
from theano.tensor import as_tensor_variable from theano.tensor import as_tensor_variable
from theano.tensor.xlogx import xlogx, xlogy0 from theano.tensor.xlogx import xlogx, xlogy0
from tests import unittest_tools as utt
class TestXlogX: class TestXlogX:
def setup_method(self): def setup_method(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论