CN112668707B - Operation method, device and related product - Google Patents

Operation method, device and related product Download PDF

Info

Publication number
CN112668707B
CN112668707B CN202011570158.4A CN202011570158A CN112668707B CN 112668707 B CN112668707 B CN 112668707B CN 202011570158 A CN202011570158 A CN 202011570158A CN 112668707 B CN112668707 B CN 112668707B
Authority
CN
China
Prior art keywords
node
key value
value pair
represented
attribute
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011570158.4A
Other languages
Chinese (zh)
Other versions
CN112668707A (en
Inventor
请求不公布姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Cambricon Information Technology Co Ltd
Original Assignee
Anhui Cambricon Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Cambricon Information Technology Co Ltd filed Critical Anhui Cambricon Information Technology Co Ltd
Priority to CN202011570158.4A priority Critical patent/CN112668707B/en
Publication of CN112668707A publication Critical patent/CN112668707A/en
Application granted granted Critical
Publication of CN112668707B publication Critical patent/CN112668707B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Neurology (AREA)
  • Machine Translation (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure relates to an operation method, apparatus and related product, the product comprising a controller unit comprising: the system comprises an instruction cache unit, an instruction processing unit and a storage queue unit; the instruction cache unit is used for storing calculation instructions related to the artificial neural network operation; the instruction processing unit is used for analyzing the calculation instructions to obtain a plurality of operation instructions; the store queue unit is configured to store an instruction queue, where the instruction queue includes: a plurality of arithmetic instructions or calculation instructions to be executed in the order of the queue. By the method, the operation efficiency of the related products in the operation of the neural network model can be improved.

Description

Operation method, device and related product
Technical Field
The disclosure relates to the technical field of information processing, and in particular relates to an operation method, an operation device and related products.
Background
In the field of artificial intelligence technology, a neural network algorithm is a machine learning algorithm which is very popular recently, and has very good effects in various fields, such as image recognition, voice recognition, natural language processing and the like. With the development of neural network algorithms, the complexity of the algorithms is also higher and higher, and in order to improve the recognition degree, the scale of the model is also gradually increased. Processing with the GPU and CPU takes a significant amount of computation time and power consumption to start these large-scale models.
Disclosure of Invention
In view of this, the disclosure provides a method and a device for configuring a computational graph of a neural network.
According to an aspect of the present disclosure, there is provided a configuration method of a computation graph of a neural network, the configuration method including:
acquiring a configuration file of a calculation graph;
Analyzing the configuration file to obtain a first array, wherein the first array comprises a first object representing a node of the computational graph, the first object comprises a node attribute key value pair and a node parameter key value pair, the node attribute key value pair is used for recording the attribute of the node, and the node parameter key value pair is used for recording the parameter of the node;
extracting parameters of the node represented by the first object according to the node parameter key value pair, and creating the node represented by the first object according to the parameters of the node represented by the first object;
And extracting the attribute of the node represented by the first object according to the node attribute key value pair of the first object, and adding the attribute for the node represented by the first object.
In one possible implementation, the value of the node attribute key pair is a second set, where the second set includes a second object, and the second object is a key pair for defining an attribute of a node to which the second object belongs.
In a possible implementation manner, the node parameter key value pair includes a node name key value pair and an operation key value pair, wherein the node name key value pair is used for recording the name of the node, and the operation key value pair is used for recording the operation type of the node.
In a possible implementation manner, extracting parameters of the node represented by the first object according to the node parameter key value pair, and creating the node represented by the first object according to the parameters of the node represented by the first object includes:
and extracting the name and the operation type of the node represented by the first object according to the node name key value pair and the operation key value pair, and creating the node represented by the first object according to the name and the operation type of the node represented by the first object.
In a possible implementation manner, the first object further includes a structural key value pair, where a value of the structural key value pair is a name of an input node of the node to which the structural key value pair belongs, where output data of the input node of the node is taken as input data of the node,
The configuration method further comprises the following steps:
And extracting the names of the input nodes of the nodes represented by the first object according to the structural key value pairs, and adding the names of the input nodes for the nodes represented by the first object.
In a possible implementation manner, if an input node of a certain node includes a plurality of output data, a value of a structural key value pair is a third array, and the value of the structural key value pair includes a string for indicating that one output data of the plurality of output data is taken as input data of the certain node.
In one possible implementation, obtaining a configuration file of a computational graph includes:
Creating a first array;
And configuring the first array according to the computational graph of the neural network model, and generating a configuration file of the computational graph.
According to another aspect of the present disclosure, there is provided a configuration apparatus of a computational graph of a neural network, the configuration apparatus including:
the acquisition module is used for acquiring the configuration file of the calculation graph;
The analysis module is used for analyzing the configuration file to obtain a first array, wherein the first array comprises a first object representing the node of the computation graph, the first object comprises a node attribute key value pair and a node parameter key value pair, the node attribute key value pair is used for recording the attribute of the node, and the node parameter key value pair is used for recording the parameter of the node;
the creation module is used for extracting the parameters of the node represented by the first object according to the node parameter key value pair and creating the node represented by the first object according to the parameters of the node represented by the first object;
And the attribute adding module is used for extracting the attribute of the node represented by the first object according to the node attribute key value pair of the first object and adding the attribute for the node represented by the first object.
In a possible implementation manner, the value of the node attribute key value pair is a second group, where the second group includes a second object, and the second object is a key value pair used to define an attribute of a node to which the second object belongs.
In a possible implementation manner, the node parameter key value pair includes a node name key value pair and an operation key value pair, wherein the node name key value pair is used for recording the name of the node, and the operation key value pair is used for recording the operation type of the node.
In one possible implementation, the creating module includes:
And the first creation unit is used for extracting the name and the operation type of the node represented by the first object according to the node name key value pair and the operation key value pair, and creating the node represented by the first object according to the name and the operation type of the node represented by the first object.
In a possible implementation manner, the first object further includes a structural key value pair, where a value of the structural key value pair is a name of an input node of the node to which the structural key value pair belongs, where output data of the input node of the node is taken as input data of the node,
The configuration device further includes:
And the input adding module is used for extracting the names of the input nodes of the nodes represented by the first object according to the structural key value pairs and adding the names of the input nodes for the nodes represented by the first object.
In a possible implementation manner, if an input node of a certain node includes a plurality of output data, a value of a structural key value pair is a third array, and the value of the structural key value pair includes a string for indicating that one output data of the plurality of output data is taken as input data of the certain node.
In a possible implementation manner, the acquiring module includes:
a second creation unit for creating a first array;
And the generating unit is used for configuring the first array according to the computational graph of the neural network model and generating a configuration file of the computational graph.
According to another aspect of the present disclosure, there is provided a configuration apparatus of a computation graph of a neural network, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the above method.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer program instructions, wherein the computer program instructions, when executed by a processor, implement the above-described method.
The node attribute key value pairs and the node parameter key value pairs in the configuration file are endowed with different attributes and parameters, so that the uncertain and different attributes and parameters of different nodes can be uniformly and flexibly configured, the information of the calculation graph is transferred to the neural network execution frame, and the analysis and construction analogy of the calculation graph in the neural network execution frame is stable and is not changed due to the change of the node attribute.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments, features and aspects of the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 shows a flowchart of a method of configuring a computational graph of a neural network according to an embodiment of the present disclosure.
Fig. 2 shows a flowchart of a method of configuring a computational graph of a neural network according to an embodiment of the present disclosure.
Fig. 3 shows a flowchart of a method of configuring a computational graph of a neural network according to an embodiment of the present disclosure.
Fig. 4 shows a block diagram of a configuration apparatus of a computational graph of a neural network according to an embodiment of the present disclosure.
Fig. 5 shows a block diagram of a configuration apparatus of a computational graph of a neural network according to an embodiment of the present disclosure.
Fig. 6 shows a block diagram of an apparatus for configuration of a computational graph of a neural network, according to an embodiment of the present disclosure.
Fig. 7 shows a block diagram of an apparatus for configuration of a computational graph of a neural network, according to an embodiment of the present disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the disclosure will be described in detail below with reference to the drawings. In the drawings, like reference numbers indicate identical or functionally similar elements. Although various aspects of the embodiments are illustrated in the accompanying drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
In addition, numerous specific details are set forth in the following detailed description in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements, and circuits well known to those skilled in the art have not been described in detail in order not to obscure the present disclosure.
Because the calculation amount of the deep learning is large, the calculation speed requirement is high, the requirements of the actual application scene of the deep learning on the hardware for processing the data are relatively high in performance and function, and the hardware with high operation speed and low power consumption is very necessary. The neural network accelerator (artificial intelligence processor) is hardware with high operation speed and low power consumption.
In order to fully develop the performance of hardware, a programming interface of a hardware platform is provided for a user, and a high-performance neural network computing library is generated. The operation module of the high-performance neural network calculation library provides interfaces for basic operation and tensor calculation of the neural network and relatively perfect support for deep learning operation, and a user can splice the self-designed neural network by using the basic operations.
The method has the advantages that the neural network is built by utilizing the high-performance neural network computing library, a developer needs to know the operation module, the data module and the equipment management module clearly, the operation flow convention of the whole high-performance neural network computing library is known, and when different neural networks are built, the code quantity is large and the code repetition degree is high.
In order to solve the problem that the neural network is difficult to build based on the high-performance neural network computing library, a neural network execution framework is provided, so that a network structure can be built quickly by developing and testing personnel of the high-performance neural network computing library without knowing the details of the high-performance neural network computing library.
Since each operation (node) in the computational graph needs to set up uncertain and different properties and parameters, a unified and flexible way is needed to transfer the information, and in order to solve the problem of how to transfer the information of the computational graph to the neural network execution framework, the present disclosure provides a configuration method of the computational graph of the neural network.
The configuration method of the computation graph may be applied to a processor, which may be a general-purpose processor, for example, the processor may be the central processing unit CPU (Central Processing Unit), the graphics processing unit GPU (Graphics Processing Unit), or the like. The processor may also be an artificial intelligence processor for performing artificial intelligence operations, which may include machine learning operations, brain-like operations, and the like. The machine learning operation comprises neural network operation, k-means operation, support vector machine operation and the like. The artificial intelligence processor may include, for example, one or a combination of an 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) chip. The artificial intelligence processor may include a plurality of arithmetic units, and the plurality of arithmetic units may perform operations in parallel.
Fig. 1 shows a flowchart of a method of configuring a computational graph of a neural network according to an embodiment of the present disclosure. As shown in fig. 1, the method may include:
Step S11, obtaining a configuration file of a calculation map;
Step S12, analyzing the configuration file to obtain a first array, wherein the first array comprises a first object representing a node of the computation graph, and the first object comprises a node attribute key value pair and a node parameter key value pair, wherein the node attribute key value pair is used for recording the attribute of the node, and the node parameter key value pair is used for recording the parameter of the node;
Step S13, extracting parameters of the node represented by the first object according to the node parameter key value pair, and creating the node represented by the first object according to the parameters of the node represented by the first object;
And S14, extracting the attribute of the node represented by the first object according to the node attribute key value pair of the first object, and adding the attribute to the node represented by the first object.
The node attribute key value pairs and the node parameter key value pairs in the configuration file are endowed with different attributes and parameters, so that the uncertain and different attributes and parameters of different nodes can be uniformly and flexibly configured, the information of the calculation graph is transferred to the neural network execution frame, and the analysis and construction analogy of the calculation graph in the neural network execution frame is stable and is not changed due to the change of the node attribute.
The configuration file may be preconfigured in the following manner, that is, the process of obtaining the configuration file of the calculation map in step S11 may include: creating a first array, which may include therein a first object for representing a node of a computational graph as described above; the first array is configured according to the computational graph of the neural network model, and a configuration file of the computational graph is generated, namely, the first object in the first array is configured according to the nodes in the computational graph, and the configuration file of the computational graph is generated.
Wherein the computational graph (Computational Graph) is one way to represent the data functions by graph-theory language. In graph theory, nodes are connected by edges, the nodes represent things, and the edges connecting two nodes represent the relationship between two things. In the calculation graph, nodes represent input data or operators (operations) of the neural network, edges connecting the two nodes represent input and output relations between the two points, and the edges can be attached with weights and the like. Before configuration, a corresponding calculation map is built according to the neural network model, and then the configuration process is carried out according to the calculation map.
The first array may be a JSON (JavaScript Object Notation, JS object profile) array, the first object may be a JSON object, each node in the computation graph may be represented by a JSON object in the JSON array, the JSON object may describe nodes in the computation graph with key-value pairs, one JSON object may include one or more key-value pairs, and the plurality of key-value pairs may describe different information for the nodes. Of course, the first array is not limited to JSON arrays, nor is the first object limited to JSON objects.
For example, for each node in the computational graph, this node may be described by a plurality of key-value pairs, e.g., a node attribute key-value pair for recording the attribute of the node, a node parameter key-value pair for recording the parameter of the node.
The node parameter key value pair may include a node name key value pair and an operation key value pair, where the node name key value pair is used to record the name of the node, and the operation key value pair is used to record the operation type of the node. The type of operation of the node, i.e., operation of the node, e.g., reshape, transpose, etc.
For example, the key of the node name key pair may be name and value may be string, and the key of the operation key pair may be op and value may be string.
The attribute of a node may refer to information related to operation of the node, such as an add_pad attribute of the operation.
In one possible implementation, the key of the node attribute key value pair may be attrs, the value may be a JSON object, the key and the value of the JSON object may be string, and the string may take different values to further represent different attributes. By the method, unified and flexible configuration of different attributes of different nodes can be realized.
In one possible implementation, the value of the node attribute key value pair may be a second array, and the second array may include a plurality of second objects, and the second objects may be key value pairs for defining attributes of nodes to which the second objects belong. The second array may be a JSON array, and the second object may be a JSON object. For example, the key of the node attribute key pair may be attrs and the value may be a JSON array. The keys and the values of the second objects can be strings, and the keys and the values of the second objects can take different values so as to represent various attributes, so that flexible configuration of a plurality of different attributes of one node can be realized. Of course, the second array is not limited to JSON arrays, nor is the second object limited to JSON objects.
In one possible implementation, the first object may further include a structure key value pair, where the structure key value pair is used to record an input node of the node to which the structure key value pair belongs, for example, a value of the structure key value pair may record a name of the input node of the node to which the structure key value pair belongs, where output data of the input node of the node is used as input data of the node. For example, the key of a structural key pair may be input and the value may be string.
In another possible implementation manner, if an input node of a certain node includes a plurality of output data, a value of a structural key pair may be a third array, and the third array may also be a JSON array, where the value of the structural key pair may include: the input node includes a plurality of output data of an input node, a character string for designating any one of the plurality of output data as input data of the certain node. At this time, the value of the structural key pair may be a JSON array composed of strings, that is, a plurality of output data may be represented by a plurality of strings, respectively, one of which is designated as input data by one string.
Table 1 shows the manner in which node definitions in a computational graph are calculated according to embodiments of the present disclosure.
TABLE 1
Table 2 shows the manner in which the values of the node attribute key value pairs are defined.
TABLE 2 values of attrs
In one possible implementation manner, parameters, attributes and the like of the nodes in the computation graph can be configured manually, and the processor creates a first array for storing the parameters, attributes and the like of the nodes according to the parameters, attributes and the like of the nodes configured manually, so as to generate a configuration file, thereby obtaining the configuration file of the computation graph.
According to the embodiment of the disclosure, the description is performed on each node in the computational graph through a plurality of key value pairs, and different attributes and parameters of different nodes can be configured uniformly and flexibly.
After the configuration file is configured, the configuration file can be saved as a map definition file to the processor, and the processor can acquire the configuration file and then analyze the configuration file to obtain a first array.
The first array may include a plurality of first objects, and for each of the plurality of first objects, the processes of step S13 and step S14 may be executed, a node corresponding to the first object is created, and an attribute of the node is added to the node. That is, the processor may traverse the first objects in the first array one by one and create nodes represented by the first objects.
Before all the first objects in the first data are traversed, parameters of the nodes represented by the first objects can be extracted according to node parameter key value pairs in the first objects, and the nodes represented by the first objects are created according to the parameters of the nodes represented by the first objects. As described above, the node parameter key pair may include a node name key pair and an operation key pair, and thus, in one example, step S13 may include: and extracting the name and the operation type of the node represented by the first object according to the node name key value pair and the operation key value pair, and creating the node represented by the first object according to the name and the operation type of the node represented by the first object.
In one possible implementation, the meaning of the value representation of a key-value pair may be determined by identifying the key of the key-value pair. For example, if the key of a key-value pair is name, then the value of the key-value pair represents the name of the node; if the key of a key-value pair is an op, then the value of the key-value pair represents the operation type of the node.
In one possible implementation, a NodeDef class may be created, in which NodeDef the name and operation type of the node represented by the first object are set according to the extracted name and operation type of the node.
Note that, the node parameter key pair may also include other key pairs for representing other parameters of the node, for example, parameters such as a weight of the node, which is not limited in this disclosure.
For step S14, as described above, a node attribute key pair is determined by whether the key of the key pair is attrs, and then the value of the node attribute key pair is extracted to obtain the attribute of the node represented by the first object, and the attribute of the node represented by the first object is set according to the extracted attribute of the node in the NodeDef class.
Fig. 2 shows a flowchart of a method of configuring a computational graph of a neural network according to an embodiment of the present disclosure. As described above, the value of the structural key value pair may be the name of the input node of the node to which the structural key value pair belongs, where the output data of the input node of the node is used as the input data of the node, as shown in fig. 2, and the method may further include:
And S15, extracting the names of the input nodes of the nodes represented by the first object according to the structural key value pairs, and adding the names of the input nodes to the nodes represented by the first object.
The first array may include a plurality of first objects, and the process of step S15 may be performed for each of the plurality of first objects, to add the name of the input node to the node.
The structural key value pair can be determined by whether the key of the key value pair is input, then the name of the input node of the node represented by the first object can be obtained by extracting the value of the structural key value pair, and the name of the input node of the node represented by the first object is set according to the extracted name of the input node of the node in NodeDef types.
For the case where the input node includes a plurality of output data, it is also possible to extract the values of the structure key value pairs to obtain the name of the input node of the node represented by the first object, the plurality of output data of the input node, and the output data of the input data of the node represented by the first object, and to set the name of the input node of the node represented by the first object, the plurality of output data of the input node, and the output data of the input data of the node represented by the first object in the NodeDef class.
Application example
Fig. 3 shows a flowchart of a method of configuring a computational graph of a neural network according to an embodiment of the present disclosure. As shown in fig. 3, the configuration file may be parsed into the JSON array first, then each JSON object in the JSON array is traversed, and key-value pairs in each JSON object are read in turn and corresponding nodes are created.
As shown in fig. 3, it is determined whether the JSON array is traversed, and if the JSON array is not traversed (i.e., the JSON objects in the JSON array are not traversed), then a NodeDef class is created for recording the node represented by the currently traversed JSON object. The name and operation type (operation) of the node represented by the currently traversed JSON object are set in the NodeDef class according to the extracted name and operation type of the node.
Then, input nodes of the nodes can be traversed according to the structural key value of the currently traversed JSON object, and the names of the input nodes of the nodes represented by the currently traversed JSON object are set according to the names of the extracted input nodes of the nodes in NodeDef classes.
The node attribute key value pair of the currently traversed JSON object can be used for traversing the node attribute, and the attribute of the node represented by the currently traversed JSON object can be set in NodeDef classes according to the extracted node attribute.
After traversing the node attribute key value pair of the currently traversed JSON object, the NodeDef class can be saved in the GraphDef class, and then whether the JSON array is traversed is continuously judged.
The above process is repeated continuously until the JSON objects in the JSON array are traversed, and the configuration process is finished.
It should be noted that the order of traversing the input nodes and the attributes of the nodes in fig. 3 is only one example of the disclosure, and the disclosure is not limited thereto, and the attributes of the nodes may be traversed first and then the input nodes of the nodes may be traversed.
The present disclosure also provides a configuration apparatus of a computation graph of a neural network, and fig. 4 shows a block diagram of the configuration apparatus of the computation graph of the neural network according to an embodiment of the present disclosure.
The configuration means of the computational graph may be applied to a processor, which may be a general-purpose processor, for example, the processor may be the central processing unit CPU (Central Processing Unit), the graphics processing unit GPU (Graphics Processing Unit), or the like. The processor may also be an artificial intelligence processor for performing artificial intelligence operations, which may include machine learning operations, brain-like operations, and the like. The machine learning operation comprises neural network operation, k-means operation, support vector machine operation and the like. The artificial intelligence processor may include, for example, one or a combination of an 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) chip. The artificial intelligence processor may include a plurality of arithmetic units, and the plurality of arithmetic units may perform operations in parallel.
As shown in fig. 4, the configuration device may include:
An obtaining module 51, configured to obtain a configuration file of the computation graph;
The parsing module 52 is configured to parse the configuration file to obtain a first array, where the first array includes a first object that represents a node of the computation graph, and the first object includes a node attribute key value pair and a node parameter key value pair, where the node attribute key value pair is used to record an attribute of the node, and the node parameter key value pair is used to record a parameter of the node;
A creating module 53, configured to extract parameters of the node represented by the first object according to the node parameter key pair, and create the node represented by the first object according to the parameters of the node represented by the first object;
The attribute adding module 54 is configured to extract an attribute of a node represented by the first object according to a node attribute key pair of the first object, and add the attribute to the node represented by the first object.
The node attribute key value pairs and the node parameter key value pairs in the configuration file are endowed with different attributes and parameters, so that the uncertain and different attributes and parameters of different nodes can be uniformly and flexibly configured, the information of the calculation graph is transferred to the neural network execution frame, and the analysis and construction analogy of the calculation graph in the neural network execution frame is stable and is not changed due to the change of the node attribute.
In one possible implementation, the value of the node attribute key pair is a second set, where the second set includes a second object, and the second object is a key pair for defining an attribute of a node to which the second object belongs.
In one possible implementation manner, the node parameter key value pair includes a node name key value pair and an operation key value pair, wherein the node name key value pair is used for recording the name of the node, and the operation key value pair is used for recording the operation type of the node.
Fig. 5 shows a block diagram of a configuration apparatus of a computational graph of a neural network according to an embodiment of the present disclosure.
As shown in fig. 5, in one possible implementation, the creating module 53 includes:
the first creating unit 531 is configured to extract a name and an operation type of a node represented by the first object according to the node name key value pair and the operation key value pair, and create the node represented by the first object according to the name and the operation type of the node represented by the first object.
In a possible implementation manner, the first object further includes a structural key value pair, where the structural key value pair is used to record an input node of a node to which the structural key value pair belongs.
In one possible implementation, the value of the structural key value pair is the name of the input node of the node to which the structural key value pair belongs, wherein the output data of the input node of the node is taken as the input data of the node,
As shown in fig. 5, the configuration device may further include:
the input adding module 55 is configured to extract a name of an input node of a node represented by the first object according to the structural key value pair, and add the name of the input node to the node represented by the first object.
In one possible implementation, if the input node of a certain node includes a plurality of output data, the value of the structural key value pair is a third array, and the value of the structural key value pair includes a string for indicating that one of the plurality of output data is the input data of the certain node.
In one possible implementation, the obtaining module 51 includes:
A second creation unit 511 for creating a first array;
the generating unit 512 is configured to configure the first array according to the computational graph of the neural network model, and generate a configuration file of the computational graph.
Fig. 6 is a block diagram illustrating an apparatus 800 for configuration of a computational graph of a neural network, according to an example embodiment. For example, apparatus 800 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 6, apparatus 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and a communication component 816.
The processing component 802 generally controls overall operation of the apparatus 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interactions between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 806 provides power to the various components of the device 800. The power components 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the device 800.
The multimedia component 808 includes a screen between the device 800 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and/or a rear camera. The front camera and/or the rear camera may receive external multimedia data when the apparatus 800 is in an operational mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 further includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of the apparatus 800. For example, the sensor assembly 814 may detect an on/off state of the device 800, a relative positioning of the components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, an orientation or acceleration/deceleration of the device 800, and a change in temperature of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communication between the apparatus 800 and other devices, either in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi,2G or 3G, or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 804 including computer program instructions executable by processor 820 of apparatus 800 to perform the above-described methods.
Fig. 7 is a block diagram illustrating an apparatus 1900 for configuration of a computational graph of a neural network, according to an example embodiment. For example, the apparatus 1900 may be provided as a server. Referring to fig. 7, the apparatus 1900 includes a processing component 1922 that further includes one or more processors and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules each corresponding to a set of instructions. Further, processing component 1922 is configured to execute instructions to perform the methods described above.
The apparatus 1900 may further include a power component 1926 configured to perform power management of the apparatus 1900, a wired or wireless network interface 1950 configured to connect the apparatus 1900 to a network, and an input/output (I/O) interface 1958. The device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 1932, including computer program instructions executable by processing component 1922 of apparatus 1900 to perform the above-described methods.
The present disclosure may be a system, method, and/or computer program product. The computer program product may include a computer readable storage medium having computer readable program instructions embodied thereon for causing a processor to implement aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: portable computer disks, hard disks, random Access Memory (RAM), read-only memory (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 Disks (DVD), memory sticks, floppy disks, mechanical coding devices, punch cards or in-groove structures such as punch cards or grooves having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media, as used herein, are not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., optical pulses through fiber optic cables), or electrical signals transmitted through wires.
The computer readable program instructions described herein may be downloaded from a computer readable storage medium to a respective computing/processing device or to an external computer or external storage device over a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers and/or edge servers. The network interface card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium in the respective computing/processing device.
The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as SMALLTALK, C ++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions may be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the present disclosure are implemented by personalizing electronic circuitry, such as programmable logic circuitry, field Programmable Gate Arrays (FPGAs), or Programmable Logic Arrays (PLAs), with state information of computer readable program instructions, which can execute the computer readable program instructions.
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium having the instructions stored therein includes an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing description of the embodiments of the present disclosure has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the various embodiments described. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or the technical improvement of the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (9)

