Skip to content

Commit

Permalink
[ minor ] bugfix in model_commo_properties / LossScale
Browse files Browse the repository at this point in the history
- This commit fixes a minor error to print error log.
- This commit adds a condition to print the error log.

Signed-off-by: Eunju Yang <[email protected]>
  • Loading branch information
EunjuYang authored and myungjoo committed Dec 20, 2024
1 parent e5bf9d2 commit 18635c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nntrainer/models/model_common_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ ModelTensorDataType::ModelTensorDataType(ModelTensorDataTypeInfo::Enum value) {
LossScale::LossScale(float value) { set(value); }

bool LossScale::isValid(const float &value) const {
ml_loge("Loss scale cannot be 0");
return value != 0;
bool is_valid = (std::fpclassify(value) != FP_ZERO);
if (!is_valid)
ml_loge("Loss scale cannot be 0");
return is_valid;
}

} // namespace nntrainer::props

0 comments on commit 18635c2

Please sign in to comment.