• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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 "ops/assert.h"
18 #include "mindapi/base/shared_ptr.h"
19 #include "mindapi/ir/value.h"
20 #include "mindapi/src/helper.h"
21 #include "ops/op_name.h"
22 #include "ops/primitive_c.h"
23 #include "utils/log_adapter.h"
24 
25 namespace mindspore {
26 namespace ops {
27 MIND_API_OPERATOR_IMPL(Assert, BaseOperator);
Init(const int64_t summarize)28 void Assert::Init(const int64_t summarize) { set_summarize(summarize); }
29 
set_summarize(const int64_t summarize)30 void Assert::set_summarize(const int64_t summarize) { (void)this->AddAttr(kSummarize, api::MakeValue(summarize)); }
31 
get_summarize() const32 int64_t Assert::get_summarize() const {
33   auto value_ptr = GetAttr(kSummarize);
34   return GetValue<int64_t>(value_ptr);
35 }
36 
37 REGISTER_PRIMITIVE_C(kNameAssert, Assert);
38 }  // namespace ops
39 }  // namespace mindspore
40