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
OpenDAS
TransformerEngine
Commits
4cc47ca6
Commit
4cc47ca6
authored
Jun 19, 2025
by
wenjh
Browse files
Merge branch 'develop_v2.4'
parents
e704bbc8
8eff19c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
tests/pytorch/references/blockwise_quantizer_reference.py
tests/pytorch/references/blockwise_quantizer_reference.py
+6
-0
No files found.
tests/pytorch/references/blockwise_quantizer_reference.py
View file @
4cc47ca6
...
...
@@ -130,6 +130,12 @@ class BlockwiseQuantizerReference:
)
qx
=
x_tiled
*
scale
.
reshape
(
M
//
tile_len
,
1
,
K
//
tile_len
,
1
)
qx
=
torch
.
clamp
(
qx
,
min
=-
dtype_max
,
max
=
dtype_max
)
if
quant_dtype
==
torch
.
int8
:
positive_mask
=
qx
>=
0
negative_mask
=
~
positive_mask
pos_part
=
torch
.
where
(
positive_mask
,
torch
.
floor
(
qx
+
0.5
),
0
)
neg_part
=
torch
.
where
(
negative_mask
,
torch
.
ceil
(
qx
-
0.5
),
0
)
qx
=
pos_part
+
neg_part
qx
=
qx
.
to
(
dtype
=
quant_dtype
)
qx
=
qx
.
reshape
(
M
,
K
)
if
unpadded_k
!=
K
or
unpadded_m
!=
M
:
...
...
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