File tree Expand file tree Collapse file tree 1 file changed +8
-16
lines changed
torchao/experimental/ops/linear_8bit_act_xbit_weight Expand file tree Collapse file tree 1 file changed +8
-16
lines changed Original file line number Diff line number Diff line change 1111namespace torchao ::ops::linear_8bit_act_xbit_weight {
1212
1313torchao::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 });
You can’t perform that action at this time.
0 commit comments