1 /**
2 * Copyright 2019 Huawei Technologies Co., Ltd
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "abstract/param_validator.h"
18 #include "abstract/infer_functions.h"
19 #include "abstract/utils.h"
20 #include "utils/symbolic.h"
21
22 namespace mindspore {
23 namespace abstract {
InferImplDebug(const AnalysisEnginePtr &,const PrimitivePtr & primitive,const AbstractBasePtrList & args_spec_list)24 AbstractBasePtr InferImplDebug(const AnalysisEnginePtr &, const PrimitivePtr &primitive,
25 const AbstractBasePtrList &args_spec_list) {
26 // Inputs: a tensor(value)
27 const std::string op_name = primitive->name();
28
29 CheckArgsSize(op_name, args_spec_list, 1);
30 auto tensor_value = CheckArg<AbstractTensor>(op_name, args_spec_list, 0);
31
32 int64_t tensor_rank = SizeToLong(tensor_value->shape()->shape().size());
33 if (tensor_rank == 0) {
34 MS_LOG(EXCEPTION) << op_name << " summary evaluator second arg should be an tensor, but got a scalar, rank is 0";
35 }
36
37 return std::make_shared<AbstractTuple>(AbstractBasePtrList({tensor_value->Broaden()}));
38 }
39 } // namespace abstract
40 } // namespace mindspore
41