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

add option to change batch dimension in drop #52

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions axonn/intra_layer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
from axonn import axonn as ax


def drop(x, transpose=False, dim=-1):
def drop(x, transpose=False, dim=-1, batch_dim=0):
if not transpose:
group = ax.comm_handle.inner_intra_layer_parallel_group
else:
group = ax.comm_handle.outer_intra_layer_parallel_group

x = Drop.apply(x, group, dim)
x = Drop.apply(x, ax.comm_handle.depth_intra_layer_parallel_group, 0)
x = Drop.apply(x, ax.comm_handle.depth_intra_layer_parallel_group, batch_dim)
return x


def gather(x, transpose=False, dim=-1):
def gather(x, transpose=False, dim=-1, batch_dim=0):
if not transpose:
group = ax.comm_handle.inner_intra_layer_parallel_group
else:
group = ax.comm_handle.outer_intra_layer_parallel_group

x = Gather.apply(x, group, dim)
x = Gather.apply(x, ax.comm_handle.depth_intra_layer_parallel_group, 0)
x = Gather.apply(x, ax.comm_handle.depth_intra_layer_parallel_group, batch_dim)
return x
Loading