@@ -130,7 +130,7 @@ Tensor _fusednbitrowwise_to_float_cpu(
130
130
(ncols - 2 * sizeof (at::Half)) * num_elem_per_byte;
131
131
132
132
Tensor output;
133
- if (std::is_same<output_t , float >::value) {
133
+ if constexpr (std::is_same<output_t , float >::value) {
134
134
output = at::empty (
135
135
{nrows, output_columns}, // 4 = sizeof(float)
136
136
input.options ().dtype (at::kFloat ));
@@ -167,15 +167,15 @@ Tensor _fusednbitrowwise_sbfront_to_float_or_half_cpu(
167
167
(ncols - 2 * sizeof (at::Half)) * num_elem_per_byte;
168
168
169
169
Tensor output;
170
- if (std::is_same<output_t , float >::value) {
170
+ if constexpr (std::is_same<output_t , float >::value) {
171
171
output = at::empty (
172
172
{nrows, output_columns}, // 4 = sizeof(float)
173
173
input.options ().dtype (at::kFloat ));
174
- } else if (std::is_same<output_t , at::Half>::value) {
174
+ } else if constexpr (std::is_same<output_t , at::Half>::value) {
175
175
output = at::empty (
176
176
{nrows, output_columns}, // 2 = sizeof(half)
177
177
input.options ().dtype (at::kHalf ));
178
- } else if (std::is_same<output_t , at::BFloat16>::value) {
178
+ } else if constexpr (std::is_same<output_t , at::BFloat16>::value) {
179
179
output = at::empty (
180
180
{nrows, output_columns}, // 2 = sizeof(half)
181
181
input.options ().dtype (at::kBFloat16 ));
@@ -258,7 +258,7 @@ Tensor float_or_half_to_fused8bitrowwise_cpu(const Tensor& input) {
258
258
input.options ().dtype (at::kByte )); // at::kBytes for uint8_t
259
259
FBGEMM_DISPATCH_FLOAT_AND_HALF (
260
260
input.scalar_type (), " float_or_half_to_fused8bitrowwise_cpu" , [&] {
261
- if (std::is_same<scalar_t , float >::value) {
261
+ if constexpr (std::is_same<scalar_t , float >::value) {
262
262
_float_to_fused8bitrowwise_cpu_out (output, input);
263
263
} else { // scalar_t = at::Half
264
264
_half_to_fused8bitrowwise_cpu_out (output, input);
@@ -419,7 +419,7 @@ Tensor float_or_half_to_fusednbitrowwise_cpu(
419
419
Tensor output;
420
420
FBGEMM_DISPATCH_FLOAT_AND_HALF (
421
421
input.scalar_type (), " float_or_half_to_fusednbitrowwise_cpu" , [&] {
422
- if (std::is_same<scalar_t , float >::value) {
422
+ if constexpr (std::is_same<scalar_t , float >::value) {
423
423
output = _float_to_fusednbitrowwise_cpu<float >(input, bit_rate);
424
424
} else { // scalar_t = at::Half
425
425
output =
0 commit comments