Class MSKernel
- Defined in File kernel_api.h 
Inheritance Relationships
Derived Types
- public mindspore::kernel::IKernel< schema::Primitive >(Template Class IKernel)
- public mindspore::kernel::IKernel< Primitive >(Template Class IKernel)
Class Documentation
- 
class MSKernel
- The Kernel class is used to define a MindSpore Kernel. - Subclassed by mindspore::kernel::IKernel< schema::Primitive >, mindspore::kernel::IKernel< Primitive > - Public Functions - 
inline MSKernel(std::vector<mindspore::MSTensor> inputs, std::vector<mindspore::MSTensor> outputs, const mindspore::Context *ctx)
- Constructor. - 参数
- inputs – [in] define the input tensors for kernel. 
- outputs – [in] define the output tensors for kernel. 
- primitive – [in] define the primitive of kernel. 
- ctx – [in] define the context for kernel. 
 
 
 - 
virtual ~MSKernel() = default
- Destructor. 
 - 
inline virtual int InferShape()
- infer shape, datatype and format for output tensor of kernel. - 返回
- result code. 
 
 - 
virtual int Prepare() = 0
- prepare for executing kernel. - 返回
- result code. 
 
 - 
virtual int Execute() = 0
- execute the kernel. - 返回
- result code. 
 
 - 
virtual int ReSize() = 0
- resize the kernel input shape, memory need to refresh. - 返回
- result code. 
 
 - 
inline virtual void set_inputs(const std::vector<mindspore::MSTensor> &in_tensors)
- set kernel's input tensors. - 参数
- in_tensors – [in] define the input tensors. 
 
 - 
inline virtual void set_input(mindspore::MSTensor in_tensor, int index)
- set kernel's input tensor. - 参数
- in_tensor – [in] define the input tensor. 
- index – [in] define the index of the input tensor. 
 
 
 - 
inline virtual void set_outputs(const std::vector<mindspore::MSTensor> &out_tensors)
- set kernel's output tensors. - 参数
- out_tensors – [in] define the output tensors. 
 
 - 
inline virtual void set_output(mindspore::MSTensor out_tensor, int index)
- set kernel's output tensor. - 参数
- out_tensor – [in] define the output tensor. 
- index – [in] define the index of the output tensor. 
 
 
 - 
inline virtual const std::vector<mindspore::MSTensor> &inputs()
- obtain kernel's input tensors. - 返回
- input tensors. 
 
 - 
inline virtual const std::vector<mindspore::MSTensor> &outputs()
- obtain kernel's output tensors. - 返回
- output tensors. 
 
 - 
inline virtual std::string name() const
- obtain kernel's name. - 返回
- kernel's name. 
 
 - 
inline void set_name(const std::string &name)
- set kernel's name. - 参数
- name – [in] define the kernel's name. 
 
 - 
inline std::string GetAttr(const std::string &key) const
- get kernel's attribute. - 参数
- key – [in] define the kernel's attribute key. 
 
 - 
inline void SetConfig(const std::map<std::string, std::map<std::string, std::string>> *config)
- set kernel's config. - 参数
- config – [in] define the kernel's config. 
 
 - 
inline std::map<std::string, std::string> GetConfig(const std::string §ion) const
- set kernel's config. - 参数
- section – [in] define the section of the kernel's config. 
 
 
- 
inline MSKernel(std::vector<mindspore::MSTensor> inputs, std::vector<mindspore::MSTensor> outputs, const mindspore::Context *ctx)