Browse Source

fix shape operator

pull/15495/head
l00591931 4 years ago
parent
commit
c4537b6343
2 changed files with 4 additions and 0 deletions
  1. +2
    -0
      mindspore/core/ops/shape.cc
  2. +2
    -0
      mindspore/core/ops/softmax.cc

+ 2
- 0
mindspore/core/ops/shape.cc View File

@@ -36,6 +36,8 @@ AbstractBasePtr ShapeInfer(const abstract::AnalysisEnginePtr &, const PrimitiveP
auto shape_map = CheckAndConvertUtils::ConvertShapePtrToShapeMap(input_args[0]->BuildShape());
auto in_shape = shape_map[kShape];
// infer type
std::set<TypePtr> valid_params_types = {kTensorType};
CheckAndConvertUtils::CheckSubClass("shape type", input_args[0]->BuildType(), valid_params_types, op_name);
AbstractBasePtrList abs_list;
std::transform(in_shape.begin(), in_shape.end(), std::back_inserter(abs_list),
[](int64_t item) -> std::shared_ptr<abstract::AbstractScalar> {


+ 2
- 0
mindspore/core/ops/softmax.cc View File

@@ -44,6 +44,7 @@ void Softmax::Init(const int64_t axis) {
this->set_axis(axis_vec);
}

namespace {
abstract::ShapePtr SoftMaxInferShape(const PrimitivePtr &primitive, const std::vector<AbstractBasePtr> &input_args) {
MS_EXCEPTION_IF_NULL(primitive);
auto op_name = primitive->name();
@@ -74,6 +75,7 @@ TypePtr SoftMaxInferType(const PrimitivePtr &prim, const std::vector<AbstractBas
const std::set<TypePtr> valid_types = {kFloat16, kFloat32, kFloat64};
return CheckAndConvertUtils::CheckTensorTypeValid("x", input_args[0]->BuildType(), valid_types, prim->name());
}
} // namespace

AbstractBasePtr SoftmaxInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
const std::vector<AbstractBasePtr> &input_args) {


Loading…
Cancel
Save