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

Apply isort to theano.sparse sub-package modules

上级 c0b324fa
import sys import sys
try: try:
import scipy import scipy
...@@ -19,8 +20,8 @@ except ImportError: ...@@ -19,8 +20,8 @@ except ImportError:
from theano.sparse.type import * from theano.sparse.type import *
if enable_sparse: if enable_sparse:
from theano.sparse import opt, sharedvar
from theano.sparse.basic import * from theano.sparse.basic import *
from theano.sparse import opt
from theano.sparse import sharedvar
from theano.sparse.sharedvar import sparse_constructor as shared from theano.sparse.sharedvar import sparse_constructor as shared
...@@ -13,17 +13,16 @@ http://www-users.cs.umn.edu/~saad/software/SPARSKIT/paper.ps ...@@ -13,17 +13,16 @@ http://www-users.cs.umn.edu/~saad/software/SPARSKIT/paper.ps
import sys import sys
import numpy as np import numpy as np
import scipy.sparse
from numpy.lib.stride_tricks import as_strided from numpy.lib.stride_tricks import as_strided
from six import integer_types from six import integer_types
import scipy.sparse
import theano import theano
from theano import gof, tensor, scalar, config from theano import config, gof, scalar, tensor
from theano.gradient import DisconnectedType from theano.gradient import DisconnectedType, grad_not_implemented, grad_undefined
from theano.sparse.utils import hash_from_sparse
from theano.gradient import grad_not_implemented, grad_undefined
from theano.sparse.type import SparseType, _is_sparse from theano.sparse.type import SparseType, _is_sparse
from theano.sparse.utils import hash_from_sparse
sparse_formats = ["csc", "csr"] sparse_formats = ["csc", "csr"]
......
...@@ -3,20 +3,20 @@ import scipy ...@@ -3,20 +3,20 @@ import scipy
import theano import theano
from theano import gof, scalar, tensor from theano import gof, scalar, tensor
from theano.sparse import basic as sparse
from theano.tensor import blas from theano.sparse.basic import (
from theano.tensor.opt import register_specialize, register_canonicalize
from theano.sparse import (
CSC, CSC,
CSR, CSR,
csm_properties, csm_data,
csm_grad, csm_grad,
usmm,
csm_indices, csm_indices,
csm_indptr, csm_indptr,
csm_data, csm_properties,
usmm,
) )
from theano.sparse import basic as sparse from theano.tensor import blas
from theano.tensor.opt import register_canonicalize, register_specialize
_is_sparse_variable = sparse._is_sparse_variable _is_sparse_variable = sparse._is_sparse_variable
_is_dense = sparse._is_dense _is_dense = sparse._is_dense
......
...@@ -11,10 +11,9 @@ U{http://www-users.cs.umn.edu/~saad/software/SPARSKIT/paper.ps}. ...@@ -11,10 +11,9 @@ U{http://www-users.cs.umn.edu/~saad/software/SPARSKIT/paper.ps}.
import numpy as np import numpy as np
from scipy import sparse as scipy_sparse from scipy import sparse as scipy_sparse
import theano import theano
import theano.sparse import theano.sparse
from theano import sparse, Op, tensor from theano import Op, sparse, tensor
def register_specialize(lopt, *tags, **kwargs): def register_specialize(lopt, *tags, **kwargs):
......
import numpy as np import numpy as np
import theano
import scipy.sparse import scipy.sparse
import theano
from theano import gof, tensor from theano import gof, tensor
from theano.tensor import discrete_dtypes, float_dtypes from theano.sparse.basic import ( # To maintain compatibility
from theano.tensor.opt import register_specialize
from theano.sparse.basic import (
as_sparse_variable,
SparseType,
add_s_s,
neg,
mul_s_s,
mul_s_d,
dot,
CSMProperties,
CSM,
_is_sparse_variable,
_is_dense_variable,
CSC, CSC,
CSM,
CSR, CSR,
csm_properties, AddSSData,
Cast,
CSMProperties,
HStack,
MulSV,
Remove0,
SamplingDot,
SparseType,
StructuredAddSV,
VStack,
_is_dense_variable,
_is_sparse,
_is_sparse_variable,
add_s_s,
add_s_s_data,
as_sparse_variable,
bcast,
ccast,
csm_data, csm_data,
csm_indices, csm_indices,
csm_indptr, csm_indptr,
csm_properties,
csm_shape, csm_shape,
_is_sparse,
# To maintain compatibility
Remove0,
remove0,
Cast,
bcast,
wcast,
icast,
lcast,
fcast,
dcast, dcast,
ccast, dot,
zcast, fcast,
HStack,
hstack, hstack,
VStack, icast,
vstack, lcast,
AddSSData, mul_s_d,
add_s_s_data, mul_s_s,
MulSV,
mul_s_v, mul_s_v,
structured_monoid, neg,
structured_sigmoid, remove0,
sampling_dot,
structured_add,
structured_add_s_v,
structured_exp, structured_exp,
structured_log, structured_log,
structured_pow,
structured_minimum,
structured_maximum, structured_maximum,
structured_add, structured_minimum,
StructuredAddSV, structured_monoid,
structured_add_s_v, structured_pow,
SamplingDot, structured_sigmoid,
sampling_dot, vstack,
wcast,
zcast,
) )
# Probability Ops are currently back in sandbox, because they do not respect
# Theano's Op contract, as their behaviour is not reproducible: calling
# the perform() method twice with the same argument will yield different
# results.
# from theano.sparse.basic import (
# Multinomial, multinomial, Poisson, poisson,
# Binomial, csr_fbinomial, csc_fbinomial, csr_dbinomial, csc_dbinomial)
# Also for compatibility # Also for compatibility
from theano.sparse.opt import ( from theano.sparse.opt import (
MulSDCSC, MulSDCSC,
mul_s_d_csc,
MulSDCSR, MulSDCSR,
mul_s_d_csr,
MulSVCSR, MulSVCSR,
mul_s_v_csr,
StructuredAddSVCSR,
structured_add_s_v_csr,
SamplingDotCSR, SamplingDotCSR,
sampling_dot_csr, StructuredAddSVCSR,
local_mul_s_d, local_mul_s_d,
local_mul_s_v, local_mul_s_v,
local_structured_add_s_v,
local_sampling_dot_csr, local_sampling_dot_csr,
local_structured_add_s_v,
mul_s_d_csc,
mul_s_d_csr,
mul_s_v_csr,
sampling_dot_csr,
structured_add_s_v_csr,
) )
from theano.tensor import discrete_dtypes, float_dtypes
from theano.tensor.opt import register_specialize
# Probability Ops are currently back in sandbox, because they do not respect
# Theano's Op contract, as their behaviour is not reproducible: calling
# the perform() method twice with the same argument will yield different
# results.
# from theano.sparse.basic import (
# Multinomial, multinomial, Poisson, poisson,
# Binomial, csr_fbinomial, csc_fbinomial, csr_dbinomial, csc_dbinomial)
# Alias to maintain compatibility # Alias to maintain compatibility
......
import copy import copy
import scipy.sparse import scipy.sparse
from theano.compile import shared_constructor, SharedVariable
from theano.compile import SharedVariable, shared_constructor
from theano.sparse.basic import SparseType, _sparse_py_operators from theano.sparse.basic import SparseType, _sparse_py_operators
......
import numpy as np import numpy as np
try: try:
import scipy.sparse import scipy.sparse
...@@ -7,9 +8,10 @@ try: ...@@ -7,9 +8,10 @@ try:
except ImportError: except ImportError:
imported_scipy = False imported_scipy = False
from six import string_types
import theano import theano
from theano import gof from theano import gof
from six import string_types
def _is_sparse(x): def _is_sparse(x):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论