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
chenpangpang
transformers
Commits
8d2f953f
Unverified
Commit
8d2f953f
authored
Aug 18, 2023
by
Kashif Rasul
Committed by
GitHub
Aug 18, 2023
Browse files
[Time series Informer] fix dtype of cumsum (#25431)
* fix dtype of cumsum * add comment
parent
bc3e20dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
src/transformers/models/informer/modeling_informer.py
src/transformers/models/informer/modeling_informer.py
+2
-1
No files found.
src/transformers/models/informer/modeling_informer.py
View file @
8d2f953f
...
@@ -647,7 +647,8 @@ class InformerProbSparseAttention(nn.Module):
...
@@ -647,7 +647,8 @@ class InformerProbSparseAttention(nn.Module):
# calculate context for updating the attn_output, based on:
# calculate context for updating the attn_output, based on:
# https://github.com/zhouhaoyi/Informer2020/blob/ac59c7447135473fb2aafeafe94395f884d5c7a5/models/attn.py#L74
# https://github.com/zhouhaoyi/Informer2020/blob/ac59c7447135473fb2aafeafe94395f884d5c7a5/models/attn.py#L74
if
self
.
is_decoder
:
if
self
.
is_decoder
:
context
=
value_states
.
cumsum
(
dim
=-
2
)
# cast to float32 before operation to avoid overflow
context
=
value_states
.
cumsum
(
dim
=-
2
,
dtype
=
torch
.
float32
).
to
(
value_states
.
dtype
)
else
:
else
:
v_mean_dim_time
=
value_states
.
mean
(
dim
=-
2
)
v_mean_dim_time
=
value_states
.
mean
(
dim
=-
2
)
context
=
(
context
=
(
...
...
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