1 /** 2 * Copyright 2020-2022 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_SPARSE_MARTRIX_SOFTMAX_CPU_KERNEL_H_ 18 #define MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_SPARSE_MARTRIX_SOFTMAX_CPU_KERNEL_H_ 19 20 #include <vector> 21 #include <map> 22 23 #include "plugin/device/cpu/kernel/cpu_kernel.h" 24 #include "plugin/factory/ms_factory.h" 25 26 namespace mindspore { 27 namespace kernel { 28 class SparseMatrixSoftmaxCpuKernelMod : public NativeCpuKernelMod { 29 public: 30 SparseMatrixSoftmaxCpuKernelMod() = default; 31 ~SparseMatrixSoftmaxCpuKernelMod() override = default; 32 33 bool Init(const std::vector<KernelTensor *> &inputs, const std::vector<KernelTensor *> &outputs) override; 34 35 int Resize(const std::vector<KernelTensor *> &inputs, const std::vector<KernelTensor *> &outputs) override; 36 37 bool Launch(const std::vector<KernelTensor *> &inputs, const std::vector<KernelTensor *> &workspace, 38 const std::vector<KernelTensor *> &outputs) override; 39 40 protected: 41 std::vector<KernelAttr> GetOpSupport() override; 42 43 private: 44 TypeId dtype_{kTypeUnknown}; 45 template <typename T> 46 void LaunchKernel(const std::vector<KernelTensor *> &inputs, const std::vector<KernelTensor *> &outputs); 47 }; 48 } // namespace kernel 49 } // namespace mindspore 50 #endif 51