IP Library Granted Patent US 11,625,248
Granted Patent B2
US 11,625,248 · App. 17/572,140 · Granted Apr 11, 2023

Operator registration method and apparatus for deep learning framework, device and storage medium

Inventors: Weihang Chen (Beijing, CN); Jiabin Yang (Beijing, CN); Hongyu Liu (Beijing, CN); Xiang Lan (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
G06F9/3828G06F8/443G06F8/51G06F9/30098G06F9/545
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,625,248
App. No.
17/572,140
Granted
Apr 11, 2023
Kind
B2
Abstract

The present disclosure provides an operator registration method and apparatus for a deep learning framework, a device and a storage medium, relates to the field of computer technologies, and specifically to the field of artificial intelligence such as deep learning. The operator registration method for a deep learning framework includes: receiving registration information provided by a user for registering operators with the deep learning framework, the registration information including: a custom calculation function, the custom calculation function being written in a manner irrelevant to the deep learning framework; building operator meta-information in the deep learning framework based on the registration information; and constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework. The present disclosure can simplify an operator registration process.

Claims (74)

1. An operator registration method for a deep learning framework, the method comprising:

receiving registration information provided by a user for registering operators with the deep learning framework, the registration information comprising: a custom calculation function, the custom calculation function being written in a manner irrelevant to the deep learning framework;

building operator meta-information in the deep learning framework based on the registration information; and

constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework.

2. The method according to claim 1 , wherein the registration information further comprises: custom input information and custom output information, and the step of building operator meta-information in the deep learning framework based on the registration information comprises:

converting the custom input information into standard input information within the deep learning framework;

converting the custom output information into standard output information within the deep learning framework;

processing the custom calculation function by using macros, so as to obtain a calculation function after macro processing; and

building the operator meta-information in the deep learning framework based on the standard input information, the standard output information and the calculation function after macro processing.

3. The method according to claim 2 , wherein the to-be-registered operator comprises to-be-registered operator description information and a to-be-registered operator kernel function, and the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information comprises:

constructing the to-be-registered operator description information based on the standard input information and the standard output information; and

constructing the to-be-registered operator kernel function based on the calculation function after macro processing.

4. The method according to claim 3 , wherein the to-be-registered operator kernel function comprises unified-form input information and a unified function pointer, and the step of constructing the to-be-registered operator kernel function based on the calculation function after macro processing comprises:

determining a structure for replacing the calculation function after macro processing, the structure comprising a static function, the static function having a unified form corresponding to different custom calculation functions;

taking input information of the static function as the unified-form input information; and

taking a function pointer of the static function as the unified function pointer.

5. The method according to claim 4 , wherein the input information of the static function forms an input information list, the input information list comprises an input tensor list, the custom input information comprises custom input information of at least one data type, the structure comprises at least one specialized substructure, different specialized substructures correspond to different data types, the data type comprises tensors, and the step of constructing the to-be-registered operator kernel function based on the calculation function after macro processing further comprises:

obtaining custom input information of the data types corresponding to the specialized substructures by using specialized substructures in the at least one specialized substructure;

forming the input tensor list with the custom input information whose data type are tensors; and

if the data type further comprises non-tensors and the input information list further comprises another data type list, forming the another data type list with the custom input information whose data type are non-tensors.

6. The method according to claim 1 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

7. The method according to claim 2 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

8. The method according to claim 3 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

9. The method according to claim 4 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

10. The method according to claim 5 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

11. An electronic device, comprising:

at least one processor; and

a memory communicatively connected with the at least one processor;

wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform an operator registration method for a deep learning framework, wherein the method comprises:

receiving registration information provided by a user for registering operators with the deep learning framework, the registration information comprising: a custom calculation function, the custom calculation function being written in a manner irrelevant to the deep learning framework;

building operator meta-information in the deep learning framework based on the registration information; and

constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework.

12. The electronic device according to claim 11 , wherein the registration information further comprises: custom input information and custom output information, and the step of building operator meta-information in the deep learning framework based on the registration information comprises:

converting the custom input information into standard input information within the deep learning framework;

converting the custom output information into standard output information within the deep learning framework;

processing the custom calculation function by using macros, so as to obtain a calculation function after macro processing; and

building the operator meta-information in the deep learning framework based on the standard input information, the standard output information and the calculation function after macro processing.

13. The electronic device according to claim 12 , wherein the to-be-registered operator comprises to-be-registered operator description information and a to-be-registered operator kernel function, and the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information comprises:

constructing the to-be-registered operator description information based on the standard input information and the standard output information; and

constructing the to-be-registered operator kernel function based on the calculation function after macro processing.

14. The electronic device according to claim 13 , wherein the to-be-registered operator kernel function comprises unified-form input information and a unified function pointer, and the step of constructing the to-be-registered operator kernel function based on the calculation function after macro processing comprises:

determining a structure for replacing the calculation function after macro processing, the structure comprising a static function, the static function having a unified form corresponding to different custom calculation functions;

taking input information of the static function as the unified-form input information; and

taking a function pointer of the static function as the unified function pointer.

15. The electronic device according to claim 14 , wherein the input information of the static function forms an input information list, the input information list comprises an input tensor list, the custom input information comprises custom input information of at least one data type, the structure comprises at least one specialized substructure, different specialized substructures correspond to different data types, the data type comprises tensors, and the step of constructing the to-be-registered operator kernel function based on the calculation function after macro processing further comprises:

obtaining custom input information of the data types corresponding to the specialized substructures by using specialized substructures in the at least one specialized substructure;

forming the input tensor list with the custom input information whose data type are tensors; and

if the data type further comprises non-tensors and the input information list further comprises another data type list, forming the another data type list with the custom input information whose data type are non-tensors.

16. The electronic device according to claim 11 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

17. The electronic device according to claim 12 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

18. The electronic device according to claim 13 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

19. The electronic device according to claim 14 , wherein the step of constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework comprises:

determining a current constructor corresponding to a current scenario based on the current scenario; and

constructing the to-be-registered operator within the deep learning framework based on the operator meta-information by using the current constructor, and registering the to-be-registered operator in the global operator table within the deep learning framework.

20. A non-transitory computer readable storage medium with computer instructions stored thereon, wherein the computer instructions are used for causing a computer to perform an operator registration method for a deep learning framework, wherein the method comprises:

receiving registration information provided by a user for registering operators with the deep learning framework, the registration information comprising: a custom calculation function, the custom calculation function being written in a manner irrelevant to the deep learning framework;

building operator meta-information in the deep learning framework based on the registration information; and

constructing a to-be-registered operator within the deep learning framework based on the operator meta-information, and registering the to-be-registered operator in a global operator table within the deep learning framework.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 10, 2022
From: CHEN, WEIHANG; YANG, JIABIN; LIU, HONGYU; LAN, XIANG
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 058610/0130 →
Priority Claims (1)
CN 202110540476.4 · May 18, 2021 · national
Continuity (1)
Related Publication 20220374238A1 · Nov 24, 2022
Cited By (1)
US 12,705,545