error message add format

pull/311/head
wangwenhua1@huawei.com 4 years ago
parent 297f87423c
commit fdefa146ac

@ -141,7 +141,7 @@ Status DataTypeTransfer::TransDataType(const CastArgs &args, TransResult &result
} }
if (args.src_data_size > static_cast<size_t>(SIZE_MAX / size)) { if (args.src_data_size > static_cast<size_t>(SIZE_MAX / size)) {
std::string error = "args.src_data_size" + FmtToStr(args.src_data_size) + std::string error = "args.src_data_size" + FmtToStr(args.src_data_size) +
" or data type size" + FmtToStr(std::to_string(size)) + " is too big"; " or data type size" + FmtToStr(size) + " is too big";
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str()); GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
return PARAM_INVALID; return PARAM_INVALID;
} }

@ -59,7 +59,7 @@ int64_t GetItemNumByShape(const std::vector<int64_t> &shape) {
bool CheckShapeValid(const std::vector<int64_t> &shape, const int64_t expect_dims) { bool CheckShapeValid(const std::vector<int64_t> &shape, const int64_t expect_dims) {
if (expect_dims <= 0 || shape.size() != static_cast<size_t>(expect_dims)) { if (expect_dims <= 0 || shape.size() != static_cast<size_t>(expect_dims)) {
std::string error = " Invalid shape, dims num " + FmtToStr(shape.size()) + std::string error = "Invalid shape, dims num " + FmtToStr(shape.size()) +
", expect " + FmtToStr(expect_dims); ", expect " + FmtToStr(expect_dims);
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str()); GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
return false; return false;
@ -74,7 +74,7 @@ bool IsShapeValid(const std::vector<int64_t> &shape) {
int64_t num = 1; int64_t num = 1;
for (auto dim : shape) { for (auto dim : shape) {
if (dim < 0) { if (dim < 0) {
std::string error = "Invalid negative dims in the shape " + FmtToStr(ShapeToString(shape)); std::string error = "Invalid negative dims in the shape " + FmtToStr(ShapeToString(shape));
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str()); GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
return false; return false;
} }

Loading…
Cancel
Save