def create_random_bipartite(): g = dgl.rand_bipartite('user', 'buys', 'game', 500, 1000, 1000) g.nodes['user'].data['feat'] = F.ones((g.num_nodes('user'), 10), F.float32, F.cpu()) g.nodes['game'].data['feat'] = F.ones((g.num_nodes('game'), 10), F.float32, F.cpu()) return g
'sum': lambda nodes: { 'v': F.sum(nodes.mailbox['m'], 1) }, 'min': lambda nodes: { 'v': F.min(nodes.mailbox['m'], 1) }, 'max': lambda nodes: { 'v': F.max(nodes.mailbox['m'], 1) } } graphs = [ # dgl.rand_graph(30, 0), dgl.rand_graph(100, 30), dgl.rand_graph(100, 3000), dgl.rand_bipartite(80, 160, 3000) ] spmm_shapes = [((1, 2, 1, 3, 1), (4, 1, 3, 1, 1)), ((5, 3, 1, 7), (1, 3, 7, 1)), ((1, 3, 1), (4, 1, 3)), ((3, 3), (1, 3)), ((1, ), (3, )), ((3, ), (1, )), ((1, ), (1, ))] sddmm_shapes = [((1, 2, 1, 3, 1), (4, 1, 3, 1, 1)), ((5, 3, 1, 7), (1, 3, 7, 7)), ((1, 3, 3), (4, 1, 3)), ((3, 3), (1, 3)), ((3, ), (3, )), ((1, ), (1, ))] @pytest.mark.parametrize('g', graphs) @pytest.mark.parametrize('shp', spmm_shapes) @pytest.mark.parametrize('msg',
udf_reduce = { 'sum': lambda nodes: { 'v': F.sum(nodes.mailbox['m'], 1) }, 'min': lambda nodes: { 'v': F.min(nodes.mailbox['m'], 1) }, 'max': lambda nodes: { 'v': F.max(nodes.mailbox['m'], 1) } } graphs = [ # dgl.rand_graph(30, 0), dgl.rand_graph(30, 100), dgl.rand_bipartite(30, 40, 300) ] spmm_shapes = [((1, 2, 1, 3, 1), (4, 1, 3, 1, 1)), ((3, 3), (1, 3)), ((1, ), (3, )), ((3, ), (1, )), ((1, ), (1, ))] sddmm_shapes = [((1, 2, 1, 3, 1), (4, 1, 3, 1, 1)), ((5, 3, 1, 7), (1, 3, 7, 7)), ((1, 3, 3), (4, 1, 3)), ((3, ), (3, )), ((1, ), (1, ))] edge_softmax_shapes = [(1, ), (1, 3), (3, 4, 5)] @pytest.mark.parametrize('g', graphs) @pytest.mark.parametrize('shp', spmm_shapes) @pytest.mark.parametrize('msg',
udf_reduce = { 'sum': lambda nodes: { 'v': F.sum(nodes.mailbox['m'], 1) }, 'min': lambda nodes: { 'v': F.min(nodes.mailbox['m'], 1) }, 'max': lambda nodes: { 'v': F.max(nodes.mailbox['m'], 1) } } graphs = [ # dgl.rand_graph(30, 0), dgl.rand_graph(30, 100), dgl.rand_bipartite('_U', '_E', '_V', 30, 40, 300) ] spmm_shapes = [((1, 2, 1, 3, 1), (4, 1, 3, 1, 1)), ((3, 3), (1, 3)), ((1, ), (3, )), ((3, ), (1, )), ((1, ), (1, )), ((), ())] sddmm_shapes = [((1, 2, 1, 3, 1), (4, 1, 3, 1, 1)), ((5, 3, 1, 7), (1, 3, 7, 7)), ((1, 3, 3), (4, 1, 3)), ((3, ), (3, )), ((1, ), (1, ))] edge_softmax_shapes = [(1, ), (1, 3), (3, 4, 5)] @pytest.mark.parametrize('g', graphs) @pytest.mark.parametrize('shp', spmm_shapes) @pytest.mark.parametrize('msg',