1 /** 2 * Copyright 2019-2021 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 #ifndef MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_ 18 #define MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_ 19 20 #include <vector> 21 #include <memory> 22 23 #include "backend/kernel_compiler/cpu/cpu_kernel.h" 24 #include "backend/kernel_compiler/cpu/cpu_kernel_factory.h" 25 26 namespace mindspore { 27 namespace kernel { 28 class ApplyMomentumCPUKernel : public CPUKernel { 29 public: 30 ApplyMomentumCPUKernel() = default; 31 ~ApplyMomentumCPUKernel() override = default; 32 33 void InitKernel(const CNodePtr &kernel_node) override; 34 35 bool Launch(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &workspace, 36 const std::vector<AddressPtr> &outputs) override; 37 }; 38 39 MS_REG_CPU_KERNEL(ApplyMomentum, 40 KernelAttr() 41 .AddInputAttr(kNumberTypeFloat32) 42 .AddInputAttr(kNumberTypeFloat32) 43 .AddInputAttr(kNumberTypeFloat32) 44 .AddInputAttr(kNumberTypeFloat32) 45 .AddInputAttr(kNumberTypeFloat32) 46 .AddOutputAttr(kNumberTypeFloat32), 47 ApplyMomentumCPUKernel); 48 MS_REG_CPU_KERNEL(ApplyMomentum, 49 KernelAttr() 50 .AddInputAttr(kNumberTypeFloat32) 51 .AddInputAttr(kNumberTypeFloat32) 52 .AddInputAttr(kNumberTypeFloat32) 53 .AddInputAttr(kNumberTypeFloat32) 54 .AddInputAttr(kNumberTypeFloat32) 55 .AddOutputAttr(kNumberTypeFloat32) 56 .AddOutputAttr(kNumberTypeFloat32), 57 ApplyMomentumCPUKernel); 58 } // namespace kernel 59 } // namespace mindspore 60 61 #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_APPLY_MOMENTUM_CPU_KERNEL_H_ 62