fc9d30fae42e3849d80b0ebf764b6e58c3198f3b,python/dgl/nn/pytorch/softmax.py,EdgeSoftmax,forward,#Any#Any#Any#,29

Before Change


        out = score / score_sum    // edge_div_dst, ret dgl.EData
        return out.data
        
        score_name = utils.get_edata_name(g, "score")
        tmp_name = utils.get_ndata_name(g, "tmp")
        out_name = utils.get_edata_name(g, "out")
        g.edata[score_name] = score
        g.update_all(fn.copy_e(score_name, "m"), fn.max("m", tmp_name))
        g.apply_edges(fn.e_sub_v(score_name, tmp_name, out_name))
        g.edata[out_name] = th.exp(g.edata[out_name])
        g.update_all(fn.copy_e(out_name, "m"), fn.sum("m", tmp_name))
        g.apply_edges(fn.e_div_v(out_name, tmp_name, out_name))
        g.edata.pop(score_name)
        g.ndata.pop(tmp_name)
        out = g.edata.pop(out_name)
        ctx.save_for_backward(out)
        ctx.backward_cache = g
        return out

After Change


        // remember to save the graph to backward cache before making it
        // a local variable
        ctx.backward_cache = g
        g = g.local_var()
        g.edata["s"] = score
        g.update_all(fn.copy_e("s", "m"), fn.max("m", "smax"))
        g.apply_edges(fn.e_sub_v("s", "smax", "out"))
        g.edata["out"] = th.exp(g.edata["out"])
        g.update_all(fn.copy_e("out", "m"), fn.sum("m", "out_sum"))
        g.apply_edges(fn.e_div_v("out", "out_sum", "out"))
        out = g.edata["out"]
        ctx.save_for_backward(out)
        return out

    @staticmethod
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: dmlc/dgl
Commit Name: fc9d30fae42e3849d80b0ebf764b6e58c3198f3b
Time: 2019-08-01
Author: wmjlyjemaine@gmail.com
File Name: python/dgl/nn/pytorch/softmax.py
Class Name: EdgeSoftmax
Method Name: forward


Project Name: dmlc/dgl
Commit Name: fc9d30fae42e3849d80b0ebf764b6e58c3198f3b
Time: 2019-08-01
Author: wmjlyjemaine@gmail.com
File Name: python/dgl/nn/pytorch/softmax.py
Class Name: EdgeSoftmax
Method Name: forward


Project Name: dmlc/dgl
Commit Name: fc9d30fae42e3849d80b0ebf764b6e58c3198f3b
Time: 2019-08-01
Author: wmjlyjemaine@gmail.com
File Name: python/dgl/nn/pytorch/conv.py
Class Name: GraphConv
Method Name: forward


Project Name: dmlc/dgl
Commit Name: fc9d30fae42e3849d80b0ebf764b6e58c3198f3b
Time: 2019-08-01
Author: wmjlyjemaine@gmail.com
File Name: python/dgl/nn/pytorch/softmax.py
Class Name: EdgeSoftmax
Method Name: backward