Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
flash-attention
Commits
c9861a03
Commit
c9861a03
authored
Jan 09, 2024
by
Tri Dao
Browse files
[LayerNorm] Initialize mean and rstd tensor using x.device
parent
99ea4baa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
flash_attn/ops/triton/layer_norm.py
flash_attn/ops/triton/layer_norm.py
+2
-2
No files found.
flash_attn/ops/triton/layer_norm.py
View file @
c9861a03
...
@@ -314,8 +314,8 @@ def _layer_norm_fwd(
...
@@ -314,8 +314,8 @@ def _layer_norm_fwd(
assert
residual_out
.
stride
(
-
1
)
==
1
assert
residual_out
.
stride
(
-
1
)
==
1
else
:
else
:
residual_out
=
None
residual_out
=
None
mean
=
torch
.
empty
((
M
,),
dtype
=
torch
.
float32
,
device
=
"cuda"
)
if
not
is_rms_norm
else
None
mean
=
torch
.
empty
((
M
,),
dtype
=
torch
.
float32
,
device
=
x
.
device
)
if
not
is_rms_norm
else
None
rstd
=
torch
.
empty
((
M
,),
dtype
=
torch
.
float32
,
device
=
"cuda"
)
rstd
=
torch
.
empty
((
M
,),
dtype
=
torch
.
float32
,
device
=
x
.
device
)
if
dropout_p
>
0.0
:
if
dropout_p
>
0.0
:
seeds
=
torch
.
randint
(
seeds
=
torch
.
randint
(
2
**
32
,
(
M
if
x1
is
None
else
2
*
M
,),
device
=
x
.
device
,
dtype
=
torch
.
int64
2
**
32
,
(
M
if
x1
is
None
else
2
*
M
,),
device
=
x
.
device
,
dtype
=
torch
.
int64
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment