提交 9f881382 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Add tests

上级 01922905
...@@ -680,3 +680,18 @@ def test_batched_dot_lifter(): ...@@ -680,3 +680,18 @@ def test_batched_dot_lifter():
z = tensor.batched_dot(x, y) z = tensor.batched_dot(x, y)
f = theano.function([x, y], z, mode=mode_with_gpu) f = theano.function([x, y], z, mode=mode_with_gpu)
f(x_val, y_val) f(x_val, y_val)
def test_crossentropycategorical1hot_lifter():
rng = np.random.RandomState(utt.fetch_seed())
x = tensor.matrix()
y = tensor.lvector()
z = tensor.nnet.crossentropy_categorical_1hot(x, y)
gx = theano.grad(z.mean(), x)
f = theano.function([x, y], [z, gx], mode=mode_with_gpu)
theano.printing.debugprint(f, print_type=1)
assert not any(isinstance(n.op, (tensor.nnet.CrossentropyCategorical1Hot,
tensor.nnet.CrossentropyCategorical1HotGrad))
for n in f.maker.fgraph.apply_nodes)
f(rng.uniform(0.1, 0.9, (13, 5)).astype(theano.config.floatX),
rng.randint(5, size=(13,)))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论