Method and device for operator registration processing based on deep learning and electronic device
The disclosure provides a method and a device for operator registration processing based on deep learning, an electronic device, and a storage medium. Description information and logic operation information of a registered operator are obtained. An operator type of the registered operator is determined based on the logic operation information. Configuration information corresponding to the operator type and preset in a deep learning framework is obtained. It is detected whether the registered operator is registered completely based on the description information and the configuration information.
1 . A method for operator registration processing in a deep learning framework, comprising:
obtaining description information and logic operation information of a registered operator in the deep learning framework used in performing a computer vision task, wherein the description information describes configuration information supported by the registered operator, and the registered operator is used to perform a calculation operation of an input tensor of the deep learning framework on a central processing unit (CPU) or a graphic processing unit (GPU);
determining an operator type of the registered operator based on the logic operation information;
obtaining configuration information corresponding to the operator type and preset in the deep learning framework, and detecting whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information;
wherein obtaining the configuration information corresponding to the operator type and preset in the deep learning framework comprises:
obtaining layout configuration information corresponding to the operator type and preset in the deep learning framework; and
wherein detecting whether the registered operator is registered completely based on the description information and the configuration information comprises:
obtaining one or more data layouts supported by the registered operator based on the description information; and
detecting whether the one or more data layouts are registered completely based on the layout configuration information; and
wherein the input tensor is a four-dimensional tensor in a form of [NCHW] or [NHWC], wherein N is a number of pictures, C is a number of channels, H is height of pictures, and W is width of the pictures.
2 . The method of claim 1 , wherein determining the operator type of the registered operator based on the logic operation information comprises:
obtaining a target calculation logic corresponding to a target data type preset in the deep learning framework, and performing a matching operation between the logic operation information and the target calculation logic;
determining the registered operator is a first operator type based on the target calculation logic not containing the logic operation information;
determining whether an operator operation is related to an input data based on the logic operation information based on the target calculation logic containing the logic operation information, determining the registered operator is the first operator type based on the operator operation being unrelated to the input data, and determining the registered operator is a second operator type based on the operator operation being related to the input data.
3 . The method of claim 1 , wherein obtaining the configuration information corresponding to the operator type and preset in the deep learning framework further comprises:
obtaining data configuration information corresponding to the operator type and preset in the deep learning framework; and
wherein detecting whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information further comprises:
obtaining one or more data types supported by the registered operator based on the description information; and
detecting whether the one or more data types are registered completely based on the data configuration information.
4 . The method of claim 3 , wherein obtaining the one or more data types supported by the registered operator based on the description information comprises:
obtaining reference data type information; and
obtaining the one or more data types supported by the registered operator by parsing the description information based on the reference data type information through a regular matching algorithm.
5 . The method of claim 3 , wherein, obtaining the configuration information corresponding to the operator type and preset in the deep learning framework further comprises:
obtaining device configuration information corresponding to the operator type and preset in the deep learning framework; and
wherein detecting whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information further comprises:
obtaining one or more execution devices supports by the registered operator based on the description information; and
detecting whether the one or more execution devices are registered completely based on the configuration information.
6 . An electronic device, comprising:
at least one processor; and
a memory, communicatively coupled with the at least one processor;
wherein the memory is configured to store instructions executable by the at least one processor, the instructions are executed by the at least one processor to cause the at least one processor to:
obtain description information and logic operation information of a registered operator in a deep learning framework used in performing a computer vision task, wherein the description information describes configuration information supported by the registered operator, and the registered operator is used to perform a calculation operation of an input tensor of the deep learning framework on a central processing unit (CPU) or a graphic processing unit (GPU);
obtain an operator type of the registered operator based on the logic operation information; and
obtain configuration information corresponding to the operator type and preset in the deep learning framework, and detect whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information, wherein the at least one processor is further configured to:
obtain layout configuration information corresponding to the operator type and preset in the deep learning framework; and
obtain one or more data layouts supported by the registered operator based on the description information; and detect whether the one or more data layouts are registered completely based on the layout configuration information;
wherein the input tensor is a four-dimensional tensor in a form of [NCHW] or [NHWC], wherein N is a number of pictures, C is a number of channels, H is height of pictures, and W is width of the pictures.
7 . The electronic device of claim 6 , wherein the at least one processor is further configured to:
obtain a target calculation logic corresponding to a target data type preset in the deep learning framework, and perform a matching operation between the logic operation information and the target calculation logic;
determine the registered operator is a first operator type based on the target calculation logic not containing the logic operation information;
determine whether an operator operation is related to an input data based on the logic operation information based on the target calculation logic containing the logic operation information, determine the registered operator is the first operator type based on the operator operation being unrelated to the input data, and determine the registered operator is a second operator type based on the operator operation being related to the input data.
8 . The electronic device of claim 6 , wherein the at least one processor is further configured to:
obtain data configuration information corresponding to the operator type and preset in the deep learning framework; and
obtain one or more data types supported by the registered operator based on the description information; and detect whether the one or more data types are registered completely based on the data configuration information.
9 . The electronic device of claim 8 , wherein the at least one processor is further configured to:
obtain reference data type information; and
obtain the one or more data types supported by the registered operator by parsing the description information based on the reference data type information through a regular matching algorithm.
10 . The electronic device of claim 8 , wherein the at least one processor is further configured to:
obtain device configuration information corresponding to the operator type and preset in the deep learning framework; and
obtain one or more execution devices supports by the registered operator based on the description information; and detect whether the one or more execution devices are registered completely based on the configuration information.
11 . A non-transitory computer-readable storage medium, having computer instructions stored thereon, wherein the computer instructions are configured to cause a computer to execute a method for operator registration processing based on deep learning, the method comprising:
obtaining description information and logic operation information of a registered operator in a deep learning framework used in performing a computer vision task, wherein the description information describes configuration information supported by the registered operator, and the registered operator is used to perform a calculation operation of an input tensor of the deep learning framework on a central processing unit (CPU) or a graphic processing unit (GPU);
obtaining an operator type of the registered operator based on the logic operation information; and
obtaining configuration information corresponding to the operator type and preset in the deep learning framework, and detecting whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information;
wherein, obtaining the configuration information corresponding to the operator type and preset in the deep learning framework comprises:
obtaining layout configuration information corresponding to the operator type and preset in the deep learning framework; and
wherein detecting whether the registered operator is registered completely based on the description information and the configuration information comprises:
obtaining one or more data layouts supported by the registered operator based on the description information; and
detecting whether the one or more data layouts are registered completely based on the layout configuration information; and
wherein the input tensor is a four-dimensional tensor in a form of [NCHW] or [NHWC], wherein N is a number of pictures, C is a number of channels, H is height of pictures, and W is width of the pictures.
12 . The non-transitory computer-readable storage medium of claim 11 , wherein determining the operator type of the registered operator based on the logic operation information comprises:
obtaining a target calculation logic corresponding to a target data type preset in the deep learning framework, and performing a matching operation between the logic operation information and the target calculation logic;
determining the registered operator is a first operator type based on the target calculation logic not containing the logic operation information;
determining whether an operator operation is related to an input data based on the logic operation information based on the target calculation logic containing the logic operation information, determining the registered operator is the first operator type based on the operator operation being unrelated to the input data, and determining the registered operator is a second operator type based on the operator operation being related to the input data.
13 . The non-transitory computer-readable storage medium of claim 11 , wherein, obtaining the configuration information corresponding to the operator type and preset in the deep learning framework further comprises:
obtaining data configuration information corresponding to the operator type and preset in the deep learning framework; and
wherein detecting whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information further comprises:
obtaining one or more data types supported by the registered operator based on the description information; and
detecting whether the one or more data types are registered completely based on the data configuration information.
14 . The non-transitory computer-readable storage medium of claim 13 , wherein, obtaining the configuration information corresponding to the operator type and preset in the deep learning framework further comprises:
obtaining device configuration information corresponding to the operator type and preset in the deep learning framework; and
wherein detecting whether the configuration information supported by the registered operator is registered completely based on the description information and the configuration information further comprises:
obtaining one or more execution devices supports by the registered operator based on the description information; and
detecting whether the one or more execution devices are registered completely based on the configuration information.
15 . The method of claim 3 , further comprising:
generating a first registration success prompt message based on detecting that the one or more data types are registered completely; or
obtaining a missing data type from the data configuration information and generating a first registration failure success prompt message based on the missing data type based on detecting that the one or more data types are registered incompletely.
16 . The electronic device of claim 8 , wherein the at least one processor is further configured to:
generate a first registration success prompt message based on detecting that the one or more data types are registered completely; or
obtain a missing data type from the data configuration information and generate a first registration failure success prompt message based on the missing data type based on detecting that the one or more data types are registered incompletely.
17 . The non-transitory computer-readable storage medium of claim 13 , wherein the method further comprises:
generating a first registration success prompt message based on detecting that the one or more data types are registered completely; or
obtaining a missing data type from the data configuration information and generating a first registration failure success prompt message based on the missing data type based on detecting that the one or more data types are registered incompletely.