• 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 "src/runtime/kernel/arm/fp32/zeroslike_fp32.h"
18 #include "schema/model_generated.h"
19 #include "nnacl/base/zeroslike_base.h"
20 #include "src/kernel_registry.h"
21 #include "include/errorcode.h"
22 
23 using mindspore::kernel::KERNEL_ARCH;
24 using mindspore::lite::KernelRegistrar;
25 using mindspore::lite::RET_ERROR;
26 using mindspore::lite::RET_OK;
27 using mindspore::schema::PrimitiveType_ZerosLike;
28 
29 namespace mindspore::kernel {
Init()30 int ZerosLikeCPUKernel::Init() {
31   CHECK_LESS_RETURN(in_tensors_.size(), 1);
32   CHECK_LESS_RETURN(out_tensors_.size(), 1);
33   return RET_OK;
34 }
35 
Run()36 int ZerosLikeCPUKernel::Run() {
37   auto output_data = static_cast<float *>(out_tensors_[0]->data());
38   ApproximateZerosLike(output_data, in_tensors_[0]->ElementsNum(), sizeof(float));
39   return RET_OK;
40 }
41 
42 REG_KERNEL(kCPU, kNumberTypeFloat32, PrimitiveType_ZerosLike, LiteKernelCreator<ZerosLikeCPUKernel>)
43 }  // namespace mindspore::kernel
44