def test_key_string_requirement(self):
'''
Tests that an exception is thrown if a non-string key is used in
the outputs dictionary.
'''
x = T.scalar('x')
try:
theano.function([x], outputs={1.0: x})
raise Exception("Did not throw exception with 1.0 as only key")
except AssertionError:
pass
try:
theano.function([x], outputs={1.0: x, "a": x**2})
raise Exception("Did not throw exception with 1.0 as one key")
except AssertionError:
pass
try:
theano.function([x], outputs={(1, "b"): x, 1.0: x**2})
raise Exception("Did not throw exception with tuple as key")
except AssertionError:
pass
test_dictionary_output.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录