!48401 RGBToHSV算子异常入参导致报错Segmentation fault

Merge pull request !48401 from ligan/rgb_to_hsv_bug
This commit is contained in:
i-robot 2023-02-06 07:52:37 +00:00 committed by Gitee
commit a778cfd062
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 5 additions and 2 deletions

View File

@ -23,12 +23,15 @@ namespace mindspore {
namespace ops {
namespace {
abstract::ShapePtr RGBToHSVInferShape(const PrimitivePtr &primitive, const std::vector<AbstractBasePtr> &input_args) {
const auto &build_shape = input_args[0]->BuildShape();
if (build_shape->IsDimZero()) {
MS_LOG(EXCEPTION) << "For '" << primitive->name() << "', the shape of input can not be empty.";
}
auto input_shape = CheckAndConvertUtils::ConvertShapePtrToShapeMap(input_args[0]->BuildShape())[kShape];
auto input_shape_ptr = input_args[0]->BuildShape();
if (IsDynamicRank(input_shape)) {
return std::make_shared<abstract::Shape>(std::vector<int64_t>{-2});
}
if (!input_shape_ptr->IsDynamic()) {
if (!build_shape->IsDynamic()) {
const int64_t input_dims = SizeToLong(input_shape.size());
const int64_t input_last_dims = input_shape.cend()[-1];
const int64_t numberofRGB_3 = 3;