@@ -1027,48 +1027,14 @@ XGB_DLL int XGBoosterInplacePredict(BoosterHandle handle,
1027
1027
API_BEGIN ();
1028
1028
CHECK_HANDLE ();
1029
1029
xgboost::bst_ulong out_dim;
1030
- std::shared_ptr<xgboost::data::DenseAdapter> x{new xgboost::data::DenseAdapter (data, num_rows, num_features)};
1031
- // std::shared_ptr<DMatrix> p_m(dMatrixHandle);
1032
- std::shared_ptr<DMatrix> p_m{nullptr };
1033
- /* if (!dMatrixHandle) {
1034
- fprintf (stderr, "dMatrixHandle is null");
1035
- exit(1);
1036
- }*/
1037
- if (!dMatrixHandle) {
1038
- p_m.reset (new data::DMatrixProxy);
1039
- // fprintf (stdout, "dmatrix handle is null");
1040
- if (!p_m) {
1041
- fprintf (stderr, " p_m 1 is null" );
1042
- exit (1 );
1043
- }
1044
- } else {
1045
- p_m = *static_cast <std::shared_ptr<DMatrix> *>(dMatrixHandle);
1046
- // fprintf (stdout, "dmatrix handle is not null");
1047
- if (!p_m) {
1048
- fprintf (stderr, " p_m 2 is null" );
1049
- exit (1 );
1050
- }
1051
- }
1052
- // fprintf (stdout, reinterpret_cast<const char *>(p_m.get()));
1053
- p_m.reset (new data::DMatrixProxy);
1054
- auto stuff = dynamic_cast <data::DMatrixProxy *>(p_m.get ());
1055
- auto proxy = new std::shared_ptr<xgboost::data::DMatrixProxy>(new xgboost::data::DMatrixProxy);
1056
- // printf ("stuff is %s", typeid(stuff).name());
1057
- // printf ("proxy is %s", typeid(proxy).name());
1058
- if (!proxy) {
1059
- fprintf (stderr, " proxy is null line 1058" );
1060
- exit (1 );
1061
- }
1062
- if (!stuff) {
1063
- fprintf (stderr, " stuff is null line 1062" );
1064
- exit (1 );
1065
- }
1030
+
1031
+ auto *proxy = new data::DMatrixProxy;
1066
1032
auto *learner = static_cast <xgboost::Learner *>(handle);
1067
1033
auto iteration_end = GetIterationFromTreeLimit (ntree_limit, learner);
1068
- stuff->SetDenseData (data, num_rows, num_features);
1034
+ proxy->SetDenseData (data, num_rows, num_features);
1035
+ std::shared_ptr<DMatrix> p_m{proxy};
1069
1036
InplacePredictImplCore (p_m, learner, (xgboost::PredictionType)0 , missing, num_rows, num_features,
1070
1037
0 , iteration_end, true , len, &out_dim, out_result);
1071
- // printf("XGBoosterInplacePredict len = %u, dim = %u\n", **len, out_dim);
1072
1038
API_END ();
1073
1039
}
1074
1040
0 commit comments