Bugfix: support unknown control op subgraph

pull/1322/head
lichun 4 years ago
parent 889b82354d
commit 5d0af86a07

@ -60,7 +60,7 @@ bool CheckShape(Format format, const ShapeVector &shape) {
default:
std::string error = "Trans format between " + FmtToStr(TypeUtils::FormatToSerialString(format)) +
" and FORMAT_FRACTAL_NZ is not supported.";
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_FORMAT_INVALID, error.c_str());
return false;
}
}

@ -59,7 +59,7 @@ bool CheckShape(Format format, const ShapeVector &shape) {
default:
std::string error = "Trans format between " + FmtToStr(TypeUtils::FormatToSerialString(format)) +
" and FORMAT_FRACTAL_ZZ is not supported.";
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_FORMAT_INVALID, error.c_str());
return false;
}
}

@ -92,7 +92,8 @@ Status CheckArgsForNhwcToNc1hwc0(const TransArgs &args) {
Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const int size, const int64_t total_size) {
std::shared_ptr<uint8_t> dst(new (std::nothrow) uint8_t[total_size], std::default_delete<uint8_t[]>());
if (dst == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"Failed to trans format from %s to %s, can not alloc the memory for dst buf %ld, shape %s",
TypeUtils::FormatToSerialString(args.src_format).c_str(),
TypeUtils::FormatToSerialString(args.dst_format).c_str(), total_size, ShapeToString(args.dst_shape).c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION;

@ -50,21 +50,21 @@ std::map<Format, std::map<Format, std::vector<int64_t>>> perm_args{
bool IsShapeArgValid(const std::vector<int64_t> &src_shape, const std::vector<int64_t> &perm_arg) {
if (src_shape.empty()) {
std::string error = "Failed to transpose, empty src shape";
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
GELOGE(PARAM_INVALID, "Failed to transpose, empty src shape");
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_SHAPE_INVALID, error.c_str());
GELOGE(ACL_ERROR_GE_SHAPE_INVALID, "Failed to transpose, empty src shape");
return false;
}
for (auto dim : src_shape) {
if (dim < 0) {
std::string error = "Failed to transpose, negative dim in src shape " + FmtToStr(ShapeToString(src_shape));
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_SHAPE_INVALID, error.c_str());
return false;
}
}
if (perm_arg.size() != src_shape.size()) {
std::string error = "Failed to transpose, the size of src shape" + FmtToStr(src_shape.size()) +
" and perm arg" + FmtToStr(perm_arg.size()) + " are different";
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_SHAPE_INVALID, error.c_str());
return false;
}
@ -73,7 +73,7 @@ bool IsShapeArgValid(const std::vector<int64_t> &src_shape, const std::vector<in
if (perm < 0 || static_cast<size_t>(perm) >= perm_arg.size() || ++exists[perm] > 1) {
std::string error = "Failed to transpose, duplicated perm arg " + FmtToStr(perm) +
", perm arg " + FmtToStr(JoinToString(perm_arg));
GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error.c_str());
GE_ERRORLOG_AND_ERRORMSG(ACL_ERROR_GE_PARAM_INVALID, error.c_str());
return false;
}
}
@ -82,11 +82,11 @@ bool IsShapeArgValid(const std::vector<int64_t> &src_shape, const std::vector<in
bool IsTransposeArgValid(const uint8_t *src, const std::vector<int64_t> &src_shape, DataType src_data_type,
const std::vector<int64_t> &perm_arg) {
if (src == nullptr) {
GELOGE(PARAM_INVALID, "Failed to transpose, the src is null");
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Failed to transpose, the src is null");
return false;
}
if (GetSizeByDataType(src_data_type) < 0) {
GELOGE(UNSUPPORTED, "Failed to transpose, the data type %s is not support",
GELOGE(ACL_ERROR_GE_DATATYPE_INVALID, "Failed to transpose, the data type %s is not support",
TypeUtils::DataTypeToSerialString(src_data_type).c_str());
return false;
}

Loading…
Cancel
Save