Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] add degree padding schedule #973

Open
wants to merge 7 commits into
base: master
from
Open

Conversation

@yzh119
Copy link
Member

yzh119 commented Nov 4, 2019

Description

Our default degree bucketing strategy is slow for graphs whose degree variance is large (e.g. power-law graphs).

This PR implements degree padding strategy discussed in #777 , where a set of pre-defined buckets are given, messages of each node are padded to the length of least bucket size greater than its in degrees.

Usage

We defined a decorator degree_bucketing in dgl.function.reducer that specifies whether to use degree bucketing strategy and related parameters (bucket splits and padding values). The following is an example of lstm reducer used in graphsage:

@degree_padding(bucket_split=[1,8])
def _lstm_reducer(nodes, degs):
    m = nodes.mailbox['m'] # (B, L, D)
    m_packed = pack_padded_sequence(m, degs, batch_first=True, enforce_sorted=False)

    batch_size = m.shape[0]
    h = (m.new_zeros((1, batch_size, self._in_feats)),
         m.new_zeros((1, batch_size, self._in_feats)))
    _, (rst, _) = self.lstm(m_packed, h)
    return {'neigh': rst.squeeze(0)}

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented
  • To the my best knowledge, examples are either not affected by this change,
    or have been fixed to be compatible with this change
  • Related issue is referred in this PR

Changes

yzh119 added 4 commits Nov 4, 2019
upd
upd
@yzh119 yzh119 changed the title [WIP][Feature] add degree padding schedule [Feature] add degree padding schedule Nov 4, 2019
yzh119 added 3 commits Nov 4, 2019
upd
upd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.