提交 9a8bb9de authored 作者: AdeB's avatar AdeB

add an assert statement in the test of the h_softmax to checks that…

add an assert statement in the test of the h_softmax to checks that fun_output_tg and fun_output are consistent
上级 fc5fe33a
...@@ -1614,6 +1614,14 @@ def test_h_softmax(): ...@@ -1614,6 +1614,14 @@ def test_h_softmax():
############# #############
x_mat = numpy.random.normal(size=(batch_size, input_size)).astype(floatX) x_mat = numpy.random.normal(size=(batch_size, input_size)).astype(floatX)
y_mat = numpy.random.randint(0, output_size, batch_size).astype('int32') y_mat = numpy.random.randint(0, output_size, batch_size).astype('int32')
assert(fun_output_tg(x_mat, y_mat).shape == (batch_size,)) tg_output = fun_output_tg(x_mat, y_mat)
assert(fun_output(x_mat).shape == (batch_size, output_size)) all_outputs = fun_output(x_mat)
assert(tg_output.shape == (batch_size,))
assert(all_outputs.shape == (batch_size, output_size))
# Verifies that the outputs computed by fun_output_tg are the same as those
# computed by fun_output.
utt.assert_allclose(
all_outputs[numpy.arange(0, batch_size), y_mat], tg_output)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论