예제 #1
0
    async def update(info, model_ref, dmodel_ref, update_rule_ref):
        new_model = model_ref.node
        dmodel = dmodel_ref.node
        update_rule = update_rule_ref.node

        p = new_model
        g = dmodel

        p = (P.record_getitem, p, 'W')
        g = (P.record_getitem, g, 'W')

        p_node = sexp_to_node(p, info.graph)
        g_node = sexp_to_node(g, info.graph)

        pn = info.graph.apply(update_rule, p_node, g_node)

        new_model = sexp_to_node(setter_from_getter(p, pn), info.graph)

        return new_model
예제 #2
0
    async def update(info, self_ref, param_names_ref, model_ref, dmodel_ref,
                     update_rule_ref):
        param_names_cst = build_value(await param_names_ref.get())
        #self = build_value(await self_ref.get())
        new_model = model_ref.node
        dmodel = dmodel_ref.node
        update_rule = update_rule_ref.node
        model_abs = await model_ref.get()

        for k in param_names_cst:
            p = new_model
            g = dmodel
            for c in k:
                p = (P.record_getitem, p, c)
                g = (P.record_getitem, g, c)

            p_node = sexp_to_node(p, info.graph)
            g_node = sexp_to_node(g, info.graph)

            pn = info.graph.apply(update_rule, p_node, g_node)

            new_model = sexp_to_node(setter_from_getter(p, pn), info.graph)

        return new_model