提交 410405cf authored 作者: James Bergstra's avatar James Bergstra

pep8 tensor/tests/test_misc.py

上级 731e2d2f
import copy, sys import copy
import numpy, theano import sys
import numpy
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
def test_bug_2009_06_02_trac_387():
def test_bug_2009_06_02_trac_387():
y = tensor.lvector('y') y = tensor.lvector('y')
#f = theano.function([y], tensor.stack(y[0] / 2)) f = theano.function([y],
#f = theano.function([y], tensor.join(0,tensor.shape_padleft(y[0] / 2,1))) tensor.int_div(
f = theano.function([y], tensor.int_div(tensor.DimShuffle(y[0].broadcastable, ['x'])(y[0]), 2)) tensor.DimShuffle(y[0].broadcastable, ['x'])(y[0]), 2))
sys.stdout.flush() sys.stdout.flush()
print f(numpy.ones(1, dtype='int64') * 3) print f(numpy.ones(1, dtype='int64') * 3)
#z = tensor.lscalar('z') # XXX: there is no assert, nor comment that DEBUGMODE is to do the
#f = theano.function([z], tensor.DimShuffle([], ['x'])(z) / 2) # checking. What was the bug, and how is it being tested?
def test_bug_2009_07_17_borrowed_output(): def test_bug_2009_07_17_borrowed_output():
"""Regression test for a bug where output was borrowed by mistake.""" """Regression test for a bug where output was borrowed by mistake."""
...@@ -68,4 +71,3 @@ def test_bug_2009_07_17_borrowed_output(): ...@@ -68,4 +71,3 @@ def test_bug_2009_07_17_borrowed_output():
assert id_z != id_other assert id_z != id_other
# Just to be 100% sure, ensure that z was not altered. # Just to be 100% sure, ensure that z was not altered.
assert (z == z_backup).all() assert (z == z_backup).all()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论