nettrainer.py 文件源码

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

项目:deep-prior 作者: moberweger 项目源码 文件源码
def addStaticData(self, data):
        """
        Set the data of the network, not managed within training iterations, e.g. used for validation or other small data
        :param data: training data and labels specified as dictionary
        :return: None
        """

        if not isinstance(data, dict):
            raise ValueError("Error: expected dictionary for data!")

        for key in data:
            # no need to cache validation data
            setattr(self, key+'DB', data[key])

            # shared variable already exists?
            if hasattr(self, key):
                print("Reusing shared variables!")
                getattr(self, key).set_value(getattr(self, key+'DB'), borrow=True)
            else:
                # create shared data
                setattr(self, key, theano.shared(getattr(self, key+'DB'), name=key, borrow=True))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号