| 304 | } |
| 305 | |
| 306 | void NCatboostCuda::TTreeCtrDataSetsHelper::AddDataSetPacks(const NCatboostCuda::TFeatureTensor& baseTensor, |
| 307 | const TSingleBuffer<const ui32>& baseTensorIndices, |
| 308 | ui32 deviceId, |
| 309 | TVector<NCatboostCuda::TTreeCtrDataSetsHelper::TTreeCtrDataSetPtr>& dst) { |
| 310 | const auto& catFeatures = DataSet.GetCatFeatures(); |
| 311 | auto& devFeatures = catFeatures.GetDeviceFeatures(deviceId); |
| 312 | if (devFeatures.size() == 0) { |
| 313 | return; |
| 314 | } |
| 315 | const ui32 maxPackSize = PackSizeEstimators[deviceId]->GetMaxPackSize(); |
| 316 | CB_ENSURE(maxPackSize, "Error: not enough memory for building ctrs"); |
| 317 | |
| 318 | const ui32 currentDstSize = static_cast<const ui32>(dst.size()); |
| 319 | dst.push_back(MakeHolder<TTreeCtrDataSet>(FeaturesManager, |
| 320 | baseTensor, |
| 321 | baseTensorIndices)); |
| 322 | |
| 323 | ui32 packSize = 0; |
| 324 | for (auto feature : devFeatures) { |
| 325 | auto& nextDataSet = dst.back(); |
| 326 | auto tensor = baseTensor; |
| 327 | tensor.AddCatFeature(feature); |
| 328 | if (tensor == baseTensor || !FeaturesManager.UseForTreeCtr(tensor)) { |
| 329 | continue; |
| 330 | } |
| 331 | nextDataSet->AddCatFeature(feature); |
| 332 | ++packSize; |
| 333 | |
| 334 | if (packSize >= maxPackSize) { |
| 335 | dst.push_back(MakeHolder<TTreeCtrDataSet>(FeaturesManager, |
| 336 | baseTensor, |
| 337 | baseTensorIndices)); |
| 338 | packSize = 0; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | if (dst.back()->CatFeatures.size() == 0) { |
| 343 | dst.pop_back(); |
| 344 | } |
| 345 | for (ui32 i = currentDstSize; i < dst.size(); ++i) { |
| 346 | dst[i]->BuildFeatureIndex(); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | NCatboostCuda::TFeatureTensorTracker NCatboostCuda::TTreeCtrDataSetsHelper::CreateEmptyTrackerForTensor(const NCatboostCuda::TFeatureTensor& tensor) { |
| 351 | ui64 maxSize = 0; |
nothing calls this directly
no test coverage detected