Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
37ce3eb2
Unverified
Commit
37ce3eb2
authored
Feb 25, 2020
by
Nikita Titov
Committed by
GitHub
Feb 25, 2020
Browse files
replace std::runtime_error with Log::Fatal (#2816)
* replace std::runtime_error with Log::Fatal * Update c_api.cpp
parent
73dc1bbd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
src/boosting/prediction_early_stop.cpp
src/boosting/prediction_early_stop.cpp
+1
-1
src/c_api.cpp
src/c_api.cpp
+5
-5
src/io/dataset.cpp
src/io/dataset.cpp
+1
-1
No files found.
src/boosting/prediction_early_stop.cpp
View file @
37ce3eb2
...
@@ -81,7 +81,7 @@ PredictionEarlyStopInstance CreatePredictionEarlyStopInstance(const std::string&
...
@@ -81,7 +81,7 @@ PredictionEarlyStopInstance CreatePredictionEarlyStopInstance(const std::string&
}
else
if
(
type
==
"binary"
)
{
}
else
if
(
type
==
"binary"
)
{
return
CreateBinary
(
config
);
return
CreateBinary
(
config
);
}
else
{
}
else
{
throw
std
::
runtime_error
(
"Unknown early stopping type:
"
+
type
);
Log
::
Fatal
(
"Unknown early stopping type:
%s"
,
type
.
c_str
()
);
}
}
}
}
...
...
src/c_api.cpp
View file @
37ce3eb2
...
@@ -1130,7 +1130,7 @@ int LGBM_DatasetSetField(DatasetHandle handle,
...
@@ -1130,7 +1130,7 @@ int LGBM_DatasetSetField(DatasetHandle handle,
}
else
if
(
type
==
C_API_DTYPE_FLOAT64
)
{
}
else
if
(
type
==
C_API_DTYPE_FLOAT64
)
{
is_success
=
dataset
->
SetDoubleField
(
field_name
,
reinterpret_cast
<
const
double
*>
(
field_data
),
static_cast
<
int32_t
>
(
num_element
));
is_success
=
dataset
->
SetDoubleField
(
field_name
,
reinterpret_cast
<
const
double
*>
(
field_data
),
static_cast
<
int32_t
>
(
num_element
));
}
}
if
(
!
is_success
)
{
throw
std
::
runtime_error
(
"Input data type error or field not found"
);
}
if
(
!
is_success
)
{
Log
::
Fatal
(
"Input data type error or field not found"
);
}
API_END
();
API_END
();
}
}
...
@@ -1152,7 +1152,7 @@ int LGBM_DatasetGetField(DatasetHandle handle,
...
@@ -1152,7 +1152,7 @@ int LGBM_DatasetGetField(DatasetHandle handle,
*
out_type
=
C_API_DTYPE_FLOAT64
;
*
out_type
=
C_API_DTYPE_FLOAT64
;
is_success
=
true
;
is_success
=
true
;
}
}
if
(
!
is_success
)
{
throw
std
::
runtime_error
(
"Field not found"
);
}
if
(
!
is_success
)
{
Log
::
Fatal
(
"Field not found"
);
}
if
(
*
out_ptr
==
nullptr
)
{
*
out_len
=
0
;
}
if
(
*
out_ptr
==
nullptr
)
{
*
out_len
=
0
;
}
API_END
();
API_END
();
}
}
...
@@ -1802,7 +1802,7 @@ RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_
...
@@ -1802,7 +1802,7 @@ RowFunctionFromDenseMatric(const void* data, int num_row, int num_col, int data_
};
};
}
}
}
}
throw
std
::
runtime_error
(
"Unknown data type in RowFunctionFromDenseMatric"
);
Log
::
Fatal
(
"Unknown data type in RowFunctionFromDenseMatric"
);
}
}
std
::
function
<
std
::
vector
<
std
::
pair
<
int
,
double
>>
(
int
row_idx
)
>
std
::
function
<
std
::
vector
<
std
::
pair
<
int
,
double
>>
(
int
row_idx
)
>
...
@@ -1906,7 +1906,7 @@ RowFunctionFromCSR(const void* indptr, int indptr_type, const int32_t* indices,
...
@@ -1906,7 +1906,7 @@ RowFunctionFromCSR(const void* indptr, int indptr_type, const int32_t* indices,
};
};
}
}
}
}
throw
std
::
runtime_error
(
"Unknown data type in RowFunctionFromCSR"
);
Log
::
Fatal
(
"Unknown data type in RowFunctionFromCSR"
);
}
}
std
::
function
<
std
::
pair
<
int
,
double
>
(
int
idx
)
>
std
::
function
<
std
::
pair
<
int
,
double
>
(
int
idx
)
>
...
@@ -1971,7 +1971,7 @@ IterateFunctionFromCSC(const void* col_ptr, int col_ptr_type, const int32_t* ind
...
@@ -1971,7 +1971,7 @@ IterateFunctionFromCSC(const void* col_ptr, int col_ptr_type, const int32_t* ind
};
};
}
}
}
}
throw
std
::
runtime_error
(
"Unknown data type in CSC matrix"
);
Log
::
Fatal
(
"Unknown data type in CSC matrix"
);
}
}
CSC_RowIterator
::
CSC_RowIterator
(
const
void
*
col_ptr
,
int
col_ptr_type
,
const
int32_t
*
indices
,
CSC_RowIterator
::
CSC_RowIterator
(
const
void
*
col_ptr
,
int
col_ptr_type
,
const
int32_t
*
indices
,
...
...
src/io/dataset.cpp
View file @
37ce3eb2
...
@@ -1487,7 +1487,7 @@ void PushClearIfEmpty(std::vector<T>* dest, const size_t dest_len,
...
@@ -1487,7 +1487,7 @@ void PushClearIfEmpty(std::vector<T>* dest, const size_t dest_len,
void
Dataset
::
AddFeaturesFrom
(
Dataset
*
other
)
{
void
Dataset
::
AddFeaturesFrom
(
Dataset
*
other
)
{
if
(
other
->
num_data_
!=
num_data_
)
{
if
(
other
->
num_data_
!=
num_data_
)
{
throw
std
::
runtime_error
(
Log
::
Fatal
(
"Cannot add features from other Dataset with a different number of "
"Cannot add features from other Dataset with a different number of "
"rows"
);
"rows"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment