6294677f8acc6bc040baf922910473e1c82995ba,python/dgl/ops/spmm.py,,gspmm,#Any#Any#Any#Any#Any#,11
Before Change
deg_shape = (ret_shape[0],) + (1,) * (len(ret_shape) - 1)
return ret / F.reshape(deg, deg_shape)
else:
return gspmm_internal(g._graph, op, reduce_op, lhs_data, rhs_data)
def _gen_spmm_func(binary_op, reduce_op):
name = "u_{}_e_{}".format(binary_op, reduce_op)
After Change
deg = g.in_degrees()
min_deg = F.as_scalar(F.min(deg, dim=0))
if min_deg == 0:
non_zero_nids = F.nonzero_1d(deg == 0)
if backend_name == "pytorch":
ret[non_zero_nids] = 0.
else:
dtype = F.dtype(ret)
ctx = F.context(ret)
ret = F.scatter_row(ret, non_zero_nids,
F.zeros((len(non_zero_nids),) + F.shape(ret)[1:], dtype, ctx))
// divide in degrees for mean reducer.
if reduce_op == "mean":
ret_shape = F.shape(ret)
if min_deg == 0:
dgl_warning("Zero-degree nodes encountered in mean reducer. Setting the mean to 0.")
deg = F.astype(F.clamp(deg, 1, g.number_of_edges()), F.dtype(ret))
deg_shape = (ret_shape[0],) + (1,) * (len(ret_shape) - 1)
return ret / F.reshape(deg, deg_shape)
else:
return ret
def _gen_spmm_func(binary_op, reduce_op):
name = "u_{}_e_{}".format(binary_op, reduce_op)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: dmlc/dgl
Commit Name: 6294677f8acc6bc040baf922910473e1c82995ba
Time: 2020-08-12
Author: expye@outlook.com
File Name: python/dgl/ops/spmm.py
Class Name:
Method Name: gspmm
Project Name: tensorly/tensorly
Commit Name: 6be1f6d9be00190becf2ea3ee0eee28ab3af8943
Time: 2018-09-08
Author: zli@wustl.edu
File Name: tensorly/backend/mxnet_backend.py
Class Name:
Method Name: inverse
Project Name: tensorly/tensorly
Commit Name: 975c84b15a5bdec14d2b326b985e2ac15bc099b8
Time: 2018-09-19
Author: zli@wustl.edu
File Name: tensorly/backend/mxnet_backend.py
Class Name:
Method Name: inverse