fg.py 文件源码

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

项目:Theano-Deep-learning 作者: GeekLiB 项目源码 文件源码
def __init__(self, *args, **kwargs):
        if kwargs:
            # The call to list is needed for Python 3
            assert list(kwargs.keys()) == ["variable"]
            tr = getattr(list(kwargs.values())[0].tag, 'trace', [])
            if type(tr) is list and len(tr) > 0:
                sio = StringIO()
                print("\nBacktrace when the variable is created:", file=sio)
                for subtr in list(kwargs.values())[0].tag.trace:
                    traceback.print_list(subtr, sio)
                args = args + (str(sio.getvalue()),)
        s = '\n'.join(args)  # Needed to have the new line print correctly
        Exception.__init__(self, s)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号