parameter_supervisor.py 文件源码

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

项目:recnet 作者: joergfranke 项目源码 文件源码
def pass_structure_dict(self, prm_structure):

        if "net_size" in prm_structure:
            self.struct["net_size"      ] = prm_structure["net_size"]
            self.struct["hidden_layer"  ] = prm_structure["net_size"].__len__() - 2
        else:
            raise Warning("No net size")

        if "net_unit_type" in prm_structure:
            self.struct["net_unit_type"      ] = prm_structure["net_unit_type"]
            if  prm_structure["net_unit_type"].__len__() != self.struct["net_size" ].__len__():
                raise Warning("Net size and unit type have no equal length")
        else:
            raise Warning("No net unit type")

        if "net_act_type" in prm_structure:
            self.struct["net_act_type"      ] = prm_structure["net_act_type"]
            if  prm_structure["net_act_type"].__len__() != self.struct["net_size" ].__len__():
                raise Warning("Net size and act type have no equal length")
        else:
            self.struct["net_act_type" ] = ['tanh' for i in xrange(prm_structure["net_size"].__len__())]

        if "net_arch" in prm_structure:
            self.struct["net_arch"      ] = prm_structure["net_arch"]
            if  prm_structure["net_arch"].__len__() != self.struct["net_size" ].__len__():
                raise Warning("Net size and net architecture have no equal length")
        else:
            raise Warning("No network architecture 'net_arch' ")

        self.struct["weight_numb"] = 0


        if "identity_func" in prm_structure: #(currently corrupted)
            self.struct["identity_func"] = prm_structure["identity_func"]
        else:
            self.struct["identity_func"] = False


    ##### Passes parameters in optimize dictionary
    ########################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号