|
|
|
@ -32,7 +32,7 @@ int64_t GetCubeSizeByDataType(DataType data_type) {
|
|
|
|
|
if (size <= 0) {
|
|
|
|
|
std::string error = "Failed to get cube size, the data type " +
|
|
|
|
|
FmtToStr(TypeUtils::DataTypeToSerialString(data_type)) + " is invalid";
|
|
|
|
|
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
|
|
|
|
|
GE_WARNINGLOG_AND_ERRORMSG(error.c_str());
|
|
|
|
|
return -1;
|
|
|
|
|
} else if (size == 1) {
|
|
|
|
|
return kCubeSize * 2; // 32 bytes cube size
|
|
|
|
@ -61,7 +61,7 @@ bool CheckShapeValid(const std::vector<int64_t> &shape, const int64_t expect_dim
|
|
|
|
|
if (expect_dims <= 0 || shape.size() != static_cast<size_t>(expect_dims)) {
|
|
|
|
|
std::string error = "Invalid shape, dims num " + FmtToStr(shape.size()) +
|
|
|
|
|
", expect " + FmtToStr(expect_dims);
|
|
|
|
|
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
|
|
|
|
|
GE_WARNINGLOG_AND_ERRORMSG(error.c_str());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return IsShapeValid(shape);
|
|
|
|
@ -75,12 +75,12 @@ bool IsShapeValid(const std::vector<int64_t> &shape) {
|
|
|
|
|
for (auto dim : shape) {
|
|
|
|
|
if (dim < 0) {
|
|
|
|
|
std::string error = "Invalid negative dims in the shape " + FmtToStr(ShapeToString(shape));
|
|
|
|
|
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
|
|
|
|
|
GE_WARNINGLOG_AND_ERRORMSG(error.c_str());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (dim != 0 && kShapeItemNumMAX / dim < num) {
|
|
|
|
|
std::string error = "Shape overflow, the total count should be less than " + FmtToStr(kShapeItemNumMAX);
|
|
|
|
|
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
|
|
|
|
|
GE_WARNINGLOG_AND_ERRORMSG(error.c_str());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
num *= dim;
|
|
|
|
@ -108,7 +108,7 @@ bool IsTransShapeSrcCorrect(const TransArgs &args, std::vector<int64_t> &expect_
|
|
|
|
|
FmtToStr(TypeUtils::FormatToSerialString(args.dst_format)) + ", invalid relationship between src shape " +
|
|
|
|
|
FmtToStr(ShapeToString(args.src_shape)) + " and dst " +
|
|
|
|
|
FmtToStr(ShapeToString(args.dst_shape));
|
|
|
|
|
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
|
|
|
|
|
GE_WARNINGLOG_AND_ERRORMSG(error.c_str());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
@ -121,7 +121,7 @@ bool IsTransShapeDstCorrect(const TransArgs &args, std::vector<int64_t> &expect_
|
|
|
|
|
FmtToStr(TypeUtils::FormatToSerialString(args.dst_format)) + ", the dst shape" +
|
|
|
|
|
FmtToStr(ShapeToString(args.dst_shape)) + " is invalid, expect" +
|
|
|
|
|
FmtToStr(ShapeToString(expect_shape));
|
|
|
|
|
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
|
|
|
|
|
GE_WARNINGLOG_AND_ERRORMSG(error.c_str());
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|