Skip to content

Commit

Permalink
3d tensor for RMSNorm (#111)
Browse files Browse the repository at this point in the history
Signed-off-by: Mayank Mishra <[email protected]>
  • Loading branch information
mayank31398 authored Dec 23, 2024
1 parent df6c243 commit 333d10e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def _rmsnorm_backward_no_weight_triton(
BLOCK_SIZE_B: int,
BLOCK_SIZE_H: int,
) -> None:
num_elements, hidden_size = x.size()
hidden_size = x.size(-1)
num_elements = x.numel() // hidden_size

if BLOCK_SIZE_H < hidden_size:
raise ValueError(f"hidden_size should be more than the BLOCK_SIZE_H")
Expand Down Expand Up @@ -158,7 +159,8 @@ def _rmsnorm_backward_triton(
BLOCK_SIZE_B: int,
BLOCK_SIZE_H: int,
) -> torch.Tensor:
num_elements, hidden_size = x.size()
hidden_size = x.size(-1)
num_elements = x.numel() // hidden_size

if BLOCK_SIZE_H < hidden_size:
raise ValueError(f"hidden_size should be more than the BLOCK_SIZE_H")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def rmsnorm_forward_triton(
BLOCK_SIZE_B: int,
BLOCK_SIZE_H: int,
) -> None:
num_elements, hidden_size = x.size()
hidden_size = x.size(-1)
num_elements = x.numel() // hidden_size

if BLOCK_SIZE_H < hidden_size:
raise ValueError(f"hidden_size should be more than the BLOCK_SIZE_H")
Expand Down

0 comments on commit 333d10e

Please sign in to comment.