test_dictionary_output.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Theano-Deep-learning 作者: GeekLiB 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号