文档
注册

REGISTER_CPU_KERNEL

宏功能

注册kernel实现。

宏原型

REGISTER_CPU_KERNEL(type, clazz)

注意:如下接口是上述宏定义会调用到的关联接口,开发者不直接调用下列接口。

AICPU_VISIBILITY bool RegistCpuKernel(const std::string &type, const KERNEL_CREATOR_FUN &fun);

template <typename T, typename... Args> static inline std::shared_ptr<T> MakeShared(Args &&... args);

参数说明

  • type:算子的OpType
  • clazz:算子的kernel实现名称,即定义的自定义算子类的名称,自定义算子类为基类CpuKernel的派生类。

调用示例

namespace {
const char *RESHAPE = "Reshape";
}
namespace aicpu {
uint32_t ReshapeCpuKernel::Compute(CpuKernelContext &ctx)
{
// 计算实现
}
REGISTER_CPU_KERNEL(RESHAPE, ReshapeCpuKernel);
} // namespace aicpu
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词