diff --git a/fbgemm_gpu/src/sparse_ops/sparse_ops_cpu.cpp b/fbgemm_gpu/src/sparse_ops/sparse_ops_cpu.cpp index be32cc2c4d..1be2fc8930 100644 --- a/fbgemm_gpu/src/sparse_ops/sparse_ops_cpu.cpp +++ b/fbgemm_gpu/src/sparse_ops/sparse_ops_cpu.cpp @@ -306,7 +306,8 @@ void _block_bucketize_sparse_features_cpu( const index_t* const block_sizes_data = block_sizes.data_ptr(); offset_t* batch_sizes_data = nullptr; const auto variable_batch_size = batch_size_per_feature.has_value(); - const auto variable_bucket_sizes = block_bucketize_pos.has_value(); + const auto variable_bucket_sizes = block_bucketize_pos.has_value() && + block_bucketize_pos.value().size() != 0; using uindex_t = std::make_unsigned_t; using uoffset_t = std::make_unsigned_t; std::vector lower_bounds(indices.numel(), 0);