model.py 文件源码

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

项目:dnc-theano 作者: khaotik 项目源码 文件源码
def query_variable(self, query_):
        '''
        Return an iterable which yields shared variables found by query_, from current group.

        query_:
            Can take several forms, as shown below.

            All: return all variables under current group.
            string: treat as regex, return variables whose name fully match the regex.

        '''
        if query_ is All:
            return self._current_group_di.values()
        elif isinstance(query_, str):
            regex = re.compile(query_)
            return {k:v for k,v in self._current_group_di.items() if regex.fullmatch(k)}
        else:
            raise TypeError('Unknown query type "%s"' % type(query_))


    # TODO add / delete group does not consider non-group object by now
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号