1. A method for configuring a computational graph of a neural network, the method comprising:
acquiring a configuration file of a calculation graph;
Analyzing the configuration file to obtain a first array, wherein the first array comprises a first object representing a node of the calculation graph, the first object comprises a node attribute key value pair, a structure key value pair and a node parameter key value pair, the node attribute key value pair is used for recording the attribute of the node, the node parameter key value pair is used for recording the parameter of the node, the value of the structure key value pair is the name of an input node of the node to which the structure key value pair belongs, and the output data of the input node of the node is used as the input data of the node; the first array is a JSON array, and the first object is a JSON object;
Judging whether the JSON array is traversed, if not, creating NodeDef types of nodes for recording the nodes represented by the currently traversed JSON object, extracting parameters of the nodes represented by the first object according to the node parameter key value pairs, and creating the nodes represented by the first object according to the parameters of the nodes represented by the first object; extracting the names of the input nodes of the nodes represented by the first object according to the structural key value pairs, and adding the names of the input nodes for the nodes represented by the first object;
And extracting the attribute of the node represented by the first object according to the node attribute key value pair of the first object, and adding the attribute for the node represented by the first object.
2. The configuration method according to claim 1, wherein the value of the node attribute key pair is a second number group, the second number group including a second object, the second object being a key pair for defining an attribute of a node to which the second object belongs.
3. The configuration method according to claim 1, wherein the node parameter key value pair includes a node name key value pair for recording a name of a node and an operation key value pair for recording an operation type of the node.
4. A configuration method according to claim 3, characterized in that extracting parameters of the node represented by the first object from the node parameter key pairs and creating the node represented by the first object from the parameters of the node represented by the first object comprises:
and extracting the name and the operation type of the node represented by the first object according to the node name key value pair and the operation key value pair, and creating the node represented by the first object according to the name and the operation type of the node represented by the first object.
5. The arrangement according to claim 1, wherein if an input node of a certain node includes a plurality of output data, the value of the structure key value pair is a third array, and the value of the structure key value pair includes a character string for designating a certain output data of the plurality of output data as input data of the certain node.
6. The configuration method according to claim 1, wherein obtaining a configuration file of a calculation map includes:
Creating a first array;
And configuring the first array according to the computational graph of the neural network model, and generating a configuration file of the computational graph.
7. A configuration apparatus of a computational graph of a neural network, the configuration apparatus comprising:
the acquisition module is used for acquiring the configuration file of the calculation graph;
the analysis module is used for analyzing the configuration file to obtain a first array, wherein the first array comprises a first object representing a node of the computation graph, the first object comprises a node attribute key value pair, a structure key value pair and a node parameter key value pair, the node attribute key value pair is used for recording the attribute of the node, the node parameter key value pair is used for recording the parameter of the node, the value of the structure key value pair is the name of an input node of the node to which the structure key value pair belongs, and the output data of the input node of the node is used as the input data of the node; the first array is a JSON array, and the first object is a JSON object;
The creating module is used for judging whether the JSON array is traversed, if the JSON array is not traversed, creating NodeDef types of nodes represented by the JSON object which is traversed currently, extracting parameters of the nodes represented by the first object according to the node parameter key value pairs, and creating the nodes represented by the first object according to the parameters of the nodes represented by the first object; extracting the names of the input nodes of the nodes represented by the first object according to the structural key value pairs, and adding the names of the input nodes for the nodes represented by the first object;
And the attribute adding module is used for extracting the attribute of the node represented by the first object according to the node attribute key value pair of the first object and adding the attribute for the node represented by the first object.
8. A device for configuring a computational graph of a neural network, comprising:
A processor;
a memory for storing processor-executable instructions;
Wherein the processor is configured to implement the method of any one of claims 1 to 6 when executing executable instructions.
9. A non-transitory computer readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the method of any of claims 1 to 6.
CN202011570158.4A 2019-05-31 2019-05-31 Operation method, device and related product Active CN112668707B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011570158.4A CN112668707B (en) 2019-05-31 2019-05-31 Operation method, device and related product

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011570158.4A CN112668707B (en) 2019-05-31 2019-05-31 Operation method, device and related product
CN201910472738.0A CN110188871B (en) 2019-05-31 2019-05-31 Operation method, device and related product

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201910472738.0A Division CN110188871B (en) 2019-05-31 2019-05-31 Operation method, device and related product

