提交 cb795385 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #3804 from nouiz/tests

[BUG] in python code and tests fix
...@@ -2043,7 +2043,7 @@ class _Linker(gof.link.LocalLinker): ...@@ -2043,7 +2043,7 @@ class _Linker(gof.link.LocalLinker):
"output storage", i) "output storage", i)
try: try:
thunk_py() thunk_py()
except utils.MethodNotDefined: except (utils.MethodNotDefined, NotImplementedError):
# shouldn't have put it into the list in # shouldn't have put it into the list in
# the first place # the first place
thunk_py = None thunk_py = None
......
...@@ -172,13 +172,12 @@ class MultinomialFromUniform(Op): ...@@ -172,13 +172,12 @@ class MultinomialFromUniform(Op):
nb_multi = pvals.shape[0] nb_multi = pvals.shape[0]
nb_outcomes = pvals.shape[1] nb_outcomes = pvals.shape[1]
# For each multinomial, loop over each possible outcome # For each multinomial, loop over each possible outcome
for c in range(n_samples): for c in range(n_samples):
for n in range(nb_multi): for n in range(nb_multi):
waiting = True waiting = True
cummul = 0 cummul = 0
unis_n = unis[n] unis_n = unis[c * nb_multi + n]
for m in range(nb_outcomes): for m in range(nb_outcomes):
cummul += pvals[n, m] cummul += pvals[n, m]
......
...@@ -8,11 +8,11 @@ from theano.sandbox import multinomial ...@@ -8,11 +8,11 @@ from theano.sandbox import multinomial
from theano.compile.mode import get_default_mode, predefined_linkers from theano.compile.mode import get_default_mode, predefined_linkers
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
import theano.tests.unittest_tools as utt import theano.tests.unittest_tools as utt
import six.moves.cPickle as pickle
import os import os
from theano.compat import PY3 from theano.compat import PY3
from theano.misc.pkl_utils import CompatUnpickler from theano.misc.pkl_utils import CompatUnpickler
def get_mode(gpu): def get_mode(gpu):
mode = get_default_mode() mode = get_default_mode()
mode = copy.copy(mode) mode = copy.copy(mode)
...@@ -42,9 +42,9 @@ def test_n_samples_1(): ...@@ -42,9 +42,9 @@ def test_n_samples_1():
numpy.random.seed(12345) numpy.random.seed(12345)
for i in [1, 5, 10, 100, 1000, 10000]: for i in [1, 5, 10, 100, 1000, 10000]:
uni = numpy.random.rand(2*i).astype(config.floatX) uni = numpy.random.rand(2 * i).astype(config.floatX)
res = f([[1.0, 0.0], [0.0, 1.0]], uni, i) res = f([[1.0, 0.0], [0.0, 1.0]], uni, i)
utt.assert_allclose(res, [[i*1.0, 0.0], [0.0, i*1.0]]) utt.assert_allclose(res, [[i * 1.0, 0.0], [0.0, i * 1.0]])
def test_n_samples_2(): def test_n_samples_2():
...@@ -58,18 +58,20 @@ def test_n_samples_2(): ...@@ -58,18 +58,20 @@ def test_n_samples_2():
numpy.random.seed(12345) numpy.random.seed(12345)
for i in [1, 5, 10, 100, 1000]: for i in [1, 5, 10, 100, 1000]:
uni = numpy.random.rand(i).astype(config.floatX) uni = numpy.random.rand(i).astype(config.floatX)
pvals = numpy.random.randint(1,1000,(1,1000)).astype(config.floatX) pvals = numpy.random.randint(1, 1000, (1, 1000)).astype(config.floatX)
pvals /= pvals.sum(1) pvals /= pvals.sum(1)
res = f(pvals, uni, i) res = f(pvals, uni, i)
assert res.sum() == i assert res.sum() == i
for i in [1, 5, 10, 100, 1000]: for i in [1, 5, 10, 100, 1000]:
uni = numpy.random.rand(i).astype(config.floatX) uni = numpy.random.rand(i).astype(config.floatX)
pvals = numpy.random.randint(1,1000000,(1,1000000)).astype(config.floatX) pvals = numpy.random.randint(
1, 1000000, (1, 1000000)).astype(config.floatX)
pvals /= pvals.sum(1) pvals /= pvals.sum(1)
res = f(pvals, uni, i) res = f(pvals, uni, i)
assert res.sum() == i assert res.sum() == i
def test_n_samples_compatibility(): def test_n_samples_compatibility():
""" """
This test checks if the new change to MultinomialFromUniform is still compatible This test checks if the new change to MultinomialFromUniform is still compatible
...@@ -83,16 +85,18 @@ def test_n_samples_compatibility(): ...@@ -83,16 +85,18 @@ def test_n_samples_compatibility():
pickle.dump([X, samples], open("multinomial_test_graph.pkl", "w")) pickle.dump([X, samples], open("multinomial_test_graph.pkl", "w"))
""" """
folder = os.path.dirname(os.path.abspath(__file__)) folder = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(folder, "multinomial_test_graph.pkl"), "rb") as pkl_file: with open(os.path.join(folder, "multinomial_test_graph.pkl"),
"rb") as pkl_file:
if PY3: if PY3:
u = CompatUnpickler(pkl_file, encoding="latin1") u = CompatUnpickler(pkl_file, encoding="latin1")
else: else:
u = CompatUnpickler(pkl_file) u = CompatUnpickler(pkl_file)
X, samples = u.load() X, samples = u.load()
f = theano.function([X], samples) f = theano.function([X], samples)
res = f(numpy.random.randn(20,10)) res = f(numpy.random.randn(20, 10))
assert numpy.all(res.sum(axis=1) == 1) assert numpy.all(res.sum(axis=1) == 1)
def test_multinomial_0(): def test_multinomial_0():
# This tests the MultinomialFromUniform Op directly, not going through the # This tests the MultinomialFromUniform Op directly, not going through the
# multinomial() call in GPU random generation. # multinomial() call in GPU random generation.
...@@ -104,7 +108,7 @@ def test_multinomial_0(): ...@@ -104,7 +108,7 @@ def test_multinomial_0():
def body(mode, gpu): def body(mode, gpu):
# the m*2 allows the multinomial to reuse output # the m*2 allows the multinomial to reuse output
f = function([p, u], m*2, allow_input_downcast=True, mode=mode) f = function([p, u], m * 2, allow_input_downcast=True, mode=mode)
if gpu: if gpu:
assert any([type(node.op) is multinomial.GpuMultinomialFromUniform assert any([type(node.op) is multinomial.GpuMultinomialFromUniform
...@@ -140,12 +144,12 @@ def test_multinomial_large(): ...@@ -140,12 +144,12 @@ def test_multinomial_large():
p = tensor.fmatrix() p = tensor.fmatrix()
u = tensor.fvector() u = tensor.fvector()
m = multinomial.MultinomialFromUniform('auto')(p, u) m = multinomial.MultinomialFromUniform('auto')(p, u)
f = function([p, u], m*2, allow_input_downcast=True, mode=mode) f = function([p, u], m * 2, allow_input_downcast=True, mode=mode)
if gpu: if gpu:
assert any([type(node.op) is multinomial.GpuMultinomialFromUniform assert any([type(node.op) is multinomial.GpuMultinomialFromUniform
for node in f.maker.fgraph.toposort()]) for node in f.maker.fgraph.toposort()])
pval = numpy.arange(10000 * 4, dtype='float32').reshape((10000, 4))+0.1 pval = numpy.arange(10000 * 4, dtype='float32').reshape((10000, 4)) + 0.1
pval = pval / pval.sum(axis=1)[:, None] pval = pval / pval.sum(axis=1)[:, None]
uval = numpy.ones_like(pval[:, 0]) * 0.5 uval = numpy.ones_like(pval[:, 0]) * 0.5
mval = f(pval, uval) mval = f(pval, uval)
...@@ -160,7 +164,7 @@ def test_multinomial_large(): ...@@ -160,7 +164,7 @@ def test_multinomial_large():
else: else:
raise NotImplementedError(config.cast_policy) raise NotImplementedError(config.cast_policy)
utt.assert_allclose(mval.sum(axis=1), 2) utt.assert_allclose(mval.sum(axis=1), 2)
asdf = numpy.asarray([0, 0, 2, 0])+0*pval asdf = numpy.asarray([0, 0, 2, 0]) + 0 * pval
utt.assert_allclose(mval, asdf) # broadcast over all rows utt.assert_allclose(mval, asdf) # broadcast over all rows
run_with_c(body) run_with_c(body)
if cuda.cuda_available: if cuda.cuda_available:
...@@ -201,10 +205,10 @@ def test_gpu_opt(): ...@@ -201,10 +205,10 @@ def test_gpu_opt():
f = function([p, u], m_gpu, allow_input_downcast=True, mode=get_mode(True)) f = function([p, u], m_gpu, allow_input_downcast=True, mode=get_mode(True))
assert any([type(node.op) is multinomial.GpuMultinomialFromUniform assert any([type(node.op) is multinomial.GpuMultinomialFromUniform
for node in f.maker.fgraph.toposort()]) for node in f.maker.fgraph.toposort()])
pval = numpy.arange(10000 * 4, dtype='float32').reshape((10000, 4))+0.1 pval = numpy.arange(10000 * 4, dtype='float32').reshape((10000, 4)) + 0.1
pval = pval / pval.sum(axis=1)[:, None] pval = pval / pval.sum(axis=1)[:, None]
uval = numpy.ones_like(pval[:, 0]) * 0.5 uval = numpy.ones_like(pval[:, 0]) * 0.5
mval = f(pval, uval) f(pval, uval)
# Test with a row, it was failing in the past. # Test with a row, it was failing in the past.
r = tensor.frow() r = tensor.frow()
...@@ -215,7 +219,7 @@ def test_gpu_opt(): ...@@ -215,7 +219,7 @@ def test_gpu_opt():
f = function([r, u], m_gpu, allow_input_downcast=True, mode=get_mode(True)) f = function([r, u], m_gpu, allow_input_downcast=True, mode=get_mode(True))
assert any([type(node.op) is multinomial.GpuMultinomialFromUniform assert any([type(node.op) is multinomial.GpuMultinomialFromUniform
for node in f.maker.fgraph.toposort()]) for node in f.maker.fgraph.toposort()])
pval = numpy.arange(1 * 4, dtype='float32').reshape((1, 4))+0.1 pval = numpy.arange(1 * 4, dtype='float32').reshape((1, 4)) + 0.1
pval = pval / pval.sum(axis=1)[:, None] pval = pval / pval.sum(axis=1)[:, None]
uval = numpy.ones_like(pval[:, 0]) * 0.5 uval = numpy.ones_like(pval[:, 0]) * 0.5
mval2 = f(pval, uval) f(pval, uval)
...@@ -15,13 +15,12 @@ from theano import tensor, config ...@@ -15,13 +15,12 @@ from theano import tensor, config
from theano.sandbox import rng_mrg from theano.sandbox import rng_mrg
from theano.sandbox.rng_mrg import MRG_RandomStreams from theano.sandbox.rng_mrg import MRG_RandomStreams
from theano.sandbox.cuda import cuda_available from theano.sandbox.cuda import cuda_available
from theano.tests import unittest_tools as utt
from theano.tests.unittest_tools import attr
if cuda_available: if cuda_available:
from theano.sandbox.cuda import float32_shared_constructor from theano.sandbox.cuda import float32_shared_constructor
from theano.tests import unittest_tools as utt
from theano.tests.unittest_tools import attr
# TODO: test gpu # TODO: test gpu
# Done in test_consistency_GPU_{serial,parallel} # Done in test_consistency_GPU_{serial,parallel}
...@@ -474,8 +473,8 @@ def basictest(f, steps, sample_size, prefix="", allow_01=False, inputs=None, ...@@ -474,8 +473,8 @@ def basictest(f, steps, sample_size, prefix="", allow_01=False, inputs=None,
else: else:
alpha = 1.0 / (1 + i) alpha = 1.0 / (1 + i)
mean = alpha * ival + (1 - alpha) * mean mean = alpha * ival + (1 - alpha) * mean
avg_var = (alpha * numpy.mean((ival - target_avg) ** 2) avg_var = (alpha * numpy.mean((ival - target_avg) ** 2) +
+ (1 - alpha) * avg_var) (1 - alpha) * avg_var)
min_ = min(min_, ival.min()) min_ = min(min_, ival.min())
max_ = max(max_, ival.max()) max_ = max(max_, ival.max())
if not allow_01: if not allow_01:
...@@ -487,7 +486,8 @@ def basictest(f, steps, sample_size, prefix="", allow_01=False, inputs=None, ...@@ -487,7 +486,8 @@ def basictest(f, steps, sample_size, prefix="", allow_01=False, inputs=None,
# print prefix, 'mean diff with mean', diff # print prefix, 'mean diff with mean', diff
assert numpy.all(diff < mean_rtol * (1 + abs(target_avg))), ( assert numpy.all(diff < mean_rtol * (1 + abs(target_avg))), (
'bad mean? %s %s' % (mean, target_avg)) 'bad mean? %s %s' % (mean, target_avg))
else: # if target_avg is a scalar, then we can do the mean of else:
# if target_avg is a scalar, then we can do the mean of
# `mean` to get something more precise # `mean` to get something more precise
mean = numpy.mean(mean) mean = numpy.mean(mean)
# print prefix, 'mean', mean # print prefix, 'mean', mean
...@@ -507,11 +507,11 @@ def basictest(f, steps, sample_size, prefix="", allow_01=False, inputs=None, ...@@ -507,11 +507,11 @@ def basictest(f, steps, sample_size, prefix="", allow_01=False, inputs=None,
def test_uniform(): def test_uniform():
# TODO: test param low, high # TODO: test param low, high
# TODO: test size=None # TODO: test size=None
# TODO: test ndim!=size.ndim # TODO: test ndim!=size.ndim
# TODO: test bad seed # TODO: test bad seed
# TODO: test size=Var, with shape that change from call to call # TODO: test size=Var, with shape that change from call to call
if (mode in ['DEBUG_MODE', 'DebugMode', 'FAST_COMPILE'] or if (mode in ['DEBUG_MODE', 'DebugMode', 'FAST_COMPILE'] or
mode == 'Mode' and config.linker in ['py']): mode == 'Mode' and config.linker in ['py']):
sample_size = (10, 100) sample_size = (10, 100)
...@@ -531,7 +531,7 @@ def test_uniform(): ...@@ -531,7 +531,7 @@ def test_uniform():
((), (), [], []), ((), (), [], []),
]: ]:
#### TEST CPU IMPLEMENTATION #### # TEST CPU IMPLEMENTATION
# The python and C implementation are tested with DebugMode # The python and C implementation are tested with DebugMode
# print '' # print ''
# print 'ON CPU with size=(%s):' % str(size) # print 'ON CPU with size=(%s):' % str(size)
...@@ -598,13 +598,13 @@ def test_uniform(): ...@@ -598,13 +598,13 @@ def test_uniform():
@attr('slow') @attr('slow')
def test_binomial(): def test_binomial():
# TODO: test size=None, ndim=X # TODO: test size=None, ndim=X
# TODO: test size=X, ndim!=X.ndim # TODO: test size=X, ndim!=X.ndim
# TODO: test random seed in legal value(!=0 and other) # TODO: test random seed in legal value(!=0 and other)
# TODO: test sample_size not a multiple of guessed #streams # TODO: test sample_size not a multiple of guessed #streams
# TODO: test size=Var, with shape that change from call to call # TODO: test size=Var, with shape that change from call to call
# we test size in a tuple of int and a tensor.shape. # we test size in a tuple of int and a tensor.shape.
# we test the param p with int. # we test the param p with int.
if (mode in ['DEBUG_MODE', 'DebugMode', 'FAST_COMPILE'] or if (mode in ['DEBUG_MODE', 'DebugMode', 'FAST_COMPILE'] or
mode == 'Mode' and config.linker in ['py']): mode == 'Mode' and config.linker in ['py']):
...@@ -617,7 +617,6 @@ def test_binomial(): ...@@ -617,7 +617,6 @@ def test_binomial():
rtol = 0.01 rtol = 0.01
x = tensor.matrix() x = tensor.matrix()
v = tensor.vector()
for mean in [0.1, 0.5]: for mean in [0.1, 0.5]:
for size, const_size, var_input, input in [ for size, const_size, var_input, input in [
(sample_size, sample_size, [], []), (sample_size, sample_size, [], []),
...@@ -821,7 +820,8 @@ def test_multinomial(): ...@@ -821,7 +820,8 @@ def test_multinomial():
f = theano.function([], m, mode=mode_) f = theano.function([], m, mode=mode_)
# theano.printing.debugprint(f) # theano.printing.debugprint(f)
out = f() out = f()
basic_multinomialtest(f, steps, sample_size, pvals, n_samples=1, prefix='mrg ') basic_multinomialtest(f, steps, sample_size, pvals, n_samples=1,
prefix='mrg ')
sys.stdout.flush() sys.stdout.flush()
...@@ -842,7 +842,8 @@ def test_multinomial(): ...@@ -842,7 +842,8 @@ def test_multinomial():
# theano.printing.debugprint(f) # theano.printing.debugprint(f)
gpu_out = f() gpu_out = f()
sys.stdout.flush() sys.stdout.flush()
basic_multinomialtest(f, steps, sample_size, pvals, n_samples=1, prefix='gpu mrg ') basic_multinomialtest(f, steps, sample_size, pvals, n_samples=1,
prefix='gpu mrg ')
numpy.testing.assert_array_almost_equal(out, gpu_out, decimal=6) numpy.testing.assert_array_almost_equal(out, gpu_out, decimal=6)
...@@ -863,15 +864,18 @@ def test_multinomial_n_samples(): ...@@ -863,15 +864,18 @@ def test_multinomial_n_samples():
R = MRG_RandomStreams(234, use_cuda=False) R = MRG_RandomStreams(234, use_cuda=False)
for n_samples, steps in zip([5, 10, 100, 1000], [20, 10, 1, 1]): for n_samples, steps in zip([5, 10, 100, 1000], [20, 10, 1, 1]):
m = R.multinomial(pvals=pvals, n=n_samples, dtype=config.floatX, nstreams=30 * 256) m = R.multinomial(pvals=pvals, n=n_samples,
dtype=config.floatX, nstreams=30 * 256)
f = theano.function([], m, mode=mode_) f = theano.function([], m, mode=mode_)
basic_multinomialtest(f, steps, sample_size, pvals, n_samples, prefix='mrg ') basic_multinomialtest(f, steps, sample_size, pvals,
n_samples, prefix='mrg ')
sys.stdout.flush() sys.stdout.flush()
if mode != 'FAST_COMPILE' and cuda_available: if mode != 'FAST_COMPILE' and cuda_available:
R = MRG_RandomStreams(234, use_cuda=True) R = MRG_RandomStreams(234, use_cuda=True)
pvals = numpy.asarray(pvals, dtype='float32') pvals = numpy.asarray(pvals, dtype='float32')
n = R.multinomial(pvals=pvals, n=n_samples, dtype='float32', nstreams=30 * 256) n = R.multinomial(pvals=pvals, n=n_samples,
dtype='float32', nstreams=30 * 256)
assert n.dtype == 'float32' assert n.dtype == 'float32'
f = theano.function( f = theano.function(
[], [],
...@@ -879,7 +883,8 @@ def test_multinomial_n_samples(): ...@@ -879,7 +883,8 @@ def test_multinomial_n_samples():
mode=mode_.including('gpu')) mode=mode_.including('gpu'))
sys.stdout.flush() sys.stdout.flush()
basic_multinomialtest(f, steps, sample_size, pvals, n_samples, prefix='gpu mrg ') basic_multinomialtest(f, steps, sample_size, pvals,
n_samples, prefix='gpu mrg ')
class T_MRG(unittest.TestCase): class T_MRG(unittest.TestCase):
...@@ -1039,7 +1044,6 @@ def test_seed_fn(): ...@@ -1039,7 +1044,6 @@ def test_seed_fn():
if __name__ == "__main__": if __name__ == "__main__":
rng = MRG_RandomStreams(numpy.random.randint(2147462579)) rng = MRG_RandomStreams(numpy.random.randint(2147462579))
import time
print(theano.__file__) print(theano.__file__)
pvals = theano.tensor.fmatrix() pvals = theano.tensor.fmatrix()
for i in range(10): for i in range(10):
......
...@@ -199,7 +199,11 @@ class Scalar(Type): ...@@ -199,7 +199,11 @@ class Scalar(Type):
type(data), data, self.dtype), e) type(data), data, self.dtype), e)
def values_eq_approx(self, a, b, tolerance=1e-4): def values_eq_approx(self, a, b, tolerance=1e-4):
return abs(a - b) <= ((abs(a) + abs(b)) * tolerance) # The addition have risk of overflow especially with [u]int8
diff = a - b
if diff == 0:
return True
return abs(diff) <= (abs(a) * tolerance) + (abs(b) * tolerance)
def c_headers(self, c_compiler): def c_headers(self, c_compiler):
l = ['<math.h>'] l = ['<math.h>']
......
...@@ -25,6 +25,7 @@ config = theano.config ...@@ -25,6 +25,7 @@ config = theano.config
# so we redefine them here # so we redefine them here
discrete_dtypes = list(map(str, scalar.discrete_types)) discrete_dtypes = list(map(str, scalar.discrete_types))
float_dtypes = list(map(str, scalar.float_types)) float_dtypes = list(map(str, scalar.float_types))
int_dtypes = list(map(str, scalar.int_types))
# tensor depends on elemwise to provide definitions for several ops # tensor depends on elemwise to provide definitions for several ops
...@@ -811,6 +812,24 @@ class Elemwise(OpenMPOp): ...@@ -811,6 +812,24 @@ class Elemwise(OpenMPOp):
else: else:
node.tag.ufunc = ufunc node.tag.ufunc = ufunc
# Numpy ufuncs will sometimes perform operations in
# float16, in particular when the input is int8.
# This is not something that we want, and we do not
# do it in the C code, so we specify that the computation
# should be carried out in the returned dtype.
# This is done via the "sig" kwarg of the ufunc, its value
# should be something like "ff->f", where the characters
# represent the dtype of the inputs and outputs.
# NumPy 1.10.1 raise an error when giving the signature
# when the input is complex. So add it only when inputs is int.
out_dtype = node.outputs[0].dtype
if (out_dtype in float_dtypes and
isinstance(self.nfunc, numpy.ufunc) and
node.inputs[0].dtype in int_dtypes):
char = numpy.sctype2char(out_dtype)
sig = char * node.nin + '->' + char * node.nout
node.tag.sig = sig
return super(Elemwise, node_.op).make_thunk(node_, storage_map, return super(Elemwise, node_.op).make_thunk(node_, storage_map,
compute_map, no_recycling) compute_map, no_recycling)
...@@ -860,19 +879,8 @@ class Elemwise(OpenMPOp): ...@@ -860,19 +879,8 @@ class Elemwise(OpenMPOp):
if self.nfunc and len(inputs) == self.nfunc_spec[1]: if self.nfunc and len(inputs) == self.nfunc_spec[1]:
ufunc = self.nfunc ufunc = self.nfunc
nout = self.nfunc_spec[2] nout = self.nfunc_spec[2]
# Numpy ufuncs will sometimes perform operations in if hasattr(node.tag, 'sig'):
# float16, in particular when the input is int8. ufunc_kwargs['sig'] = node.tag.sig
# This is not something that we want, and we do not
# do it in the C code, so we specify that the computation
# should be carried out in the returned dtype.
# This is done via the "sig" kwarg of the ufunc, its value
# should be something like "ff->f", where the characters
# represent the dtype of the inputs and outputs.
out_dtype = node.outputs[0].dtype
if out_dtype in float_dtypes and isinstance(ufunc, numpy.ufunc):
char = numpy.sctype2char(out_dtype)
sig = char * node.nin + '->' + char * node.nout
ufunc_kwargs['sig'] = sig
# Unfortunately, the else case does not allow us to # Unfortunately, the else case does not allow us to
# directly feed the destination arguments to the nfunc # directly feed the destination arguments to the nfunc
# since it sometimes requires resizing. Doing this # since it sometimes requires resizing. Doing this
......
...@@ -306,7 +306,7 @@ class AbstractConv2d(BaseAbstractConv2d): ...@@ -306,7 +306,7 @@ class AbstractConv2d(BaseAbstractConv2d):
raise NotImplementedError( raise NotImplementedError(
'AbstractConv2d theano optimization failed. ' 'AbstractConv2d theano optimization failed. '
'Did you exclude both "conv_dnn" and "conv_gemm" from ' 'Did you exclude both "conv_dnn" and "conv_gemm" from '
'the optimizer?') 'the optimizer? Is cudnn available and does the GPU support it?')
def grad(self, inp, grads): def grad(self, inp, grads):
bottom, weights = inp bottom, weights = inp
......
...@@ -102,9 +102,7 @@ whitelist_flake8 = [ ...@@ -102,9 +102,7 @@ whitelist_flake8 = [
"sandbox/debug.py", "sandbox/debug.py",
"sandbox/tests/test_theano_object.py", "sandbox/tests/test_theano_object.py",
"sandbox/tests/test_scan.py", "sandbox/tests/test_scan.py",
"sandbox/tests/test_rng_mrg.py",
"sandbox/tests/test_neighbourhoods.py", "sandbox/tests/test_neighbourhoods.py",
"sandbox/tests/test_multinomial.py",
"sandbox/tests/__init__.py", "sandbox/tests/__init__.py",
"sandbox/cuda/var.py", "sandbox/cuda/var.py",
"sandbox/cuda/GpuConvGrad3D.py", "sandbox/cuda/GpuConvGrad3D.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论