Skip to content

Commit c8a2749

Browse files
metascroyfacebook-github-bot
authored andcommitted
Header bug fix
Summary: A last minute change created a compile error on the header. This fixes the issue. Differential Revision: D64370707
1 parent b53694a commit c8a2749

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

torchao/experimental/ops/linear_8bit_act_xbit_weight/packed_weights_header.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,18 @@
1111
namespace torchao::ops::linear_8bit_act_xbit_weight {
1212

1313
torchao::ops::PackedWeightsHeader get_packed_weights_header_universal(
14-
int weight_nbit,
14+
unsigned char weight_nbit,
1515
bool has_weight_zeros,
1616
bool has_bias,
17-
int nr,
18-
int kr,
19-
int version = 1) {
20-
TORCHAO_CHECK(
21-
version >= 0 && version < 256, "version must be between 0 and 255");
22-
TORCHAO_CHECK(
23-
weight_nbit >= 1 && weight_nbit < 256,
24-
"weight_nbit must be between 1 and 255");
17+
unsigned short nr,
18+
unsigned short kr,
19+
unsigned char version = 1) {
2520
return torchao::ops::PackedWeightsHeader(
2621
torchao::ops::PackedWeightsFormat::linear_8bit_act_xbit_weight_universal,
27-
{((static_cast<unsigned short>(version) << 8) |
28-
static_cast<unsigned short>(weight_nbit)),
29-
((static_cast<unsigned short>(has_weight_zeros) << 8) |
30-
static_cast<unsigned short>(has_bias)),
31-
static_cast<unsigned short>(nr),
32-
static_cast<unsigned short>(kr),
33-
0,
22+
{static_cast<unsigned short>((version << 8) | weight_nbit),
23+
static_cast<unsigned short>((has_weight_zeros << 8) | has_bias),
24+
nr,
25+
kr,
3426
0,
3527
0,
3628
0});

0 commit comments

Comments
 (0)