| 8 | template <typename TFloatFeatureAccessor, typename TCatFeatureAccessor, |
| 9 | typename TTextFeatureAccessor, typename TEmbeddingFeatureAccessor> |
| 10 | inline void CalcGeneric( |
| 11 | const TModelTrees& trees, |
| 12 | const TModelTrees::TForApplyData& applyData, |
| 13 | const TIntrusivePtr<ICtrProvider>& ctrProvider, |
| 14 | const TIntrusivePtr<TTextProcessingCollection>& textProcessingCollection, |
| 15 | const TIntrusivePtr<TEmbeddingProcessingCollection>& embeddingProcessingCollection, |
| 16 | TFloatFeatureAccessor floatFeatureAccessor, |
| 17 | TCatFeatureAccessor catFeaturesAccessor, |
| 18 | TTextFeatureAccessor textFeatureAccessor, |
| 19 | TEmbeddingFeatureAccessor embeddingFeatureAccessor, |
| 20 | size_t docCount, |
| 21 | size_t treeStart, |
| 22 | size_t treeEnd, |
| 23 | EPredictionType predictionType, |
| 24 | TArrayRef<double> results, |
| 25 | const NCB::NModelEvaluation::TFeatureLayout* featureInfo = nullptr |
| 26 | ) { |
| 27 | const size_t blockSize = Min(FORMULA_EVALUATION_BLOCK_SIZE, docCount); |
| 28 | auto calcTrees = GetCalcTreesFunction(trees, blockSize); |
| 29 | if (trees.GetTreeCount() == 0) { |
| 30 | auto biasRef = trees.GetScaleAndBias().GetBiasRef(); |
| 31 | if (biasRef.size() == 1) { |
| 32 | Fill(results.begin(), results.end(), biasRef[0]); |
| 33 | } else { |
| 34 | for (size_t idx = 0; idx < results.size();) { |
| 35 | for (size_t dim = 0; dim < biasRef.size(); ++dim, ++idx) { |
| 36 | results[idx] = biasRef[dim]; |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | return; |
| 41 | } |
| 42 | Fill(results.begin(), results.end(), 0.0); |
| 43 | TVector<TCalcerIndexType> indexesVec(blockSize); |
| 44 | TEvalResultProcessor resultProcessor( |
| 45 | docCount, |
| 46 | results, |
| 47 | predictionType, |
| 48 | trees.GetScaleAndBias(), |
| 49 | trees.GetDimensionsCount(), |
| 50 | blockSize |
| 51 | ); |
| 52 | ui32 blockId = 0; |
| 53 | ProcessDocsInBlocks( |
| 54 | trees, |
| 55 | ctrProvider, |
| 56 | textProcessingCollection, |
| 57 | embeddingProcessingCollection, |
| 58 | floatFeatureAccessor, |
| 59 | catFeaturesAccessor, |
| 60 | textFeatureAccessor, |
| 61 | embeddingFeatureAccessor, |
| 62 | docCount, |
| 63 | blockSize, |
| 64 | [&] (size_t docCountInBlock, const TCPUEvaluatorQuantizedData* quantizedData) { |
| 65 | auto blockResultsView = resultProcessor.GetViewForRawEvaluation(blockId); |
| 66 | calcTrees( |
| 67 | trees, |
no test coverage detected