Summary of the invention
In view of this, the present disclosure proposes a kind of creation method of the operation of neural network node and devices.
According to the one side of the disclosure, a kind of creation method of the operation of neural network node, the method packet are provided
It includes:
The node in neural network is traversed, determines the corresponding creation function of the operation of the node, wherein the creation letter
The corresponding drawing template establishment function of action type belonging to operation in number including the node;
The input tensor of the operation is obtained based on the drawing template establishment function, parses the parameter of the node, and according to
Parameter described in the operation, the input tensor sum creates the output tensor of the operation;
Tensor is exported according to the input tensor sum of the operation and the parameter creates the operation.
In one possible implementation, the corresponding creation function of the operation of the node is determined, comprising:
The corresponding creation function of operation of the node is determined according to the first corresponding relationship, wherein the first corresponding relationship note
Record is operation and the incidence relation created between function corresponding with operation.
In one possible implementation, input tensor, the solution of the operation are obtained based on the drawing template establishment function
The parameter of the node is analysed, and the parameter according to the operation, the input tensor sum creates the output tensor of the operation
Drawing template establishment function, comprising:
The input tensor of the operation is obtained according to the contextual information of the node;
The node, which is parsed, according to the variable element of the drawing template establishment function obtains the corresponding parameter of the variable element;
Wherein, the corresponding parameter of the variable element can be according to different operation changes;
The operation is created according to the operation, the input tensor of the operation and the corresponding parameter of the variable element
Output tensor.
In one possible implementation, the method also includes:
The second corresponding relationship between the output tensor of the node, the operation of creation and creation is established, and will be described
Second corresponding relationship saves as contextual information.
In one possible implementation, the method also includes:
During running the neural network corresponding calculatings figure, node each of is schemed for calculating, according to
Second corresponding relationship determines the operation of the corresponding creation of the node;
The corresponding calculation template function of the node is determined according to the operation of creation;
Based on the calculation template function, the input of the operation of the creation is obtained according to the contextual information of the node
Data, and calculated according to the operation of the creation and the input data, obtain the output data of the node.
In one possible implementation, the method also includes:
Before the node for having traversed the neural network according to topological order, whether the described judgement is default node;
If the point is not default node, it is determined that the operation of the node.
In one possible implementation, the method also includes:
Drawing template establishment function corresponding with operation, the drawing template establishment function packet are created according to action type belonging to operation
Include variable element, the corresponding parameter of the variable element can be according to different operation changes.
In one possible implementation, the action type includes with one of Types Below or a variety of: single input
Single output, single input and multi-output, the output of dual input list, multiple input single output.
According to another aspect of the present disclosure, a kind of creating device of the operation of neural network node, described device are provided
Include:
First determining module determines the corresponding creation letter of the operation of the node for traversing the node in neural network
Number, wherein include the corresponding drawing template establishment function of action type belonging to the operation of the node in the creation function;
First creation module, for being obtained based on the drawing template establishment function described in the input tensor of the operation, parsing
The parameter of node, and the parameter according to the operation, the input tensor sum creates the output tensor of the operation;
Second creation module, for according to the input tensor sum of the operation exports tensor and the parameter creates
Operation.
In one possible implementation, first determining module includes:
Determination unit, the corresponding creation function of operation for determining the node according to the first corresponding relationship, wherein the
One corresponding relation record is operation and the incidence relation created between function corresponding with operation.
In one possible implementation, first creation module, comprising:
Acquiring unit, for obtaining the input tensor of the operation according to the contextual information of the node;
Resolution unit obtains the variable ginseng for parsing the node according to the variable element of the drawing template establishment function
The corresponding parameter of number;Wherein, the corresponding parameter of the variable element can be according to different operation changes;
Creating unit, for according to the operation, the input tensor of the operation and the corresponding ginseng of the variable element
Number creates the output tensor of the operation.
In one possible implementation, described device further include:
Module is established, second between the output tensor of operation and creation for establishing the node, creation is corresponding
Relationship, and second corresponding relationship is saved as into contextual information.
In one possible implementation, described device further include:
Second determining module is used for during the operation neural network corresponding calculating figure, in calculating figure
Each node, the operation of the corresponding creation of the node is determined according to second corresponding relationship;
Third determining module determines the corresponding calculation template function of the node for the operation according to creation;
Computing module obtains the wound according to the contextual information of the node for being based on the calculation template function
The input data for the operation built, and calculated according to the operation of the creation and the input data, obtain the node
Output data.
In one possible implementation, described device further include:
Judgment module, for before the node for having traversed the neural network according to topological order, judgement it is described whether be
Default node;
4th determining module, if for the point not being default node, it is determined that the operation of the node.
In one possible implementation, described device further include:
Third creation module, for creating drawing template establishment function corresponding with operation according to action type belonging to operation,
The drawing template establishment function includes variable element, and the corresponding parameter of the variable element can be according to different operation changes.
In one possible implementation, the action type includes with one of Types Below or a variety of: single input
Single output, single input and multi-output, the output of dual input list, multiple input single output.
According to another aspect of the present disclosure, a kind of creating device of the operation of neural network node is provided, comprising: processing
Device;Memory for storage processor executable instruction;Wherein, the processor is configured to executing the above method.
According to another aspect of the present disclosure, a kind of non-volatile computer readable storage medium storing program for executing is provided, is stored thereon with
Computer program instructions, wherein the computer program instructions realize the above method when being executed by processor.
By the setting drawing template establishment function corresponding with action type belonging to operation in the creation function of operation, so that
The operation for belonging to same action type can be operated using identical drawing template establishment function creation, it is possible to reduce duplicated code.
According to below with reference to the accompanying drawings to detailed description of illustrative embodiments, the other feature and aspect of the disclosure will become
It is clear.
Specific embodiment
Various exemplary embodiments, feature and the aspect of the disclosure are described in detail below with reference to attached drawing.It is identical in attached drawing
Appended drawing reference indicate element functionally identical or similar.Although the various aspects of embodiment are shown in the attached drawings, remove
It non-specifically points out, it is not necessary to attached drawing drawn to scale.
Dedicated word " exemplary " means " being used as example, embodiment or illustrative " herein.Here as " exemplary "
Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, giving numerous details in specific embodiment below to better illustrate the disclosure.
It will be appreciated by those skilled in the art that without certain details, the disclosure equally be can be implemented.In some instances, for
Method, means, element and circuit well known to those skilled in the art are not described in detail, in order to highlight the purport of the disclosure.
Height is required since deep learning is computationally intensive, and to calculating speed, the practical application scene of deep learning is to place
The hardware of reason data requires a kind of relatively high, the fast while low in energy consumption hardware of arithmetic speed in performance and function, just seems ten
Divide necessity.Neural network accelerator (artificial intelligence process device) is exactly this arithmetic speed height while hardware low in energy consumption.
In order to give full play to the performance of hardware, the programming interface of hardware platform, high-performance neural network meter are provided for user
Library is calculated to come into being.The computing module in high-performance neural computing library provides neural network basic operation, tensor computation
Interface, and the support of more perfect deep learning operation, user can use these basic operations, be spliced into oneself design
Neural network.
Neural network is built using high-performance neural computing library, developer is needed more clearly to understand operation mould
Block, data module, device management module understand the operational process agreement in entire high-performance neural computing library, build difference
When neural network, size of code is big and code multiplicity is high.
In order to solve the problems, such as to build neural network difficulty based on high-performance neural computing library, neural network is proposed
Frame is executed, allows the exploitation in high-performance neural computing library and tester to be not required to it is to be understood that high-performance neural computing library
Details just can one network structure of fast construction.
Function module in high-performance neural computing library is that whole system erects to modify most places later,
It on the one hand is that high-performance neural computing library change interface is forced the interface done adaptation;It on the other hand is to reduce Maintenance Difficulty
Degree repeatedly reconstructs.Originally there was only create_op (creation function) this class function, using is that a series of if judgement is realized
By the calculating interface of op to the lookup of creation function, the later high-performance neural computing library operation provided by unified parent
Interface has been changed to the different interface of each child interface, and therefore, the calculating of operation is also required to be registered in function module.It is taking
When building neural network execution frame, the registration of function needs many duplicated codes, increases maintenance cost.
In order to solve the above-mentioned technical problem, present disclose provides a kind of creation methods of neural network node operation.The party
Method can be applied to processor, and the processor can be general processor, for example, processor can be central processing unit
CPU (Central Processing Unit), graphics processing unit GPU (Graphics Processing Unit) etc..It is described
Processor can also be the artificial intelligence process device for executing artificial intelligence operation, and artificial intelligence operation may include machine learning
Operation, class brain operation etc..Wherein, machine learning operation includes neural network computing, k-means operation, support vector machines operation
Deng.The artificial intelligent processor can be for example including NPU (Neural-Network Processing Unit, Processing with Neural Network
Unit), DSP (Digital Signal Process, digital signal processing unit), field programmable gate array (Field-
Programmable Gate Array, FPGA) one of chip or combination.Artificial intelligence process device may include multiple fortune
Unit is calculated, multiple arithmetic elements can execute operation parallel.
Fig. 1 shows the flow chart of the creation method according to the operation of the neural network node of one embodiment of the disclosure.Such as Fig. 1 institute
Show, this method may include:
Step S11 traverses the node in neural network, determines the corresponding creation function of the operation of the node, wherein institute
Stating in creation function includes the corresponding drawing template establishment function of action type belonging to the operation of the node;
Step S12 obtains the input tensor of the operation, the ginseng of the parsing node based on the drawing template establishment function
Number, and the parameter according to the operation, the input tensor sum creates the output tensor of the operation;
Step S13 exports tensor according to the input tensor sum of the operation and the parameter creates the operation.
The setting drawing template establishment function corresponding with action type belonging to operation in the creation function of operation, so that belonging to
The operation of same action type can be operated using identical drawing template establishment function creation, it is possible to reduce duplicated code.
Specifically, can to high-performance neural computing library provide operation create (creation) function and
Compute (calculating) function is analyzed, and is different action types by activity classification, such as action type may include: list
Input single output, single input and multi-output, the output of dual input list, multiple input single output etc..Wherein, single-input single-output refers to operation
There are an input tensor, operation to obtain an output tensor after handling this input tensor, single input and multi-output is
Refer to that operation has an input tensor, operation to obtain multiple output tensors, dual input list after handling this input tensor
Output, which refers to, obtains an output tensor after operation is handled this two input tensors there are two input tensor, operation, more
The single output of input refers to that operation has multiple input tensors, operation to obtain an output after handling multiple input tensor
Amount.
The difference for belonging to the different operation of same action type can be the additional parameter difference that operation needs, volume here
Outer parameter (hereinafter referred to as parameter) can refer to the parameter other than input tensor sum output tensor.For example, transpose is grasped
The creation function of work is createTranspose (input, output, perm), and perm can be changed into oneself by other operations
Parameter, such as createSoftmax (input, output, dim).For this different operation for belonging to same action type,
Identical drawing template establishment function can be provided.
In one possible implementation, disclosed method can also include: according to action type belonging to operation
Drawing template establishment function corresponding with operation is created, drawing template establishment function may include variable element, the corresponding parameter of variable element
It can support to be passed to arbitrary parameter, to reduce registration function according to different operation changes, by the way of changeable parameters
Duplicated code in the process reduces maintenance difficulties, reduces workload.
In one possible implementation, after having created drawing template establishment function, action type and creation be can establish
Incidence relation between stencil function.For example, as set forth above, it is possible to which the behaviour with operation is arranged in the creation function of operation
Make the corresponding drawing template establishment function of type, with the incidence relation established between action type and drawing template establishment function.Different letters
Digital-to-analogue plate can have different marks, and mark here can refer to the information such as title, the number of drawing template establishment function.This
Sample, a certain operation is when calling the corresponding creation function of the operation, so that it may which realization is to the corresponding wound of the action type of the operation
Build the calling of stencil function.
Table 1 shows the example of the drawing template establishment function according to one embodiment of the disclosure
Table 1
Wherein, Context is contextual information, is abstracted to calculating figure connection relationship.Because every layer in neural network
It is responsible for the output tensor of creation oneself, every layer of input tensor is created by its forerunner's node, so context is needed to believe
Breath obtains every layer of input tensor.Node is abstracted to calculating figure interior joint, can be created for each node in calculating figure
Node class is built, information relevant to node, the calculating (operation) comprising description current layer in each node are saved in Node class
Whole parameters for example, may include above-mentioned additional parameter, attribute of operation etc. can also include node in each node
Predecessor node and descendant node information namely contextual information, it is subsequent for example, may include predecessor node in_node
Node out_node.
Drawing template establishment function corresponding with the action type of operation is arranged in the creation function of operation to be referred to, each
Operation has corresponding creation function, by the corresponding drawing template establishment function setup of the action type of operation in the creation function of operation
In for obtains input tensor, creation output tensor and parsing node parameter.For example, create_op ()
create_simple_11p<OP>(Context*ctx,Node*node,Args&…param)
}
Where it is assumed that the corresponding drawing template establishment function of action type of a certain operation op is create_simple_11p, that
It can be configured using mode as described above.It should be noted that should further include that other are in create_op ()
The instruction that creation operation needs, for simple expression, the disclosure and unlisted specific content.
Therefore, in the operation for the node for needing to create neural network, the node of neural network can be traversed, and according to every
The action type of a node calls corresponding drawing template establishment function, creates node according to the parameter of drawing template establishment function and node
Corresponding operation.
Specifically, for step S11, the node traversed and the node that corresponding operation will be created for the node
It is properly termed as the node currently traversed.Fig. 2 shows the creation methods operated according to the neural network node of one embodiment of the disclosure
Flow chart.As shown in Fig. 2, one by one can be the corresponding operation of node creation in calculating figure according to the topological order of calculating figure,
Therefore, the node currently traversed, which can be, to be traversed this node and will create corresponding operation for the node.
In one possible implementation, operation can be saved by map and is operated between corresponding creation function
Corresponding relationship is assured that the corresponding creation function of operation according to operation and the corresponding relationship.
Be mentioned above, create_op (creation function) this class function, use be a series of if judgement realize by
The calculating interface of op to the operation that the lookup for creating function, later high-performance neural computing library provide is connect by unified parent
Mouth has been changed to the different interface of each child interface.It rewrites a condition decision logic and also brings along many duplicated codes, and root
According to the above-mentioned determining mode for operating corresponding creation function of the disclosure, search criterion decision logic is not needed, in this way, just not yet
It needs to write the condition decision logic for searching creation function, reduces the duplicated code during registration function, reduce maintenance difficulties,
Reduce workload.
In one possible implementation, the mark of operation can be saved with map and operates corresponding creation function
Corresponding relationship between mark.The mark of operation can be the information for referring to uniquely indicate the operation, for example, the name of operation
Claim, number etc.;Likewise, the mark of creation function can be the information for referring to uniquely indicate the creation function, for example, creation
Title, number of function etc..For example, for a certain node, it can determine that the operation of node is according to the parameter op of node
Power (mark of operation) can be determined according to the mark " power " of operation and above-mentioned corresponding relationship and be operated corresponding creation
Function is create_power (mark of creation function).Creating function create_power can be with the behaviour of call operation power
Make the corresponding drawing template establishment function of type, such as create_simple_11p<>(Context* as described above can be called
Ctx, Node*node, Args& ... param):
create_power(){
create_simple_11p<>(Context*ctx,Node*node,Args&…param)
}
It should be noted that corresponding the closing of operation and the corresponding creation function of operation can also be established by other means
System, the present disclosure is not limited to the modes in above-mentioned example.
For step S12, the corresponding drawing template establishment function of the action type of the operation of the node currently traversed can be called
It realizes, specific process is as follows.
Fig. 3 shows the flow chart of the method for the step S12 according to one embodiment of the disclosure.As shown in figure 3, in a kind of possibility
Implementation in, step S12 may include:
Step S121 obtains the input tensor of the operation according to the contextual information of the node;
Step S122 parses the node according to the variable element of the drawing template establishment function and obtains the variable element pair
The parameter answered;Wherein, the corresponding parameter of the variable element can be according to different operation changes;
Step S123 is created according to the operation, the input tensor of the operation and the corresponding parameter of the variable element
Build the output tensor of the operation.
Wherein, as described above, contextual information can be it is abstract according to the connection relationship between the node in calculating figure
Arrive, contextual information can be stored in Node class, contextual information may include the predecessor node of node, node it is subsequent
Node, contextual information can also include that the operation of node, address of output tensor of output tensor sum node of node etc. are believed
Breath.
As shown in connection with fig. 2, processor is when executing the creation method of the disclosure, according to the context of the node currently traversed
The output tensor of the predecessor node of the available node currently traversed of information, predecessor node is the input tensor operated.One
In the possible implementation of kind, the corresponding parameter of variable element can be the additional parameter of operation, therefore, obtain the defeated of operation
After entering tensor, the node currently traversed can parse based on drawing template establishment function and obtain additional parameter.
It can be according to the defeated of the above-mentioned variable element creation operation of input tensor sum of operation, operation based on drawing template establishment function
Tensor out.
After the input tensor, output tensor and additional parameter operated, creation mould can be called according to step S13
Plate function can create operation according to the input tensor of operation, the output tensor sum additional parameter of operation.It is, recursive
Terminal is still the creation function in high-performance neural computing library.
It in one possible implementation, can be to the mark of the incoming operation of drawing template establishment function, drawing template establishment function
The interface of high-performance neural computing library creation operation is called according to the mark of operation.
Corresponding drawing template establishment function can be called according to the action type of each node by above procedure, according to creation
Stencil function and the corresponding operation of the parameter of node creation node, so that belonging to the operation of same action type can use
Identical drawing template establishment function creation operation, it is possible to reduce duplicated code.
Fig. 4 shows the flow chart of the creation method according to the operation of the neural network node of one embodiment of the disclosure.Such as Fig. 4 institute
Show, in one possible implementation, the method can also include:
Step S14, second established between the output tensor of the node, the operation created and creation is corresponding to close
System, and second corresponding relationship is saved as into contextual information.
After the output tensor sum operation for the node that creation currently traverses, output tensor, the wound of creation can also be established
The second corresponding relationship between the operation built and node, is stored in contextual information.
In one possible implementation, Context class can be created and save the second corresponding relationship.
After establishing above-mentioned second corresponding relationship, in the positive calculating and reverse train for carrying out neural network, all may be used
To obtain the corresponding operation of node by the second corresponding relationship.In addition, the connection relationship between the node wrapped in contextual information
It may include positive connection relationship and Opposite direction connection relationship, positive connection relationship can refer to, the node when carrying out positive calculate
Predecessor node and descendant node, Opposite direction connection relationship can refer to, when carrying out reverse train the predecessor node of node and after
After node.It is understood that when forward direction calculates, if a node is the predecessor node of another node, then reversed
When training, which is the descendant node of another node.
When building calculates figure, processor can read the input node of each node, according to the defeated of each node
Ingress determines the predecessor node and descendant node of each node.After the predecessor node and descendant node for determining node,
Node class is created, Node class also saves the predecessor node and descendant node of node other than saving the information of node, for example,
Save in_node and out_node.
It in one possible implementation, can be using Context class as the friendly metaclass of Node class, Context class pair
The interface of the outer predecessor node for providing accessed node and descendant node, the interface are the interface for reading contextual information.
In one possible implementation, the first interface of the predecessor node for reading node can be set and be used for
Read the second interface of the descendant node of node.First interface and second interface are in the positive visit for calculating and providing when reverse train
It asks exactly the opposite, can accomplish can be realized positive calculate and reverse train with a calculating figure.Wherein, first interface and
The access that two interfaces are provided in positive calculating and reverse train is exactly the opposite to be referred to: for first interface: counting in forward direction
When calculation, when reading contextual information by first interface, return is that the in_node of node passes through first in reverse train
Interface read contextual information when, return be node out_node;For second interface, when forward direction calculates, by the
When one interface reads contextual information, return is that the out_node of node is read in reverse train by first interface
When context information, return be node in_node.
By the above-mentioned means, only needing provide a calculating figure can realize that the positive of neural network calculates and reversely instruct
Practice process.In the related technology, it is respectively used to realize nerve to provide forward function and backward function in neural network
The positive of network calculates and reverse train, in order to carry out positive calculate and reverse train is in order to keep the two functions correct
Corresponding calculating is completed, needs to provide corresponding calculating figure respectively, for example, it is desired to be provided comprising forward direction even for forward function
The calculating figure of relationship is connect, provides the calculating figure comprising Opposite direction connection relationship for backward function, it is very troublesome, according to the disclosure
The above method can solve this technical problem.
Fig. 5 shows the flow chart of the creation method according to the operation of the neural network node of one embodiment of the disclosure.Such as Fig. 5 institute
Show, in one possible implementation, the method can also include:
Step S15 judges whether the node is pre- before the node for having traversed the neural network according to topological order
If node;
Step S16, if the node is not default node, it is determined that the operation of the node.
As shown in Fig. 2, to calculate the node creation pair in figure one by one before having traversed all nodes of neural network
The operation answered.Default node can refer to the node independent of other nodes, for example, default node can be node Const
(constant), Placeholder (placeholder), etc., wherein Const is constant node, is the start node in calculating figure, is used for
Incoming data, placeholder is also a kind of constant, and placeholder can be interpreted as to a kind of parameter, i.e., its unlike
Const directly can be used like that, need user's transmission constant value.
In one possible implementation, the node currently traversed and default node can be compared one by one, with
Judge whether the node currently traversed is default node, or can also be according to the current traversal of contextual information judgement saved
Node whether be default node, the disclosure is not construed as limiting specific mode.
If the node currently traversed is default node, as shown in Fig. 2, the input tensor of available node, parsing node
The parameter that creation output tensor needs is obtained, then creation output tensor, and according to input tensor, output tensor sum parameter creation
Operation, in the relationship established in contextual information between node, operation and output tensor.
If the node currently traversed is not default node, the operation that the node currently traversed determines node can parse
Mark can determine according to the mark of operation later and operate corresponding creation function, and call creation function creation operation.
Classification processing can be distinguished for different nodes in accordance with an embodiment of the present disclosure, for not depending on other nodes
Node does not need to create corresponding drawing template establishment function since the general character between the operation of node is little, the tune in creation
It is operated with corresponding creation function creation, is flexibly handled for different nodes, save the time of creation operation.
Fig. 6 shows the flow chart of the creation method according to the operation of the neural network node of one embodiment of the disclosure.Such as Fig. 6 institute
Show, in one possible implementation, the method can also include:
Step S17 is saved during the operation neural network corresponding calculating figure for each of figure is calculated
Point determines the operation of the corresponding creation of the node according to second corresponding relationship;
Step S18 determines the corresponding calculation template function of the node according to the operation of creation;
Step S19 is based on the calculation template function, the behaviour of the creation is obtained according to the contextual information of the node
The input data of work, and calculated according to the operation of the creation and the input data, obtain the output number of the node
According to.
In one possible implementation, disclosed method further creates calculation template function, creates calculation template
Activity classification can also be different action types according to described above by function, such as action type may include: single defeated
Enter single output, single input and multi-output, the output of dual input list, multiple input single output etc., is that every kind of action type creates corresponding meter
Calculate stencil function.
In one possible implementation, the operation of the corresponding creation of node can be determined according to the second corresponding relationship,
Then calculation template function is determined according to the action type of the operation of creation.Wherein, the input parameter of calculation template function can be with
It is the mark of node, the mark of node can be the information for referring to a certain node of unique identification, such as can be the name of node
Title, serial number etc..Calculation template function can find the corresponding creation of node according to the mark and the second corresponding relationship of node
Operation, can also obtain the input data of operation according to the contextual information of node, detailed process can according to it is positive even
The relationship of connecing determines the predecessor node of node, and the output data of predecessor node is determined according to predecessor node and the second corresponding relationship,
The input data of the operation of the output data and node of predecessor node.In the operation and input number for determining the corresponding creation of node
According to rear, the output data that node is calculated can be carried out according to the operation of creation and input data.
The calculation template function of corresponding calculating is operated according to action type creation, it is possible to reduce the calculating of operation registered
Duplicated code in journey reduces maintenance cost.
The disclosure additionally provides a kind of creating device of the operation of neural network node, which can be applied to handle
Device, the processor can be general processor, for example, processor can be central processing unit CPU (Central
Processing Unit), graphics processing unit GPU (Graphics Processing Unit) etc..The processor can be with
For the artificial intelligence process device for executing artificial intelligence operation, artificial intelligence operation may include machine learning operation, class brain fortune
Calculate etc..Wherein, machine learning operation includes neural network computing, k-means operation, support vector machines operation etc..The artificial intelligence
Energy processor can be for example including NPU (Neural-Network Processing Unit, neural-network processing unit), DSP
(Digital Signal Process, digital signal processing unit), field programmable gate array (Field-
Programmable Gate Array, FPGA) one of chip or combination.Artificial intelligence process device may include multiple fortune
Unit is calculated, multiple arithmetic elements can execute operation parallel.
Fig. 7 shows the block diagram of the creating device according to the operation of the neural network node of one embodiment of the disclosure.Such as Fig. 7 institute
Show, the apparatus may include:
First determining module 71 determines the corresponding creation of the operation of the node for traversing the node in neural network
Function, wherein include the corresponding drawing template establishment function of action type belonging to the operation of the node in the creation function;
First creation module 72, for obtaining input tensor, the parsing institute of the operation based on the drawing template establishment function
The parameter of node is stated, and the parameter according to the operation, the input tensor sum creates the output tensor of the operation;
Second creation module 73, for exporting tensor and parameter creation institute according to the input tensor sum of the operation
State operation.
By the setting drawing template establishment function corresponding with action type belonging to operation in the creation function of operation, so that
The operation for belonging to same action type can be operated using identical drawing template establishment function creation, it is possible to reduce duplicated code.
Fig. 8 shows the block diagram of the creating device according to the operation of the neural network node of one embodiment of the disclosure.Such as Fig. 8 institute
Show, in one possible implementation, first determining module 71 includes:
Determination unit 711, the corresponding creation function of operation for determining the node according to the first corresponding relationship,
In, the first corresponding relationship record is operation and the incidence relation created between function corresponding with operation.
In one possible implementation, first creation module 72 may include:
Acquiring unit 721, for obtaining the input tensor of the operation according to the contextual information of the node;
Resolution unit 722, for according to the variable element of the drawing template establishment function parse the node obtain described in can
The corresponding parameter of variable element;Wherein, the corresponding parameter of the variable element can be according to different operation changes;
Creating unit 723, for corresponding according to the operation, the input tensor of the operation and the variable element
Parameter creates the output tensor of the operation.
In one possible implementation, described device further include:
Module 74 is established, second pair between the output tensor of operation and creation for establishing the node, creation
It should be related to, and second corresponding relationship is saved as into contextual information.
In one possible implementation, described device further include:
Second determining module 75, for being schemed during the operation neural network corresponding calculating figure for calculating
Each of node, the operation of the corresponding creation of the node is determined according to second corresponding relationship;
Third determining module 76 determines the corresponding calculation template function of the node for the operation according to creation;
Computing module 77, for being based on the calculation template function, according to the acquisition of the contextual information of the node
The input data of the operation of creation, and calculated according to the operation of the creation and the input data, obtain the node
Output data.
In one possible implementation, described device further include:
Judgment module 78, for before the node for having traversed the neural network according to topological order, judgement it is described whether
To preset node;
4th determining module 79, if for the point not being default node, it is determined that the operation of the node.
In one possible implementation, described device further include:
Third creation module 70, for creating drawing template establishment letter corresponding with operation according to action type belonging to operation
Number, the drawing template establishment function includes variable element, and the corresponding parameter of the variable element can be according to different operation changes.
In one possible implementation, the action type includes with one of Types Below or a variety of: single input
Single output, single input and multi-output, the output of dual input list, multiple input single output.
Fig. 9 is a kind of device 800 of creation for neural network node operation shown according to an exemplary embodiment
Block diagram.For example, device 800 can be mobile phone, computer, digital broadcasting terminal, messaging device, game control
Platform, tablet device, Medical Devices, body-building equipment, personal digital assistant etc..
Referring to Fig. 9, device 800 may include following one or more components: processing component 802, memory 804, power supply
Component 806, multimedia component 808, audio component 810, the interface 812 of input/output (I/O), sensor module 814, and
Communication component 816.
The integrated operation of the usual control device 800 of processing component 802, such as with display, telephone call, data communication, phase
Machine operation and record operate associated operation.Processing component 802 may include that one or more processors 820 refer to execute
It enables, to perform all or part of the steps of the methods described above.In addition, processing component 802 may include one or more modules, just
Interaction between processing component 802 and other assemblies.For example, processing component 802 may include multi-media module, it is more to facilitate
Interaction between media component 808 and processing component 802.
Memory 804 is configured as storing various types of data to support the operation in device 800.These data are shown
Example includes the instruction of any application or method for operating on device 800, contact data, and telephone book data disappears
Breath, picture, video etc..Memory 804 can be by any kind of volatibility or non-volatile memory device or their group
It closes and realizes, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM) is erasable to compile
Journey read-only memory (EPROM), programmable read only memory (PROM), read-only memory (ROM), magnetic memory, flash
Device, disk or CD.
Power supply module 806 provides electric power for the various assemblies of device 800.Power supply module 806 may include power management system
System, one or more power supplys and other with for device 800 generate, manage, and distribute the associated component of electric power.
Multimedia component 808 includes the screen of one output interface of offer between described device 800 and user.One
In a little embodiments, screen may include liquid crystal display (LCD) and touch panel (TP).If screen includes touch panel, screen
Curtain may be implemented as touch screen, to receive input signal from the user.Touch panel includes one or more touch sensings
Device is to sense the gesture on touch, slide, and touch panel.The touch sensor can not only sense touch or sliding action
Boundary, but also detect duration and pressure associated with the touch or slide operation.In some embodiments, more matchmakers
Body component 808 includes a front camera and/or rear camera.When device 800 is in operation mode, such as screening-mode or
When video mode, front camera and/or rear camera can receive external multi-medium data.Each front camera and
Rear camera can be a fixed optical lens system or have focusing and optical zoom capabilities.
Audio component 810 is configured as output and/or input audio signal.For example, audio component 810 includes a Mike
Wind (MIC), when device 800 is in operation mode, when such as call mode, recording mode, and voice recognition mode, microphone is matched
It is set to reception external audio signal.The received audio signal can be further stored in memory 804 or via communication set
Part 816 is sent.In some embodiments, audio component 810 further includes a loudspeaker, is used for output audio signal.
I/O interface 812 provides interface between processing component 802 and peripheral interface module, and above-mentioned peripheral interface module can
To be keyboard, click wheel, button etc..These buttons may include, but are not limited to: home button, volume button, start button and lock
Determine button.
Sensor module 814 includes one or more sensors, and the state for providing various aspects for device 800 is commented
Estimate.For example, sensor module 814 can detecte the state that opens/closes of device 800, and the relative positioning of component, for example, it is described
Component is the display and keypad of device 800, and sensor module 814 can be with 800 1 components of detection device 800 or device
Position change, the existence or non-existence that user contacts with device 800,800 orientation of device or acceleration/deceleration and device 800
Temperature change.Sensor module 814 may include proximity sensor, be configured to detect without any physical contact
Presence of nearby objects.Sensor module 814 can also include optical sensor, such as CMOS or ccd image sensor, at
As being used in application.In some embodiments, which can also include acceleration transducer, gyro sensors
Device, Magnetic Sensor, pressure sensor or temperature sensor.
Communication component 816 is configured to facilitate the communication of wired or wireless way between device 800 and other equipment.Device
800 can access the wireless network based on communication standard, such as WiFi, 2G or 3G or their combination.In an exemplary implementation
In example, communication component 816 receives broadcast singal or broadcast related information from external broadcasting management system via broadcast channel.
In one exemplary embodiment, the communication component 816 further includes near-field communication (NFC) module, to promote short range communication.Example
Such as, NFC module can be based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra wide band (UWB) technology,
Bluetooth (BT) technology and other technologies are realized.
In the exemplary embodiment, device 800 can be believed by one or more application specific integrated circuit (ASIC), number
Number processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD), field programmable gate array
(FPGA), controller, microcontroller, microprocessor or other electronic components are realized, for executing the above method.
In the exemplary embodiment, a kind of non-volatile computer readable storage medium storing program for executing is additionally provided, for example including calculating
The memory 804 of machine program instruction, above-mentioned computer program instructions can be executed above-mentioned to complete by the processor 820 of device 800
Method.
Figure 10 is a kind of device of creation for neural network node operation shown according to an exemplary embodiment
1900 block diagram.For example, device 1900 may be provided as a server.Referring to Fig.1 0, device 1900 includes processing component
1922, it further comprise one or more processors and memory resource represented by a memory 1932, for storing
It can be by the instruction of the execution of processing component 1922, such as application program.The application program stored in memory 1932 may include
It is one or more each correspond to one group of instruction module.In addition, processing component 1922 is configured as executing instruction,
To execute the above method.
Device 1900 can also include that a power supply module 1926 be configured as the power management of executive device 1900, and one
Wired or wireless network interface 1950 is configured as device 1900 being connected to network and input and output (I/O) interface
1958.Device 1900 can be operated based on the operating system for being stored in memory 1932, such as Windows ServerTM, Mac
OS XTM, UnixTM, LinuxTM, FreeBSDTM or similar.
In the exemplary embodiment, a kind of non-volatile computer readable storage medium storing program for executing is additionally provided, for example including calculating
The memory 1932 of machine program instruction, above-mentioned computer program instructions can be executed by the processing component 1922 of device 1900 to complete
The above method.
The disclosure can be system, method and/or computer program product.Computer program product may include computer
Readable storage medium storing program for executing, containing for making processor realize the computer-readable program instructions of various aspects of the disclosure.
Computer readable storage medium, which can be, can keep and store the tangible of the instruction used by instruction execution equipment
Equipment.Computer readable storage medium for example can be-- but it is not limited to-- storage device electric, magnetic storage apparatus, optical storage
Equipment, electric magnetic storage apparatus, semiconductor memory apparatus or above-mentioned any appropriate combination.Computer readable storage medium
More specific example (non exhaustive list) includes: portable computer diskette, hard disk, random access memory (RAM), read-only deposits
It is reservoir (ROM), erasable programmable read only memory (EPROM or flash memory), static random access memory (SRAM), portable
Compact disk read-only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanical coding equipment, for example thereon
It is stored with punch card or groove internal projection structure and the above-mentioned any appropriate combination of instruction.Calculating used herein above
Machine readable storage medium storing program for executing is not interpreted that instantaneous signal itself, the electromagnetic wave of such as radio wave or other Free propagations lead to
It crosses the electromagnetic wave (for example, the light pulse for passing through fiber optic cables) of waveguide or the propagation of other transmission mediums or is transmitted by electric wire
Electric signal.
Computer-readable program instructions as described herein can be downloaded to from computer readable storage medium it is each calculate/
Processing equipment, or outer computer or outer is downloaded to by network, such as internet, local area network, wide area network and/or wireless network
Portion stores equipment.Network may include copper transmission cable, optical fiber transmission, wireless transmission, router, firewall, interchanger, gateway
Computer and/or Edge Server.Adapter or network interface in each calculating/processing equipment are received from network to be counted
Calculation machine readable program instructions, and the computer-readable program instructions are forwarded, for the meter being stored in each calculating/processing equipment
In calculation machine readable storage medium storing program for executing.
Computer program instructions for executing disclosure operation can be assembly instruction, instruction set architecture (ISA) instructs,
Machine instruction, machine-dependent instructions, microcode, firmware instructions, condition setup data or with one or more programming languages
The source code or object code that any combination is write, the programming language include the programming language-of object-oriented such as
Smalltalk, C++ etc., and conventional procedural programming languages-such as " C " language or similar programming language.Computer
Readable program instructions can be executed fully on the user computer, partly execute on the user computer, be only as one
Vertical software package executes, part executes on the remote computer or completely in remote computer on the user computer for part
Or it is executed on server.In situations involving remote computers, remote computer can pass through network-packet of any kind
It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as benefit
It is connected with ISP by internet).In some embodiments, by utilizing computer-readable program instructions
Status information carry out personalized customization electronic circuit, such as programmable logic circuit, field programmable gate array (FPGA) or can
Programmed logic array (PLA) (PLA), the electronic circuit can execute computer-readable program instructions, to realize each side of the disclosure
Face.
Referring herein to according to the flow chart of the method, apparatus (system) of the embodiment of the present disclosure and computer program product and/
Or block diagram describes various aspects of the disclosure.It should be appreciated that flowchart and or block diagram each box and flow chart and/
Or in block diagram each box combination, can be realized by computer-readable program instructions.
These computer-readable program instructions can be supplied to general purpose computer, special purpose computer or other programmable datas
The processor of processing unit, so that a kind of machine is produced, so that these instructions are passing through computer or other programmable datas
When the processor of processing unit executes, function specified in one or more boxes in implementation flow chart and/or block diagram is produced
The device of energy/movement.These computer-readable program instructions can also be stored in a computer-readable storage medium, these refer to
It enables so that computer, programmable data processing unit and/or other equipment work in a specific way, thus, it is stored with instruction
Computer-readable medium then includes a manufacture comprising in one or more boxes in implementation flow chart and/or block diagram
The instruction of the various aspects of defined function action.
Computer-readable program instructions can also be loaded into computer, other programmable data processing units or other
In equipment, so that series of operation steps are executed in computer, other programmable data processing units or other equipment, to produce
Raw computer implemented process, so that executed in computer, other programmable data processing units or other equipment
Instruct function action specified in one or more boxes in implementation flow chart and/or block diagram.
The flow chart and block diagram in the drawings show system, method and the computer journeys according to multiple embodiments of the disclosure
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
One module of table, program segment or a part of instruction, the module, program segment or a part of instruction include one or more use
The executable instruction of the logic function as defined in realizing.In some implementations as replacements, function marked in the box
It can occur in a different order than that indicated in the drawings.For example, two continuous boxes can actually be held substantially in parallel
Row, they can also be executed in the opposite order sometimes, and this depends on the function involved.It is also noted that block diagram and/or
The combination of each box in flow chart and the box in block diagram and or flow chart, can the function as defined in executing or dynamic
The dedicated hardware based system made is realized, or can be realized using a combination of dedicated hardware and computer instructions.
The presently disclosed embodiments is described above, above description is exemplary, and non-exclusive, and
It is not limited to disclosed each embodiment.Without departing from the scope and spirit of illustrated each embodiment, for this skill
Many modifications and changes are obvious for the those of ordinary skill in art field.The selection of term used herein, purport
In the principle, practical application or technological improvement to the technology in market for best explaining each embodiment, or lead this technology
Other those of ordinary skill in domain can understand each embodiment disclosed herein.