Publications (2)

Publication Number Publication Date
CN112668707A CN112668707A (en) 2021-04-16
CN112668707B true CN112668707B (en) 2024-05-17

Family

ID=67719726

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202011570158.4A Active CN112668707B (en) 2019-05-31 2019-05-31 Operation method, device and related product
CN201910472738.0A Active CN110188871B (en) 2019-05-31 2019-05-31 Operation method, device and related product

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN201910472738.0A Active CN110188871B (en) 2019-05-31 2019-05-31 Operation method, device and related product

Country Status (1)

Country Link
CN (2) CN112668707B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11729222B2 (en) * 2019-07-12 2023-08-15 Palo Alto Research Center Incorporated System and method for extracting configuration-related information for reasoning about the security and functionality of a composed internet of things system
CN113835990B (en) * 2020-06-23 2024-01-30 中科寒武纪科技股份有限公司 Detection method, detection device, computer equipment and storage medium
US11930046B2 (en) 2021-06-17 2024-03-12 Xerox Corporation System and method for determining vulnerability metrics for graph-based configuration security
CN114997392B (en) * 2022-08-03 2022-10-21 成都图影视讯科技有限公司 Architecture and architectural methods for neural network computing

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108292374A (en) * 2015-11-09 2018-07-17 谷歌有限责任公司 Training is expressed as the neural network of calculating figure
CN108768742A (en) * 2018-06-06 2018-11-06 北京京东金融科技控股有限公司 Network establishing method and device, electronic equipment, storage medium
CN108985448A (en) * 2018-06-06 2018-12-11 北京大学 Neural Networks Representation standard card cage structure
CN109670586A (en) * 2018-12-29 2019-04-23 北京中科寒武纪科技有限公司 Operation method, device and Related product

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10970787B2 (en) * 2015-10-28 2021-04-06 Qomplx, Inc. Platform for live issuance and management of cyber insurance policies
JP6983154B2 (en) * 2015-10-28 2021-12-17 グーグル エルエルシーGoogle LLC Processing graphs
US11055451B2 (en) * 2015-10-28 2021-07-06 Qomplx, Inc. System and methods for multi-language abstract model creation for digital environment simulations
CN108304177A (en) * 2017-01-13 2018-07-20 辉达公司 Calculate the execution of figure
CN109284815B (en) * 2018-11-30 2020-11-24 安徽寒武纪信息科技有限公司 Neural network model algorithm compiling method and device and related products
CN110162337B (en) * 2019-05-31 2020-07-03 中科寒武纪科技股份有限公司 Operation method, device and related product

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108292374A (en) * 2015-11-09 2018-07-17 谷歌有限责任公司 Training is expressed as the neural network of calculating figure
CN108768742A (en) * 2018-06-06 2018-11-06 北京京东金融科技控股有限公司 Network establishing method and device, electronic equipment, storage medium
CN108985448A (en) * 2018-06-06 2018-12-11 北京大学 Neural Networks Representation standard card cage structure
CN109670586A (en) * 2018-12-29 2019-04-23 北京中科寒武纪科技有限公司 Operation method, device and Related product

