| 24 | } |
| 25 | |
| 26 | IDynamicBlockIteratorBasePtr TExternalFloatValuesHolder::GetBlockIterator(ui32 offset) const { |
| 27 | const auto floatFeatureIdx = QuantizedFeaturesInfo->GetPerTypeFeatureIdx<EFeatureType::Float>(*this); |
| 28 | const auto nanMode = QuantizedFeaturesInfo->GetNanMode(floatFeatureIdx); |
| 29 | |
| 30 | // it's ok even if it is learn data, for learn nans are checked at CalcBordersAndNanMode stage |
| 31 | bool allowNans = (nanMode != ENanMode::Forbidden) || |
| 32 | QuantizedFeaturesInfo->GetFloatFeaturesAllowNansInTestOnly(); |
| 33 | auto featureIdx = GetId(); |
| 34 | |
| 35 | auto transformer = [ |
| 36 | allowNans, nanMode, featureIdx, |
| 37 | bordersArrRef = MakeArrayRef(QuantizedFeaturesInfo->GetBorders(floatFeatureIdx)) |
| 38 | ] (TConstArrayRef<float> src, auto& dst) { |
| 39 | QuantizeBlock( |
| 40 | src, |
| 41 | allowNans, |
| 42 | nanMode, |
| 43 | featureIdx, |
| 44 | bordersArrRef, |
| 45 | MakeArrayRef(dst) |
| 46 | ); |
| 47 | }; |
| 48 | if (QuantizedFeaturesInfo->GetBorders(floatFeatureIdx).size() < 256) { |
| 49 | return MakeBlockTransformerIterator<ui8>( |
| 50 | SrcData->GetBlockIterator(offset), |
| 51 | std::move(transformer) |
| 52 | ); |
| 53 | } else { |
| 54 | return MakeBlockTransformerIterator<ui16>( |
| 55 | SrcData->GetBlockIterator(offset), |
| 56 | std::move(transformer) |
| 57 | ); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | |
| 62 | THolder<IFeatureValuesHolder> TExternalCatValuesHolder::CloneWithNewSubsetIndexing( |
no test coverage detected