/** * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "pipeline/static_analysis/prim.h" #include "operator/ops.h" #include "pipeline/static_analysis/utils.h" #include "pipeline/static_analysis/param_validator.h" #include "common/utils.h" namespace mindspore { namespace abstract { AbstractBasePtr InferImplMinOrMaxGrad(const AnalysisEnginePtr &, const PrimitivePtr &primitive, const AbstractBasePtrList &args_spec_list) { // Inputs: three tensors. const std::string op_name = primitive->name(); CheckArgsSize(op_name, args_spec_list, 3); auto input_x = CheckArg(op_name, args_spec_list, 0); auto input_y = CheckArg(op_name, args_spec_list, 1); auto dout = CheckArg(op_name, args_spec_list, 2); (void)CheckTensorsDTypeSame({input_x, input_y, dout}, {kInt, kUInt, kFloat}, op_name + "evaluator three inputs should be %s"); AbstractBasePtr dx = input_x->Broaden(); AbstractBasePtr dy = input_y->Broaden(); return std::make_shared(AbstractBasePtrList({dx, dy})); } } // namespace abstract } // namespace mindspore