How to do e_mul_e?

I want to update the node representation

i can think graph.apply_edges(fn.u_sub_v(‘h’,‘h’,‘cha’))
and then do something like e_mul_e(‘w’,‘cha’,‘res’).
but there is no e_mul_e?
is there a way to do this?
thank you.

    graph.update_all([fn.u_sub_v('norm_h', 'norm_h', 'm'),fn.e_add_v('m', 'norm_h', 'mm')], [fn.sum('mm', 'h')])

KeyError: ‘m’

You can just do graph.edata['res'] = graph.edata['w'] * (graph.edata['h'][:, 1:] - graph.edata['h'][:, 0:1]).

What do you mean by graph.update_all([fn.u_sub_v('norm_h', 'norm_h', 'm'),fn.e_add_v('m', 'norm_h', 'mm')], [fn.sum('mm', 'h')])?

mufei,it seems that the edges do not have the key ‘h’? the key ‘h’ is in the node.

also got key “error” in key ‘h’

My bad. How about

G.apply_edges(fn.v_sub_u('h', 'h', 'diff'))
G.edata['e'] = G.edata['w'] * G.edata['diff']
G.update_all(fn.copy_edge('e', 'm'), fn.sum('m', 'h'))

nice!:+1: :+1::+1: :+1::+1: :+1::+1: :+1: