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
jerrrrry
infinicore
Commits
31e54f93
Commit
31e54f93
authored
Jun 26, 2025
by
Catheriany
Browse files
issue/282: 添加max_reduction测试
parent
53468445
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
test/infiniop/causal_softmax.py
test/infiniop/causal_softmax.py
+3
-1
No files found.
test/infiniop/causal_softmax.py
View file @
31e54f93
...
@@ -30,6 +30,7 @@ _TEST_CASES_ = [
...
@@ -30,6 +30,7 @@ _TEST_CASES_ = [
((
32
,
5
,
5
),
None
,
None
),
((
32
,
5
,
5
),
None
,
None
),
((
32
,
20
,
512
),
None
,
None
),
((
32
,
20
,
512
),
None
,
None
),
((
32
,
20
,
512
),
(
20480
,
512
,
1
),
None
),
((
32
,
20
,
512
),
(
20480
,
512
,
1
),
None
),
((
28
,
15
,
15
),
None
,
None
),
]
]
# Data types used for testing
# Data types used for testing
...
@@ -93,7 +94,8 @@ def test(
...
@@ -93,7 +94,8 @@ def test(
)
)
x
=
torch
.
rand
(
shape
,
dtype
=
dtype
).
to
(
torch_device
)
x
=
torch
.
rand
(
shape
,
dtype
=
dtype
).
to
(
torch_device
)
mask
=
torch
.
tril
(
torch
.
ones_like
(
x
),
diagonal
=-
1
).
flip
(
dims
=
[
-
2
,
-
1
])
x
=
torch
.
where
(
mask
==
1
,
torch
.
full_like
(
x
,
torch
.
finfo
(
x
.
dtype
).
max
),
x
)
ans
=
causal_softmax
(
x
)
ans
=
causal_softmax
(
x
)
x
=
rearrange_if_needed
(
x
,
x_stride
)
x
=
rearrange_if_needed
(
x
,
x_stride
)
...
...
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