Also Published As

Publication number Publication date
CN110188871B (en) 2021-01-26
CN112668707A (en) 2021-04-16
CN110188871A (en) 2019-08-30

Similar Documents

Publication Publication Date Title
CN112668707B (en) Operation method, device and related product
CN110909815B (en) Neural network training method, neural network training device, neural network processing device, neural network training device, image processing device and electronic equipment
CN110598504B (en) Image recognition method and device, electronic equipment and storage medium
CN109919300B (en) Neural network training method and device and image processing method and device
CN111581488B (en) Data processing method and device, electronic equipment and storage medium
CN109165738B (en) Neural network model optimization method and device, electronic device and storage medium
KR20210114511A (en) Face image recognition method and apparatus, electronic device and storage medium
US20210312289A1 (en) Data processing method and apparatus, and storage medium
CN111259967B (en) Image classification and neural network training method, device, equipment and storage medium
CN109934240B (en) Feature updating method and device, electronic equipment and storage medium
CN110188865B (en) Information processing method and device, electronic equipment and storage medium
CN111582383B (en) Attribute identification method and device, electronic equipment and storage medium
CN111242303A (en) Network training method and device, and image processing method and device
CN109447258B (en) Neural network model optimization method and device, electronic device and storage medium
CN110633715A (en) Image processing method, network training method and device and electronic equipment
CN112559673A (en) Language processing model training method and device, electronic equipment and storage medium
CN110163372B (en) Operation method, device and related product
CN110188879B (en) Operation method, device and related product
EP3825894A1 (en) Method, device and terminal for performing word segmentation on text information, and storage medium
CN111694571B (en) Compiling method and device
CN115512116B (en) Image segmentation model optimization method and device, electronic equipment and readable storage medium
CN111046780A (en) Neural network training and image recognition method, device, equipment and storage medium
WO2023097952A1 (en) Pre-trained model publishing method and apparatus, electronic device, storage medium, and computer program product
CN112070221B (en) Operation method, device and related product
CN110162337B (en) Operation method, device and related product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant