tools.py 文件源码

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

项目:structured-output-ae 作者: sbelharbi 项目源码 文件源码
def get_cost(aes, l, eye=True):
    """Get the sum of all the reconstruction costs of the AEs.
    Input:
        aes_in: list. List of all the aes.
        l: shared variable or a list of shared variables for the importance
            weights.
    """
    costs = []
    for ae, i in zip(aes, range(len(aes))):
        if isinstance(ae, ConvolutionalAutoencoder):
            costs.append(l[i] * ae.get_train_cost()[0])
        else:
            costs.append(l[i] * ae.get_train_cost(face=eye)[0])
    cost = None
    if costs not in [[], None]:
        cost = reduce(lambda x, y: x + y, costs)
    return cost
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号