本文整理汇总了C++中TVector::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TVector::clear方法的具体用法?C++ TVector::clear怎么用?C++ TVector::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TVector
的用法示例。
在下文中一共展示了TVector::clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcShapValuesForDocumentBlock
static TVector<TVector<double>> CalcShapValuesForDocumentBlock(const TFullModel& model,
const TPool& pool,
size_t start,
size_t end,
NPar::TLocalExecutor& localExecutor,
int dimension) {
CB_ENSURE(!HasComplexCtrs(model.ObliviousTrees), "Model uses complex Ctr features. This is not allowed for SHAP values calculation");
const TObliviousTrees& forest = model.ObliviousTrees;
const size_t documentCount = end - start;
TVector<ui8> allBinarizedFeatures = BinarizeFeatures(model, pool, start, end);
TVector<TVector<ui8>> binarizedFeaturesByDocument = TransposeBinarizedFeatures(allBinarizedFeatures, documentCount);
allBinarizedFeatures.clear();
const int flatFeatureCount = pool.Docs.GetFactorsCount();
TVector<int> binFeaturesMapping = MapFeatures(forest);
TVector<TVector<double>> shapValues(documentCount, TVector<double>(flatFeatureCount + 1, 0.0));
NPar::TLocalExecutor::TExecRangeParams blockParams(0, documentCount);
localExecutor.ExecRange([&] (int documentIdx) {
const size_t treeCount = forest.GetTreeCount();
for (size_t treeIdx = 0; treeIdx < treeCount; ++treeIdx) {
TVector<TVector<size_t>> subtreeSizes = CalcSubtreeSizesForTree(forest, treeIdx);
TVector<TFeaturePathElement> initialFeaturePath;
CalcShapValuesRecursive(forest, binFeaturesMapping, binarizedFeaturesByDocument[documentIdx], treeIdx, /*depth*/ 0, subtreeSizes, dimension,
/*nodeIdx*/ 0, initialFeaturePath, /*zeroPathFraction*/ 1, /*onePathFraction*/ 1, /*feature*/ -1,
&shapValues[documentIdx]);
shapValues[documentIdx][flatFeatureCount] += CalcMeanValueForTree(forest, subtreeSizes, treeIdx, dimension);
}
}, blockParams, NPar::TLocalExecutor::WAIT_COMPLETE);
return shapValues;
}
示例2: TestDriveUnlimited
void TestDriveUnlimited(){
{
TVector<A> uber;
A a;
A b(a);
uber.resize(18);
uber.push_back(a);
uber.reserve(32);
uber.resize(4);
uber.push_back(b);
uber.pop_back();
uber.clear();
}
cout << ((A::creat==0)?"All fine":"Red alert") << endl;
system("pause");
}
示例3: main
int main()
{
TVector<int> A;
A.PrintStat();
for (int i = 0; i < 35; ++i)
A.push_back(i);
A.PrintStat();
for (int i = 0; i < 5; ++i)
cout << " Pop: " << A.pop_back();
cout << endl;
A.PrintStat();
A.swap(5,6);
A.PrintStat();
TVector<int> B = A;
B.PrintStat();
A.clear();
A.PrintStat();
return 0;
}
示例4: clear
void clear() final {
m_vector.clear();
m_vector.shrink_to_fit();
}
示例5: clear
void clear() override final {
m_vector.clear();
m_vector.shrink_to_fit();
}