---
title: 函数：create_kernel
description: "| C函数原型 | aclError aclopCreateKernel(const char \*opType, const char \*kernelId, const char \*kernelName, void \*binData, int binSize, aclopEngineType enginetype, aclDataDeallocator deallocator) |"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/aadgp/aclpythondevg_01_0802.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/aadgp/aclpythondevg_01_0802.html
indexId: 4bd983ec9577010bfd0b69d74f2f41ac5a2ccc58b879a26dfa116459684bb7a9108
---
# 函数：create_kernel

| C函数原型 | aclError aclopCreateKernel(const char \*opType, const char \*kernelId, const char \*kernelName, void \*binData, int binSize, aclopEngineType enginetype, aclDataDeallocator deallocator) |
| --- | --- |
| Python函数 | ret = acl.op.create\_kernel(op\_type, kernel\_id, kernel\_name, bin\_data, bin\_size, enginetype, deallocator) |
| 函数功能 | 动态Shape场景下，将算子注册到系统内部，运行算子时使用。 |
| 输入说明 | op\_type：str，算子类型。 kernel\_id：str，算子执行时要指定的Kernel ID。 kernel\_name：str，算子Kernel名称，和算子二进制文件中的kernelName保持一致。 bin\_data：int，算子Kernel文件的内存地址。 bin\_size：int，算子Kernel文件的内存大小，单位为byte。 enginetype：int，表示算子执行引擎，该参数只有acl.op.update.params接口的compile\_flag参数值为ACL\_COMPILE\_SYS时有效。 0：ACL\_ENGINE\_SYS，不关心具体执行引擎时填写。 1：ACL\_ENGINE\_AICORE，将算子编译成AI Core算子。 2：ACL\_ENGINE\_VECTOR，将算子编译成Vector Core算子。 deallocator：int，指定是否自动释放bin\_data内存。 0：不自动释放，数据由调用者自行编写代码进行释放。 1：自动释放，内部会设置回调函数释放bin\_data内存。 |
| 返回值说明 | ret：int，错误码。 返回0表示成功。 返回其它值表示失败。 |
| 约束说明 | 无 |
