WO2023051236A1 - 一种偏微分方程求解方法及其相关设备 - Google Patents

一种偏微分方程求解方法及其相关设备 Download PDF

Info

Publication number
WO2023051236A1
WO2023051236A1 PCT/CN2022/118577 CN2022118577W WO2023051236A1 WO 2023051236 A1 WO2023051236 A1 WO 2023051236A1 CN 2022118577 W CN2022118577 W CN 2022118577W WO 2023051236 A1 WO2023051236 A1 WO 2023051236A1
Authority
WO
WIPO (PCT)
Prior art keywords
partial differential
differential equation
output value
value
input value
Prior art date
Application number
PCT/CN2022/118577
Other languages
English (en)
French (fr)
Inventor
林国昌
史作强
陈俊清
陈祥
Original Assignee
华为技术有限公司
清华大学
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 华为技术有限公司, 清华大学 filed Critical 华为技术有限公司
Publication of WO2023051236A1 publication Critical patent/WO2023051236A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • G06F17/13Differential equations
    • 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
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E60/00Enabling technologies; Technologies with a potential or indirect contribution to GHG emissions mitigation

Definitions

  • This application relates to the technical field of artificial intelligence (AI), in particular to a method for solving partial differential equations and related equipment.
  • AI artificial intelligence
  • a partial differential equation (partial differential equation, PDE) is an equation that contains multiple unknown functions and their partial derivatives. Partial differential equations can be applied in many fields, for example, electromagnetism, thermodynamics, fluid mechanics, structural mechanics, etc. Therefore, in the fields of electromagnetic simulation, thermal simulation, fluid simulation, etc., it depends on the solution of partial differential equations.
  • neural networks are used to solve partial differential equations due to their general representation and automatic differentiation capabilities.
  • the neural network can be used to represent the solution of the partial differential equation to be solved, and for a certain input value to be solved, the input value can be input into the neural network, so that the neural network can perform a series of operations on the input value, Thus, the corresponding output value is obtained, then, the output value can be used as the solution of the partial differential equation.
  • the embodiment of the present application provides a method for solving partial differential equations and related equipment.
  • a neural network is used to represent the boundary density function of the partial differential equation. Therefore, after processing the input values through the neural network, a solution with a certain degree of accuracy can be obtained.
  • the first aspect of the embodiments of the present application provides a method for solving partial differential equations, the method comprising:
  • the partial differential equation used to describe the target task can be obtained. Subsequently, the first input value is collected in the region to be solved of the partial differential equation, and N second input values are collected on the boundary of the region to be solved of the partial differential equation, where N is an integer greater than or equal to 1.
  • the solution of the partial differential equation can be expressed in the form of boundary integral. Since the expression of the boundary integral contains the basic solution of the partial differential equation and the boundary density function of the partial differential equation, the objective neural network (already The trained neural network model) represents the boundary density function of the partial differential equation, so as to process the i-th second input value through the target neural network to obtain the i-th second output value. It should be noted that, except for the i-th second input value, other second input values can also be processed as the i-th second input value, so N second output values can be obtained.
  • N first output values and N second output values can be calculated to obtain a third output value, which can be regarded as a solution corresponding to the first input value in the partial differential equation.
  • the boundary density function of the partial differential equation is relatively simple, and the neural network used to represent the boundary density function of the partial differential equation can output an intermediate output with sufficient accuracy after processing the input values Based on the intermediate output value, the final output value (based on the principle of boundary integral calculation) can be accurately determined as the solution corresponding to the input value in the partial differential equation.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: directly combining the first input value and the i-th The i second input value is substituted into the basic solution of the partial differential equation to obtain the i first output value.
  • the integrand in the boundary integral expression is the product of the basic solution of the partial differential equation and the boundary density function of the partial differential equation
  • the first input value and the i-th second The input value is substituted into the basic solution of the partial differential equation to obtain the i-th first output value. In this way, N first output values can be obtained.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: treating the basic solution of the partial differential equation Solving the derivative of the external normal vector of the boundary of the region to obtain the target derivative; substituting the first input value and the i-th second input value into the target derivative to obtain the i-th first output value.
  • the target derivative is the outer method of the boundary of the area to be solved for the basic solution of the partial differential equation
  • the basic solution of the partial differential equation can first be derived from the external normal vector of the boundary of the area to be solved to obtain the target derivative, and then the first input value and the i-th second input value can be substituted into the target Derivative, get the i-th first output value. In this way, N first output values can be obtained.
  • obtaining the third output value includes: multiplying the i-th first output value by the i-th second output value processing to obtain the i-th fourth output value; performing weighted sum processing on the N fourth output values to obtain the third output value.
  • the ith first output value can be multiplied by the i-th second output value to obtain the i-th fourth output value output value.
  • the rest of the first output values except the ith first output value and the rest of the second output values except the ith second output value can also be performed as the ith first output value and the ith first output value Two output values are processed, so N fourth output values can be obtained. Then, the N fourth output values may be weighted and summed to obtain a third output value.
  • the method before acquiring the first input value and N second input values of the partial differential equation, the method further includes: acquiring parameters of the target task to be processed; constructing a partial differential equation describing the target task according to the parameters Areas to be solved for differential equations, partial differential equations, and boundary conditions for partial differential equations, where the area to be solved for partial differential equations can be either an open boundary area (infinite area) or a non-open boundary area (finite area).
  • processing the i-th second input value through the target neural network to obtain the i-th second output value includes: processing the i-th second input value and parameters through the target neural network , to get the i-th second output value.
  • the parameters of the target task can be used to mark the task itself. Then, if the target neural network needs to be used to solve a certain target task, the input value and the parameters of the target task can be input into the target neural network to obtain the corresponding output value. Similarly, if the target neural network needs to be used to solve another target task, the input value and the parameters of the target task can be input into the target neural network, and the corresponding output value can also be obtained. It can be seen that the target neural network can be used to solve partial differential equations describing different target tasks.
  • the value is obtained by substituting the first input value into the boundary condition of the partial differential equation; the parameters of the model to be trained are updated according to the target
  • the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation, it can be represented by the model to be trained Boundary density functions for partial differential equations, and train on them.
  • the first input value and the second input value can be processed according to the basic solution of the partial differential equation to obtain the first output value .
  • the second input value is processed by the model to be trained to obtain a second output value.
  • a third output value is obtained.
  • the target loss is obtained, the target loss is used to indicate the difference between the third output value and the fifth output value, and the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the parameters of the model to be trained are updated according to the target loss until the model training conditions are met, and the target neural network is obtained.
  • the model to be trained represents the boundary density function of the partial differential equation, which is a part of the boundary product expression of the solution of the partial differential equation
  • the second input value used to train the model to be trained is acquired (training data)
  • it is only necessary to collect the second input value on the boundary of the region to be solved whether the region is a finite region or an infinite region). In this way, even with a limited amount of training data collected, the data adequately characterizes the entire region to be solved.
  • the target neural network trained based on these data can output an intermediate output value with sufficient accuracy after processing any input value in the area to be solved of the partial differential equation, and the final output can be accurately determined based on the intermediate output value value (based on the principle of boundary integral calculation), as the solution in the partial differential equation corresponding to this input value.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: combining the first input value and the i-th The second input value is substituted into the basic solution of the partial differential equation to obtain the i-th first output value.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: treating the basic solution of the partial differential equation Solving the derivative of the external normal vector of the boundary of the region to obtain the target derivative; substituting the first input value and the i-th second input value into the target derivative to obtain the i-th first output value.
  • obtaining the third output value includes: multiplying the i-th first output value by the i-th second output value processing to obtain the i-th fourth output value; performing weighted sum processing on the N fourth output values to obtain the third output value.
  • the method before obtaining the first input value and N second input values of the partial differential equation, the method further includes: obtaining parameters of the target task to be processed; constructing a partial differential equation, a partial differential equation according to the parameters The area to be solved and the boundary conditions of partial differential equations.
  • processing the i-th second input value through the model to be trained to obtain the i-th second output value includes: processing the i-th second input value and parameters through the model to be trained , to get the i-th second output value.
  • the parameters of different target tasks can be learned by the model to be trained, so that the trained target neural network can be used for different target tasks in the same field in the actual application process. (simulation task) processing, in this way, not only the efficiency of model training can be improved, but also the target neural network can be equipped with the ability to process different tasks, that is, the ability to solve different partial differential equations.
  • the boundary density function of the partial differential equation is relatively simple, and the neural network used to represent the boundary density function of the partial differential equation can output an intermediate output with sufficient accuracy after processing the input values Based on the intermediate output value, the final output value (based on the principle of boundary integral calculation) can be accurately determined as the solution corresponding to the input value in the partial differential equation.
  • the first processing module is configured to substitute the first input value and the i-th second input value into the basic solution of the partial differential equation to obtain the i-th first output value.
  • the first processing module is configured to: derive the basic solution of the partial differential equation from the external normal vector of the boundary of the area to be solved to obtain the target derivative; combine the first input value and the i-th The second input value is substituted into the target derivative to obtain the i-th first output value.
  • the second acquisition module is configured to: multiply the i-th first output value with the i-th second output value to obtain the i-th fourth output value;
  • the fourth output value is subjected to weighted sum processing to obtain the third output value.
  • the device also includes: a third acquisition module, configured to acquire parameters of the target task to be processed; a construction module, configured to construct a partial differential equation, a region to be solved for the partial differential equation, and Boundary conditions for partial differential equations.
  • the second processing module is configured to process the i-th second input value and parameters through the target neural network to obtain the i-th second output value.
  • the model to be trained Represent the boundary density function for a partial differential equation and train it.
  • the first input value and the second input value of the partial differential equation can be processed according to the basic solution of the partial differential equation to obtain the first output value .
  • the second input value is processed by the model to be trained to obtain a second output value.
  • a third output value is obtained.
  • the target loss is obtained, the target loss is used to indicate the difference between the third output value and the fifth output value, and the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the parameters of the model to be trained are updated according to the target loss until the model training conditions are met, and the target neural network is obtained.
  • the model to be trained represents the boundary density function of the partial differential equation, which is a part of the boundary product expression of the solution of the partial differential equation
  • the second input value used to train the model to be trained is acquired (training data)
  • it is only necessary to collect the second input value on the boundary of the region to be solved whether the region is a finite region or an infinite region). In this way, even with a limited amount of training data collected, the data adequately characterizes the entire region to be solved.
  • the target neural network trained based on these data can output an intermediate output value with sufficient accuracy after processing any input value in the area to be solved of the partial differential equation, and the final output can be accurately determined based on the intermediate output value value (based on the principle of boundary integral calculation), as the solution in the partial differential equation corresponding to this input value.
  • the first processing module is configured to substitute the first input value and the i-th second input value into the basic solution of the partial differential equation to obtain the i-th first output value.
  • the first processing module is configured to: derive the basic solution of the partial differential equation from the external normal vector of the boundary of the area to be solved to obtain the target derivative; combine the first input value and the i-th The second input value is substituted into the target derivative to obtain the i-th first output value.
  • the second acquisition module is configured to: multiply the i-th first output value with the i-th second output value to obtain the i-th fourth output value;
  • the fourth output value is subjected to weighted sum processing to obtain the third output value.
  • the device also includes: a fourth acquisition module, configured to acquire parameters of the target task to be processed; a construction module, configured to construct a partial differential equation, a region to be solved for the partial differential equation, and Boundary conditions for partial differential equations.
  • the second processing module is configured to process the i-th second input value and parameters through the model to be trained to obtain the i-th second output value.
  • the fifth aspect of the embodiment of the present application provides a device for solving partial differential equations, the device includes a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the device for solving partial differential equations Execute the method described in the first aspect or any possible implementation manner of the first aspect.
  • the sixth aspect of the embodiment of the present application provides a model training device, which includes a memory and a processor; the memory stores codes, the processor is configured to execute the codes, and when the codes are executed, the model training device executes as the second Aspect or the method described in any possible implementation manner of the second aspect.
  • a seventh aspect of the embodiments of the present application provides a circuit system, the circuit system includes a processing circuit, and the processing circuit is configured to perform the first aspect, any possible implementation manner in the first aspect, the second aspect, or the first aspect. The method described in any one possible implementation manner of the two aspects.
  • the eighth aspect of the embodiments of the present application provides a chip system, the chip system includes a processor, used to call the computer program or computer instruction stored in the memory, so that the processor executes the first aspect, the first aspect Any possible implementation manner, the second aspect, or the method described in any possible implementation manner in the second aspect.
  • the processor is coupled to the memory through an interface.
  • the chip system further includes a memory, where computer programs or computer instructions are stored.
  • the ninth aspect of the embodiments of the present application provides a computer storage medium, the computer storage medium stores a computer program, and when the program is executed by a computer, the computer implements any one of the possible methods of the first aspect and the first aspect. Implementation, the second aspect, or the method described in any possible implementation of the second aspect.
  • the tenth aspect of the embodiments of the present application provides a computer program product, the computer program product stores instructions, and when the instructions are executed by a computer, the computer implements any one of the possible implementations of the first aspect and the first aspect manner, the second aspect, or the method described in any one possible implementation manner of the second aspect.
  • the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation, it can be represented by the model to be trained Boundary density functions for partial differential equations, and train on them.
  • the first input value and the second input value can be processed according to the basic solution of the partial differential equation to obtain the first output value .
  • the second input value is processed by the model to be trained to obtain a second output value.
  • a third output value is obtained.
  • the target loss is obtained, the target loss is used to indicate the difference between the third output value and the fifth output value, and the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the parameters of the model to be trained are updated according to the target loss until the model training conditions are met, and the target neural network is obtained.
  • the model to be trained represents the boundary density function of the partial differential equation, which is a part of the boundary product expression of the solution of the partial differential equation
  • the second input value used to train the model to be trained is acquired (training data)
  • it is only necessary to collect the second input value on the boundary of the region to be solved whether the region is a finite region or an infinite region). In this way, even with a limited amount of training data collected, the data adequately characterizes the entire region to be solved.
  • the target neural network trained based on these data can output an intermediate output value with sufficient accuracy after processing any input value in the area to be solved of the partial differential equation, and the final output can be accurately determined based on the intermediate output value value (based on the principle of boundary integral calculation), as the solution in the partial differential equation corresponding to this input value.
  • Fig. 1 is a kind of structural schematic diagram of main frame of artificial intelligence
  • Fig. 2 a is a schematic structural diagram of the partial differential equation solving system provided by the embodiment of the present application.
  • Fig. 2b is another structural schematic diagram of the partial differential equation solving system provided by the embodiment of the present application.
  • Figure 2c is a schematic diagram of related equipment for solving partial differential equations provided by the embodiment of the present application.
  • FIG. 3 is a schematic diagram of the architecture of the system 100 provided by the embodiment of the present application.
  • Fig. 4 is a schematic flow chart of the model training method provided by the embodiment of the present application.
  • Fig. 5 is a schematic diagram of the result comparison provided by the embodiment of the present application.
  • Fig. 6 is a schematic flow chart of the partial differential equation solution method provided by the embodiment of the present application.
  • FIG. 7 is another schematic flowchart of the model training method provided by the embodiment of the present application.
  • Fig. 8 is a schematic diagram of the experimental results provided by the embodiment of the present application.
  • FIG. 9 is another schematic flowchart of the method for solving partial differential equations provided in the embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a device for solving partial differential equations provided in an embodiment of the present application.
  • Fig. 11 is a schematic structural diagram of the model training device provided by the embodiment of the present application.
  • Fig. 12 is a schematic structural diagram of the execution device provided by the embodiment of the present application.
  • Fig. 13 is a schematic structural diagram of the training equipment provided by the embodiment of the present application.
  • FIG. 14 is a schematic structural diagram of a chip provided by an embodiment of the present application.
  • the embodiment of the present application provides a method for solving partial differential equations and related equipment.
  • a neural network is used to represent the boundary density function of the partial differential equation. Therefore, after processing the input values through the neural network, a solution with a certain degree of accuracy can be obtained.
  • a partial differential equation is an equation described by a function with multiple unknowns and its partial derivatives. Partial differential equations can be applied in many fields, for example, electromagnetism, thermodynamics, fluid mechanics, structural mechanics, etc. Therefore, simulation tasks in various fields such as electromagnetic simulation, thermal simulation, and fluid simulation rely on the solution of partial differential equations. Specifically, technical issues such as mobile phone antenna design, chip circuit design, base station antenna design, semiconductor process and device design, workpiece thermal design, and automobile shape design all rely on the solution of partial differential equations.
  • the neural network can be used to represent the solution of the partial differential equation to be solved, and the numerical solution can be realized automatically.
  • the input value can be input into the neural network, so that the neural network can perform a series of operations on the input value, so as to obtain the corresponding output value, then, the output value can be as a solution to a partial differential equation.
  • the training process of the neural network used to represent the solution of the partial differential equation if the area to be solved of the partial differential equation is an open boundary area (that is, an infinite area), the collection efficiency of training data is very low, that is, it is impossible to use a limited number of The training data is used to represent the entire area to be solved, which leads to the inaccurate output of the trained neural network in the actual application process.
  • an embodiment of the present application provides a method for solving a partial differential equation, which can be implemented in combination with artificial intelligence (AI) technology.
  • AI technology is a technical discipline that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence. AI technology obtains the best results by perceiving the environment, acquiring knowledge and using knowledge.
  • artificial intelligence technology is a branch of computer science that attempts to understand the nature of intelligence and produce a new kind of intelligent machine that can respond in a similar way to human intelligence.
  • Using artificial intelligence to solve partial differential equations is a common application of artificial intelligence.
  • Figure 1 is a schematic structural diagram of the main framework of artificial intelligence, from the “intelligent information chain” (horizontal axis) and “IT value chain” (vertical axis)
  • the "intelligent information chain” reflects a series of processes from data acquisition to processing.
  • it can be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output.
  • the data has undergone a condensed process of "data-information-knowledge-wisdom”.
  • IT value chain reflects the value brought by artificial intelligence to the information technology industry from the underlying infrastructure of artificial intelligence, information (provided and processed by technology) to the systematic industrial ecological process.
  • the infrastructure provides computing power support for the artificial intelligence system, realizes communication with the outside world, and realizes support through the basic platform.
  • the basic platform includes distributed computing framework and network and other related platform guarantees and supports, which can include cloud storage and Computing, interconnection network, etc.
  • sensors communicate with the outside to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
  • Data from the upper layer of the infrastructure is used to represent data sources in the field of artificial intelligence.
  • the data involves graphics, images, voice, text, and IoT data of traditional equipment, including business data of existing systems and sensory data such as force, position, liquid level, temperature, and humidity.
  • Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
  • machine learning and deep learning can symbolize and formalize intelligent information modeling, extraction, preprocessing, training, etc. of data.
  • Reasoning refers to the process of simulating human intelligent reasoning in a computer or intelligent system, and using formalized information to carry out machine thinking and solve problems according to reasoning control strategies.
  • the typical functions are search and matching.
  • Decision-making refers to the process of decision-making after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
  • some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, such as translation, text analysis, computer vision processing, speech recognition, image processing identification, processing of simulation tasks (i.e. solution of partial differential equations) and so on.
  • Intelligent products and industry applications refer to the products and applications of artificial intelligence systems in various fields. It is the packaging of the overall solution of artificial intelligence, which commercializes intelligent information decision-making and realizes landing applications. Its application fields mainly include: intelligent terminals, intelligent transportation, Smart healthcare, autonomous driving, smart cities, etc.
  • Fig. 2a is a schematic structural diagram of a system for solving partial differential equations provided by an embodiment of the present application.
  • the system for solving partial differential equations includes user equipment and data processing equipment.
  • the user equipment includes smart terminals such as a mobile phone, a personal computer, or an information processing center.
  • the user equipment is the initiator of the solution of the partial differential equation, and as the initiator of the simulation task processing request (also referred to as the request for the solution of the partial differential equation), usually the user initiates the request through the user equipment.
  • the above-mentioned data processing device may be a device or server having a data processing function such as a cloud server, a network server, an application server, and a management server.
  • the data processing device receives the simulation task processing request from the intelligent terminal through the interactive interface, and then solves partial differential equations in machine learning, deep learning, search, reasoning, decision-making, etc. through the memory for storing data and the processor for data processing.
  • the storage in the data processing device may be a general term, including local storage and a database storing historical data, and the database may be on the data processing device or on other network servers.
  • the user equipment can receive user instructions, for example, the user equipment can obtain the parameters of the simulation task input/selected by the user, and then initiate a request to the data processing equipment, so that the data processing equipment can target the user
  • the parameters of the simulation task obtained by the device are solved by partial differential equations, so as to obtain the processing result of the simulation task.
  • the user equipment may acquire the parameters of a simulation task input by the user, and then initiate a simulation task processing request to the data processing device, so that the data processing device constructs a corresponding partial differential equation according to the parameters of the simulation task, and the equation Perform analysis to obtain the solution of the equation, that is, the processing result of the simulation task.
  • the data processing device may execute the partial differential equation solving method of the embodiment of the present application.
  • Fig. 2b is another structural schematic diagram of the partial differential equation solving system provided by the embodiment of the present application.
  • the user equipment is directly used as a data processing equipment, and the user equipment can directly obtain the input from the user and be directly processed by the user equipment itself.
  • the hardware performs processing, and the specific process is similar to that shown in FIG. 2a . Reference may be made to the above description, and details will not be repeated here.
  • the user equipment can receive user instructions, for example, the user equipment can obtain the parameters of a simulation task selected by the user in the user equipment, and then the user equipment itself can perform the simulation task The parameters of the task are solved by partial differential equations, so as to obtain the processing results for the simulation task.
  • the user equipment itself can execute the partial differential equation solving method of the embodiment of the present application.
  • Fig. 2c is a schematic diagram of related equipment for solving partial differential equations provided in the embodiment of the present application.
  • the above-mentioned user equipment in FIG. 2a and FIG. 2b may specifically be the local device 301 or the local device 302 in FIG. 2c, and the data processing device in FIG. 2a may specifically be the execution device 210 in FIG.
  • the data storage system 250 may be integrated on the execution device 210, or set on the cloud or other network servers.
  • the processors in Figure 2a and Figure 2b can perform data training/machine learning/deep learning through a neural network model or other models (for example, a model based on a support vector machine), and use the data to finally train or learn the model for image execution Partial differential equations are solved to obtain corresponding processing results.
  • a neural network model or other models for example, a model based on a support vector machine
  • FIG. 3 is a schematic diagram of the architecture of the system 100 provided by the embodiment of the present application.
  • the execution device 110 is configured with an input/output (input/output, I/O) interface 112 for data interaction with external devices, and the user Data can be input to the I/O interface 112 through the client device 140, and the input data in this embodiment of the application may include: various tasks to be scheduled, callable resources, and other parameters.
  • I/O input/output
  • the execution device 110 When the execution device 110 preprocesses the input data, or when the calculation module 111 of the execution device 110 executes calculations and other related processing (such as implementing the function of the neural network in this application), the execution device 110 can call the data storage system 150
  • the data, codes, etc. in the system can be used for corresponding processing, and the data, instructions, etc. obtained by corresponding processing can also be stored in the data storage system 150 .
  • the I/O interface 112 returns the processing result to the client device 140, thereby providing it to the user.
  • the training device 120 can generate corresponding target neural networks/rules based on different training data for different goals or different tasks, and the corresponding target neural networks/rules can be used to achieve the above-mentioned goals or complete above tasks, thereby providing the desired result to the user.
  • the training data may be stored in the database 130 and come from training samples collected by the data collection device 160 .
  • the user can manually specify the input data, and the manual specification can be operated through the interface provided by the I/O interface 112 .
  • the client device 140 can automatically send the input data to the I/O interface 112 . If the client device 140 is required to automatically send the input data to obtain the user's authorization, the user can set the corresponding authority in the client device 140 .
  • the user can view the results output by the execution device 110 on the client device 140, and the specific presentation form may be specific ways such as display, sound, and action.
  • the client device 140 can also be used as a data collection terminal, collecting the input data input to the I/O interface 112 as shown in the figure and the output results of the output I/O interface 112 as new sample data, and storing them in the database 130 .
  • the client device 140 may not be used for collection, but the I/O interface 112 directly uses the input data input to the I/O interface 112 as shown in the figure and the output result of the output I/O interface 112 as a new sample.
  • the data is stored in database 130 .
  • FIG. 3 is only a schematic diagram of a system architecture provided by the embodiment of the present application, and the positional relationship between devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data The storage system 150 is an external memory relative to the execution device 110 , and in other cases, the data storage system 150 may also be placed in the execution device 110 .
  • the neural network can be obtained by training according to the training device 120 .
  • An embodiment of the present application also provides a chip, the chip includes a neural network processor (NPU).
  • the chip can be set in the execution device 110 shown in FIG. 3 to complete the computing work of the computing module 111 .
  • the chip can also be set in the training device 120 shown in FIG. 3 to complete the training work of the training device 120 and output the target neural network/rules.
  • the neural network processor NPU is mounted on the main central processing unit (central processing unit, CPU) (host CPU) as a coprocessor, and the main CPU assigns tasks.
  • the core part of the NPU is the operation circuit, and the controller controls the operation circuit to extract the data in the memory (weight memory or input memory) and perform operations.
  • the operation circuit includes multiple processing units (process engine, PE).
  • the arithmetic circuit is a two-dimensional systolic array.
  • the arithmetic circuit may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition.
  • the arithmetic circuit is a general purpose matrix processor.
  • the operation circuit fetches the data corresponding to the matrix B from the weight memory, and caches it on each PE in the operation circuit.
  • the operation circuit takes the data of matrix A from the input memory and performs matrix operation with matrix B, and the obtained partial or final results of the matrix are stored in the accumulator.
  • the vector calculation unit can further process the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison and so on.
  • the vector computing unit can be used for network calculations of non-convolution/non-FC layers in neural networks, such as pooling, batch normalization, local response normalization, etc.
  • the vector computation unit can store the processed output vectors to a unified register.
  • a vector computation unit may apply a non-linear function to the output of the arithmetic circuit, such as a vector of accumulated values, to generate activation values.
  • the vector computation unit generates normalized values, merged values, or both.
  • the vector of processed outputs can be used as an activation input to an operational circuit, for example for use in a subsequent layer in a neural network.
  • Unified memory is used to store input data and output data.
  • the weight data directly transfers the input data in the external memory to the input memory and/or the unified memory through the storage unit access controller (direct memory access controller, DMAC), stores the weight data in the external memory into the weight memory, and stores the weight data in the unified memory Store the data in the external memory.
  • DMAC direct memory access controller
  • bus interface unit (bus interface unit, BIU) is used to realize the interaction between the main CPU, DMAC and instruction fetch memory through the bus.
  • the instruction fetch buffer connected to the controller is used to store the instructions used by the controller
  • the controller is used for invoking instructions cached in the memory to control the working process of the computing accelerator.
  • the unified memory, the input memory, the weight memory and the instruction fetch memory are all on-chip (On-Chip) memory
  • the external memory is the memory outside the NPU
  • the external memory can be a double data rate synchronous dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM), high bandwidth memory (high bandwidth memory, HBM) or other readable and writable memory.
  • the neural network can be composed of neural units, and the neural unit can refer to an operation unit that takes xs and intercept 1 as input, and the output of the operation unit can be:
  • Ws is the weight of xs
  • b is the bias of the neuron unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal. The output signal of this activation function can be used as the input of the next convolutional layer.
  • the activation function may be a sigmoid function.
  • a neural network is a network formed by connecting many of the above-mentioned single neural units, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected with the local receptive field of the previous layer to extract the features of the local receptive field.
  • the local receptive field can be an area composed of several neural units.
  • W is a weight vector, and each value in the vector represents the weight value of a neuron in this layer of neural network.
  • the vector W determines the space transformation from the input space to the output space described above, that is, the weight W of each layer controls how to transform the space.
  • the purpose of training the neural network is to finally obtain the weight matrix of all layers of the trained neural network (the weight matrix formed by the vector W of many layers). Therefore, the training process of the neural network is essentially to learn the way to control the spatial transformation, and more specifically, to learn the weight matrix.
  • the neural network can use the error back propagation (back propagation, BP) algorithm to correct the size of the parameters in the initial neural network model during the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, passing the input signal forward until the output will generate an error loss, and updating the parameters in the initial neural network model by backpropagating the error loss information, so that the error loss converges.
  • the backpropagation algorithm is a backpropagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
  • the model training method provided in the embodiment of the present application involves the processing of partial differential equations, and can be specifically applied to data processing methods such as data training, machine learning, and deep learning.
  • the first input value and the second input value perform symbolic and formalized intelligent information modeling, extraction, preprocessing, training, etc., and finally obtain a trained neural network (such as the target neural network in the embodiment of the present application);
  • the partial differential equation solving method provided in the embodiment of the present application can use the above-mentioned trained neural network to input data (such as the first input value and the second input value in the partial differential equation solving method provided in the embodiment of the present application) input into the trained neural network to obtain output data (such as the third output value, etc.
  • model training method and partial differential equation solution method provided in the embodiment of this application are inventions based on the same idea, and can also be understood as two parts in a system, or two stages in an overall process: Such as model training phase and model application phase.
  • the target neural network can only process simulation tasks in a certain field, or it can process multiple simulation tasks in a certain field, that is, the target neural network can have a single task It can also have a variety of task processing functions.
  • the following will be divided into two cases for description. First, the first case will be introduced, that is, the case where the target neural network has a single task processing function will be introduced, and the training of the target neural network in the first case will be described first. stages are described in detail.
  • Fig. 4 is a schematic flow chart of the model training method provided by the embodiment of the present application. As shown in Fig. 4, the method includes:
  • parameters of the target task can be obtained first.
  • the simulation task of the steady-state temperature distribution of a workpiece in the production environment, and the workpiece is a square part with uniform and isotropic material.
  • an external non-heat source object for example, liquid or other workpiece, etc.
  • the purpose of this simulation task is: in this state, obtain the distribution of temperature when the inside of the workpiece reaches a steady state.
  • the parameters of the simulation task can be obtained.
  • the parameters of the simulation task include the shape of the workpiece, the material of the workpiece, no heat source inside the workpiece, contact objects on the boundary of the workpiece, and so on.
  • the partial differential equation used to describe the target task, the area to be solved of the partial differential equation, and the boundary conditions of the partial differential equation can be constructed according to the parameters of the target task.
  • the simulation task is the temperature distribution inside the workpiece, so the simulation task can be described by the Laplace equation, which is expressed by the following formula:
  • x is the input value of the Laplace equation, representing a certain point in the workpiece
  • u(x) is the output value of the Laplace equation (it can also be called the solution corresponding to x in the equation)
  • u() can be understood as the temperature distribution inside the workpiece (also called the temperature distribution field)
  • boundary condition of the Laplace equation is the first type of boundary condition, namely:
  • g(x) is the boundary condition of Laplace equation; Indicates the boundary of the region to be solved. It can be seen that g(x) is an unsmooth function on the boundary of the region to be solved.
  • the processing of the target task is transformed into the solution of partial differential equations used to describe the target task.
  • the model to be trained in the related art is used to represent the entire partial differential equation.
  • problems in the model training process for example, low efficiency of training data collection, etc.), which leads to inaccurate solutions output by the trained model in the actual application process.
  • the partial differential equation can be deformed first, and then the model to be trained can be used to represent the deformed function, thereby improving the accuracy of the finally obtained solution.
  • the output value of the partial differential equation can be expressed in the form of boundary integral
  • the integrand of the boundary integral expression includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation.
  • G(x, y) is the basic solution of the Laplace equation
  • y is another input value of the Laplace equation, representing a certain point in the workpiece.
  • u(x) can be expressed as the boundary integral form of G(x, y):
  • h(y) is the boundary density function of Laplace equation
  • n y is The outer normal vector of
  • ds y means to perform area integration on y.
  • the model to be trained (that is, the neural network model to be trained) can be obtained.
  • the model can include multiple layers of fully connected layers, each layer includes 40 neurons, and uses the ReLU activation function.
  • the model to be trained is used to represent the boundary density function, and the model to be trained is trained to obtain the target neural network.
  • the target task may also be: a simulation task of electromagnetic field distribution of the receiving antenna.
  • the antenna has the shape of a butterfly and is a two-dimensional structure that can be realized on a printed circuit board.
  • the purpose of this task is therefore: to simulate the electromagnetic field distribution of a butterfly antenna in two dimensions.
  • This task can be described by the Helmholtz equation. Assuming that the task is carried out under the condition that the wave number is 12 and the boundary conditions are fixed, then the Helmholtz equation can be expressed by the following formula:
  • x is the input value of the Helmholtz equation, representing a certain point in the workpiece;
  • u(x) is the output value corresponding to x in the Helmholtz equation (also called the solution of the equation)
  • u() can be understood as the electromagnetic field distribution of the butterfly antenna in two-dimensional space;
  • g(x) is the boundary condition of the Helmholtz equation; Indicates the boundary of the area to be solved; is the Hankel function.
  • G(x, y) is the basic solution of the Helmholtz equation
  • y is another input value of the Helmholtz equation, representing a certain point in the remaining area outside the dish antenna.
  • u(x) can be expressed as the boundary integral form of G(x, y) (as shown in the above formula (5)), so the boundary density function h(y) of the Helmholtz equation can be obtained, here Let me repeat.
  • model to be trained includes a fully connected layer for schematic illustration, and the structure of the model to be trained is not limited.
  • the model to be trained may include a convolutional layer, a fusion layer, a fully connected layer, and Any one or any combination of pooling layers, etc.
  • a batch of training data can be collected in the area to be solved of the partial differential equation.
  • the batch of training data includes the first input value and N second input values of the partial differential equation, the first input value and the N second input values are located on the boundary of the area to be solved, and N ⁇ 1.
  • the first i-th input value can be calculated according to the basic solution of the partial differential equation
  • An input value and the i-th second input value are processed to obtain the i-th first output value.
  • the first input value and the i-th second input value may be processed in various ways, which will be introduced respectively below:
  • the first input value and the i-th second input value are directly substituted into the basic solution of the partial differential equation to obtain the i-th first output value.
  • x 0 and y i can be directly input into formula (4) to obtain G(x 0 , y i ).
  • the derivative of the basic solution of the partial differential equation is derived from the external normal vector of the boundary of the region to be solved to obtain the target derivative. Then, the first input value and the i-th second input value are substituted into the target derivative to obtain the i-th first output value. Still as in the above example, use G(x, y) to derivate in the n y direction, and the target derivative is obtained as Then, input x 0 and y i directly into get
  • N first output values can be obtained, that is, G(x 0 , y 1 ), G(x 0 , y 1 ), ..., G(x 0 , y N ) or
  • the i-th second input value After obtaining the first input value and N second input values, among the N second input values, for any second input value, that is, the i-th second input value, the i-th second input value can be input to the model to be trained, so that the ith second input value is processed by the model to be trained to obtain the ith second output value.
  • N second output values can be obtained, namely h(y 1 ), h(y 2 ), . . . , h(y N ).
  • the N first output values and the N second output values can be calculated, so as to obtain the third output value.
  • the i-th first output value can be multiplied by the i-th second output value to obtain the i-th fourth output value .
  • the rest of the first output values except the ith first output value and the rest of the second output values except the ith second output value can also be performed as the ith first output value and the ith first output value Two output values are processed, so N fourth output values can be obtained.
  • the N fourth output values may be weighted and summed to obtain a third output value.
  • ⁇ 1 ,..., ⁇ N or ⁇ 1 ,..., ⁇ N are all preset weight parameters, and the size of these parameters can be set according to actual needs.
  • the size of these parameters can be The parameters of the simulation task are determined according to the Laplace equation.
  • the target loss is used to indicate the difference between the third output value and the fifth output value
  • the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the first input value can be substituted into the boundary condition of the partial differential equation to obtain the fifth output value. Then, calculation is performed based on the third output value and the fifth output value to obtain a target loss, and the target loss is used to indicate the difference between the third output value and the fifth output value.
  • g(x 0 ) can be obtained. Then, calculation is performed according to u(x 0 ) and g(x 0 ), and (g(x 0 )-u(x 0 )) 2 is obtained. Therefore, the target loss can be constructed based on (g(x 0 )-u(x 0 )) 2 :
  • L is the target loss.
  • x 1 , ..., x M are also input values in the training data, please refer to the relevant description of x 0
  • the process of obtaining g(x 1 ), ..., g(x M ) can be Refer to the relevant description of obtaining g(x 0 ), the process of obtaining u( x 1 ), . . .
  • the parameters of the model to be trained can be updated according to the target loss, and the next batch of training data is used to train the model to be trained after the updated parameters (that is, re-execute steps 403 to 407) until the model training conditions are met (e.g., the target loss reaches convergence, etc.), and the target neural network is obtained.
  • the model training method provided by the embodiment of the present application can also be compared with the model training method of the related art, as shown in Figure 5 ( Figure 5 is a schematic diagram of the result comparison provided by the embodiment of the present application), where the leftmost is the real solution in the application phase, in the middle are the results output by the model trained in related technology 1 in the application phase and the results output by the model trained in related technology 2 in the application phase, and the far right is the one provided by the embodiment of this application The output result of the target neural network obtained by the method training in the application phase.
  • the relative error is calculated for the results of different methods, wherein the relative error of the method of related art 1 and the method of related art 2 is about 1.0% and 3.2%, but the relative error of the method of the embodiment of the present application is only about 0.17%, which is relatively large. improvement. Moreover, comparing the final results in Figure 5, it can be found that the method of the embodiment of the present application can effectively approximate the information showing the roughness at the position where the boundary condition at the boundary is not smooth, but the method of related art 1 and the method of related art 2 Limited by the representation method of the neural network, it fails to show the roughness at the boundary.
  • the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation, it can be represented by the model to be trained Boundary density functions for partial differential equations, and train on them.
  • the first input value and the second input value can be processed according to the basic solution of the partial differential equation to obtain the first output value .
  • the second input value is processed by the model to be trained to obtain a second output value.
  • a third output value is obtained.
  • the target loss is obtained, the target loss is used to indicate the difference between the third output value and the fifth output value, and the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the parameters of the model to be trained are updated according to the target loss until the model training conditions are met, and the target neural network is obtained.
  • the model to be trained represents the boundary density function of the partial differential equation, which is a part of the boundary product expression of the solution of the partial differential equation
  • the second input value used to train the model to be trained is acquired (training data)
  • it is only necessary to collect the second input value on the boundary of the region to be solved whether the region is a finite region or an infinite region). In this way, even with a limited amount of training data collected, the data adequately characterizes the entire region to be solved.
  • the target neural network trained based on these data can output an intermediate output value with sufficient accuracy after processing any input value in the area to be solved of the partial differential equation, and the final output can be accurately determined based on the intermediate output value value (based on the principle of boundary integral calculation), as the solution in the partial differential equation corresponding to this input value.
  • Fig. 6 is a schematic flow chart of the method for solving partial differential equations provided by the embodiment of the present application. As shown in Fig. 6, the method includes:
  • step 601 and step 602 For descriptions of step 601 and step 602, reference may be made to relevant descriptions of step 401 and step 402 in the foregoing embodiment in FIG. 4 , and details are not repeated here.
  • step 603 For the description of step 603, reference may be made to the related description of step 403 in the embodiment of FIG. 4 , and details are not repeated here.
  • the difference between step 603 in the application phase and step 403 in the training phase is that the first input value in step 603 is located in the region to be solved of the partial differential equation, which can be a point inside the region to be solved, or is a point on the boundary of the region to be solved, as in the above example, in the application stage of the target neural network, x 0 can be either a point on the boundary of the workpiece, or a point inside the workpiece.
  • the first input value in step 403 is located on the boundary of the region to be solved of the partial differential equation, which can only be a point on the boundary of the region to be solved, still as the above example, in the training stage of the target neural network, x0 is the value of the workpiece points on the border.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: combining the first input value and the i-th The second input value is substituted into the basic solution of the partial differential equation to obtain the i-th first output value.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: converting the basic solution of the partial differential equation Deriving the outer normal vector of the boundary of the area to be solved to obtain the target derivative; substituting the first input value and the i-th second input value into the target derivative to obtain the i-th first output value.
  • obtaining the third output value includes: multiplying the i-th first output value by the i-th second output value processing to obtain the i-th fourth output value; performing weighted sum processing on the N fourth output values to obtain the third output value.
  • steps 604 to 606 For descriptions of steps 604 to 606, reference may be made to relevant descriptions of steps 404 to 406 in the foregoing embodiment of FIG. 4 , and details are not repeated here.
  • the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation, it can be expressed by the target neural network Boundary density function for partial differential equations.
  • the boundary density function of the partial differential equation is relatively simple, and the neural network used to represent the boundary density function of the partial differential equation can output an intermediate output with sufficient accuracy after processing the input values Based on the intermediate output value, the final output value (based on the principle of boundary integral calculation) can be accurately determined as the solution corresponding to the input value in the partial differential equation.
  • Fig. 7 is another schematic flowchart of the model training method provided by the embodiment of the present application. As shown in Fig. 7, the method includes:
  • the parameters of each target task can be obtained first. For example, suppose it is necessary to deal with the simulation task of the steady-state temperature distribution of two workpieces in the production environment.
  • the first workpiece is an acute-angled triangular part
  • the second workpiece is a right-angled triangular part with uniform and isotropic materials.
  • There is no heat source inside the two workpieces a part of the boundary of the two workpieces is connected with an external non-heat source object (for example, liquid or other workpieces, etc.), and a part of the boundary is in contact with an external heat source.
  • the purpose of the first simulation task is: in this state, to obtain the temperature distribution inside the first workpiece when it reaches a steady state
  • the purpose of the second simulation task is: in this state In the state, obtain the distribution of the temperature when the interior of the second workpiece reaches a steady state.
  • the parameters of the two simulation tasks include the shape of the workpiece, the material of the workpiece, the absence of heat sources inside the workpiece, the contact objects at the boundary of the workpiece, and so on.
  • a partial differential equation for describing the target task For each target task, a partial differential equation for describing the target task, a region to be solved for the partial differential equation, and boundary conditions of the partial differential equation can be constructed according to the parameters of the target task.
  • a batch of training data can be collected. Specifically, for each partial differential equation, training data can be collected on the region to be solved of the partial differential equation, that is, the first input value and N second input values of the partial differential equation can be obtained, and the first input value and N A second input value is located on the boundary of the region to be solved of the partial differential equation, N ⁇ 1.
  • the first input value of the partial differential equation and the i-th second input value of the partial differential equation can be processed according to the basic solution of the partial differential equation to obtain the i-th first output value .
  • N first output values of each partial differential equation can be obtained.
  • the first input value of the partial differential equation and the ith second input value of the partial differential equation are substituted into the basic solution of the partial differential equation to obtain the The ith first output value of the partial differential equation.
  • N first output values of the partial differential equation can be obtained.
  • the basic solution of the partial differential equation is derived from the external normal vector of the boundary of the region to be solved of the partial differential equation to obtain the target derivative. Then, substituting the first input value of the partial differential equation and the i-th second input value of the partial differential equation into the target derivative to obtain the i-th first output value of the partial differential equation. In this way, N first output values of the partial differential equation can be obtained.
  • steps 702 to 704 For descriptions of steps 702 to 704, reference may be made to relevant descriptions of steps 402 to 404 in the foregoing embodiment in FIG. 4 , and details are not repeated here.
  • the integrand of the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation.
  • boundary density functions of multiple partial differential equations can be represented by the model to be trained and trained.
  • the parameters of the described target task are input to the model to be trained, so that the ith second input value and the parameters are processed by the model to be trained to obtain the ith second output value.
  • the N second input values of the partial differential equation describing the first target task be y′y′ 1 , y′ 2 , ..., y′ N
  • the N second input values of the differential equation are y′′y′′ 1 , y′′ 2 , . . . , y′′ N .
  • the parameters ⁇ 1 of y′ i and the first target task can be input to the training model, so that the model to be trained is paired with y′ 1 and ⁇ 1 to obtain h(y′ i ).
  • parameters ⁇ 2 of y′′ i and the second target task can be input to the training model, so that the model to be trained performs a series of operations on y′′ i and ⁇ 2 to obtain h(y′′ i ).
  • N second output values of each partial differential equation can be obtained, namely h(y′ 1 ), ..., h(y′ N ) and h(y′′ 1 ), ..., h (y′′ N ).
  • N first output values and N second output values of each partial differential equation are obtained, and the N first output values and N second output values of the partial differential equation can be calculated to obtain the partial differential equation The third output value.
  • the i-th first output value of the partial differential equation can be multiplied by the i-th second output value of the partial differential equation to obtain the The ith fourth output value of the partial differential equation. Then, the N fourth output values of the partial differential equation are weighted and summed to obtain the third output value of the partial differential equation.
  • the target loss is used to indicate the difference between the third output value and the fifth output value
  • the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the first input value of the partial differential equation can be substituted into the boundary condition of the partial differential equation, so as to obtain the fifth output value of the partial differential equation.
  • the parameters of the model to be trained can be updated according to the target loss, and the next batch of training data can be used to train the model to be trained after the updated parameters (that is, re-execute steps 703 to 707) until the model training conditions are met (e.g., the target loss reaches convergence, etc.), and the target neural network is obtained.
  • steps 706 to 708 For descriptions of steps 706 to 708, reference may be made to relevant descriptions of steps 406 to 408 in the foregoing embodiment in FIG. 4 , and details are not repeated here.
  • 100 simulation tasks can be constructed by selecting 100 triangles, and the model obtained based on the parameter training of 100 simulation tasks can be calculated, and the output in the application phase
  • the relative error of the result, experimental result as shown in Figure 8 (Fig. 8 is a schematic diagram of the experimental result that the embodiment of the present application provides), it can be seen that the relative error of the upper solution of about half of the triangles is less than 1%, and 98% of the triangles
  • the relative error is less than 4%, which shows that although the method provided by the embodiment of the present application cannot traverse all the triangles, it can have good results for different triangles in the training area, which reflects the strong representation ability and good performance of the neural network. generalization ability.
  • the model to be trained in the process of training the model to be trained, can be made to learn the parameters of different target tasks, so that the trained target neural network can be used for different targets in the same field in the actual application process.
  • the efficiency of model training can not only be improved, but also the target neural network can be equipped with the ability to process different tasks, that is, the ability to solve different partial differential equations.
  • Fig. 9 is another schematic flowchart of the partial differential equation solution method provided by the embodiment of the present application. As shown in Fig. 9, the method includes:
  • step 901 and step 902 For the description of step 901 and step 902, reference may be made to the related description of step 701 and step 702 in the foregoing embodiment in FIG. 7 , and details are not repeated here.
  • step 903 For the description of step 903, reference may be made to the related description of step 703 in the embodiment of FIG. It should be noted that the difference between step 903 in the application phase and step 703 in the training phase is that the first input value of each partial differential equation in step 903 is located in the area to be solved of the partial differential equation, which can be the area to be solved The internal points can also be the points on the boundary of the region to be solved. However, the first input value of each partial differential equation in step 703 is located on the boundary of the region to be solved of the partial differential equation, which can only be a point on the boundary of the region to be solved.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: combining the first input value and the i-th The second input value is substituted into the basic solution of the partial differential equation to obtain the i-th first output value.
  • processing the first input value and the i-th second input value according to the basic solution of the partial differential equation, and obtaining the i-th first output value includes: converting the basic solution of the partial differential equation Deriving the outer normal vector of the boundary of the area to be solved to obtain the target derivative; substituting the first input value and the i-th second input value into the target derivative to obtain the i-th first output value.
  • obtaining the third output value includes: multiplying the i-th first output value by the i-th second output value processing to obtain the i-th fourth output value; performing weighted sum processing on the N fourth output values to obtain the third output value.
  • steps 904 to 906 For descriptions of steps 904 to 906, reference may be made to relevant descriptions of steps 704 to 706 in the foregoing embodiment in FIG. 7 , and details are not repeated here.
  • the target neural network in the embodiment of the present application has the ability to process different tasks in the same field, that is, the ability to solve different partial differential equations.
  • FIG. 10 is a schematic structural diagram of a device for solving partial differential equations provided in an embodiment of the present application. As shown in Figure 10, the device includes:
  • the first acquisition module 1001 is used to acquire the first input value and N second input values of the partial differential equation, the first input value is located in the area to be solved of the partial differential equation, and the N second input values are located in the area to be solved On the boundary, N ⁇ 1, the partial differential equation is used to describe the target task to be processed;
  • the second processing module 1003 is configured to process the i-th second input value through the target neural network to obtain the i-th second output value;
  • the second acquiring module 1004 is configured to acquire a third output value according to the N first output values and the N second output values, and the third output value is used as a solution corresponding to the first input value in the partial differential equation.
  • the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation, it can be expressed by the target neural network Boundary density function for partial differential equations.
  • the boundary density function of the partial differential equation is relatively simple.
  • the neural network used to represent the boundary density function of the partial differential equation can output intermediate output values with sufficient accuracy after processing the input values. Based on the intermediate output value, the final output value (based on the principle of boundary integral calculation) can be accurately determined as the solution corresponding to the input value in the partial differential equation.
  • the first processing module 1002 is configured to substitute the first input value and the i-th second input value into the basic solution of the partial differential equation to obtain the i-th first output value.
  • the first processing module 1002 is configured to: derive the basic solution of the partial differential equation from the external normal vector of the boundary of the area to be solved to obtain the target derivative; combine the first input value and the ith The second input value is substituted into the target derivative to obtain the i-th first output value.
  • the second obtaining module 1004 is configured to: multiply the i-th first output value and the i-th second output value to obtain the i-th fourth output value;
  • the fourth output value is weighted and summed to obtain the third output value.
  • the device also includes: a third acquisition module, configured to acquire parameters of the target task to be processed; a construction module, configured to construct a partial differential equation, a region to be solved for the partial differential equation, and Boundary conditions for partial differential equations.
  • the second processing module 1003 is configured to process the i-th second input value and parameters through the target neural network to obtain the i-th second output value.
  • FIG. 11 is a schematic structural diagram of a model training device provided by an embodiment of the present application. As shown in Figure 11, the device includes:
  • the first acquisition module 1101 is used to acquire the first input value and N second input values of the partial differential equation, the first input value and the N second input values are located on the boundary of the area to be solved of the partial differential equation, N ⁇ 1. Partial differential equations are used to describe the target task to be processed;
  • the second processing module 1103 is configured to process the i-th second input value through the model to be trained to obtain the i-th second output value;
  • the second acquiring module 1104 is configured to acquire a third output value according to N first output values and N second output values;
  • the third acquiring module 1105 is configured to acquire the target loss according to the third output value and the fifth output value, the target loss is used to indicate the difference between the third output value and the fifth output value, and the fifth output value is the first It is obtained by substituting the input value into the boundary condition of the partial differential equation;
  • An update module 1106, configured to update the parameters of the model to be trained according to the target loss until the model training conditions are met to obtain the target neural network.
  • the expression of the boundary integral includes the basic solution of the partial differential equation and the boundary density function of the partial differential equation, it can be represented by the model to be trained Boundary density functions for partial differential equations, and train on them.
  • the first input value and the second input value can be processed according to the basic solution of the partial differential equation to obtain the first output value .
  • the second input value is processed by the model to be trained to obtain a second output value.
  • a third output value is obtained.
  • the target loss is obtained, the target loss is used to indicate the difference between the third output value and the fifth output value, and the fifth output value is to substitute the first input value into the partial differential equation obtained by the boundary conditions.
  • the parameters of the model to be trained are updated according to the target loss until the model training conditions are met, and the target neural network is obtained.
  • the model to be trained represents the boundary density function of the partial differential equation, which is a part of the boundary product expression of the solution of the partial differential equation
  • the second input value used to train the model to be trained is acquired (training data)
  • it is only necessary to collect the second input value on the boundary of the region to be solved whether the region is a finite region or an infinite region). In this way, even with a limited amount of training data collected, the data adequately characterizes the entire region to be solved.
  • the target neural network trained based on these data can output an intermediate output value with sufficient accuracy after processing any input value in the area to be solved of the partial differential equation, and the final output can be accurately determined based on the intermediate output value value (based on the principle of boundary integral calculation), as the solution in the partial differential equation corresponding to this input value.
  • the first processing module 1102 is configured to substitute the first input value and the i-th second input value into the basic solution of the partial differential equation to obtain the i-th first output value.
  • the first processing module 1102 is configured to: derive the basic solution of the partial differential equation from the external normal vector of the boundary of the area to be solved to obtain the target derivative; combine the first input value and the ith The second input value is substituted into the target derivative to obtain the i-th first output value.
  • the second acquisition module 1104 is configured to: multiply the i-th first output value and the i-th second output value to obtain the i-th fourth output value;
  • the fourth output value is weighted and summed to obtain the third output value.
  • the device also includes: a fourth acquisition module, configured to acquire parameters of the target task to be processed; a construction module, configured to construct a partial differential equation, a region to be solved for the partial differential equation, and Boundary conditions for partial differential equations.
  • the second processing module 1103 is configured to process the i-th second input value and parameters through the model to be trained to obtain the i-th second output value.
  • FIG. 12 is a schematic structural diagram of the execution device provided in the embodiment of the present application.
  • the execution device 1200 may specifically be a mobile phone, a tablet, a notebook computer, a smart wearable device, a server, etc., which is not limited here.
  • the device for solving partial differential equations described in the embodiment corresponding to FIG. 10 may be deployed on the execution device 1200 to realize the function of solving the partial differential equations in the embodiments corresponding to FIG. 6 or FIG. 9 .
  • the execution device 1200 includes: a receiver 1201, a transmitter 1202, a processor 1203, and a memory 1204 (the number of processors 1203 in the execution device 1200 may be one or more, and one processor is taken as an example in FIG. 12 ) , where the processor 1203 may include an application processor 12031 and a communication processor 12032 .
  • the receiver 1201 , the transmitter 1202 , the processor 1203 and the memory 1204 may be connected through a bus or in other ways.
  • the memory 1204 may include read-only memory and random-access memory, and provides instructions and data to the processor 1203 .
  • a part of the memory 1204 may also include a non-volatile random access memory (non-volatile random access memory, NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 1204 stores processors and operating instructions, executable modules or data structures, or their subsets, or their extended sets, wherein the operating instructions may include various operating instructions for implementing various operations.
  • the processor 1203 controls the operations of the execution device.
  • various components of the execution device are coupled together through a bus system, where the bus system may include not only a data bus, but also a power bus, a control bus, and a status signal bus.
  • the various buses are referred to as bus systems in the figures.
  • the methods disclosed in the foregoing embodiments of the present application may be applied to the processor 1203 or implemented by the processor 1203 .
  • the processor 1203 may be an integrated circuit chip, which has a signal processing capability.
  • each step of the above-mentioned method may be implemented by an integrated logic circuit of hardware in the processor 1203 or instructions in the form of software.
  • the above-mentioned processor 1203 can be a general-purpose processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), field programmable Field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP digital signal processing
  • ASIC application specific integrated circuit
  • FPGA field programmable Field-programmable gate array
  • the processor 1203 may implement or execute various methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory 1204, and the processor 1203 reads the information in the memory 1204, and completes the steps of the above method in combination with its hardware.
  • the receiver 1201 can be used to receive input digital or character information, and generate signal input related to performing device related settings and function control.
  • the transmitter 1202 can be used to output digital or character information through the first interface; the transmitter 1202 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1202 can also include a display device such as a display screen .
  • the processor 1203 is configured to solve the partial differential equation through the target neural network in the embodiment corresponding to FIG. 6 or FIG. 9 .
  • FIG. 13 is a schematic structural diagram of the training device provided in the embodiment of the present application.
  • the training device 1300 is implemented by one or more servers, and the training device 1300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (central processing units, CPU) 1314 (eg, one or more processors) and memory 1332, and one or more storage media 1330 (eg, one or more mass storage devices) for storing application programs 1342 or data 1344.
  • the memory 1332 and the storage medium 1330 may be temporary storage or persistent storage.
  • the program stored in the storage medium 1330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the training device. Furthermore, the central processing unit 1314 may be configured to communicate with the storage medium 1330 , and execute a series of instruction operations in the storage medium 1330 on the training device 1300 .
  • the training device 1300 can also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input and output interfaces 1358; or, one or more operating systems 1341, such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • operating systems 1341 such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • the training device may execute the model training method in the embodiment corresponding to FIG. 4 or FIG. 7 .
  • the embodiment of the present application also relates to a computer storage medium, where a program for signal processing is stored in the computer-readable storage medium, and when the program is run on the computer, the computer executes the steps performed by the aforementioned execution device, or, The computer is caused to perform the steps as performed by the aforementioned training device.
  • the embodiment of the present application also relates to a computer program product, where instructions are stored in the computer program product, and when executed by a computer, the instructions cause the computer to perform the steps performed by the aforementioned executing device, or cause the computer to perform the steps performed by the aforementioned training device.
  • the execution device, training device or terminal device provided in the embodiment of the present application may specifically be a chip.
  • the chip includes: a processing unit and a communication unit.
  • the processing unit may be, for example, a processor, and the communication unit may be, for example, an input/output interface, pins or circuits etc.
  • the processing unit can execute the computer-executed instructions stored in the storage unit, so that the chips in the execution device execute the data processing methods described in the above embodiments, or make the chips in the training device execute the data processing methods described in the above embodiments.
  • the storage unit is a storage unit in the chip, such as a register, a cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device, such as only Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
  • ROM Read-only memory
  • RAM random access memory
  • FIG. 14 is a schematic structural diagram of the chip provided by the embodiment of the present application.
  • the chip can be represented as a neural network processor NPU 1400, and the NPU 1400 is mounted to the main CPU (Host CPU) as a coprocessor ), the tasks are assigned by the Host CPU.
  • the core part of the NPU is the operation circuit 1403, and the operation circuit 1403 is controlled by the controller 1404 to extract matrix data in the memory and perform multiplication operations.
  • the operation circuit 1403 includes multiple processing units (Process Engine, PE).
  • arithmetic circuit 1403 is a two-dimensional systolic array.
  • the arithmetic circuit 1403 may also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition.
  • arithmetic circuit 1403 is a general-purpose matrix processor.
  • the operation circuit fetches the data corresponding to the matrix B from the weight storage 1402, and caches it in each PE in the operation circuit.
  • the operation circuit takes the data of matrix A from the input memory 1401 and performs matrix operation with matrix B, and the obtained partial or final results of the matrix are stored in an accumulator 1408 .
  • the unified memory 1406 is used to store input data and output data.
  • the weight data directly accesses the controller (Direct Memory Access Controller, DMAC) 1405 through the storage unit, and the DMAC is transferred to the weight storage 1402.
  • the input data is also transferred to the unified memory 1406 through the DMAC.
  • DMAC Direct Memory Access Controller
  • the BIU is the Bus Interface Unit, that is, the bus interface unit 1413, which is used for the interaction between the AXI bus and the DMAC and the instruction fetch buffer (Instruction Fetch Buffer, IFB) 1409.
  • IFB Instruction Fetch Buffer
  • the bus interface unit 1413 (Bus Interface Unit, BIU for short), is used for the instruction fetch memory 1409 to obtain instructions from the external memory, and is also used for the storage unit access controller 1405 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • BIU Bus Interface Unit
  • the DMAC is mainly used to move the input data in the external memory DDR to the unified memory 1406 , to move the weight data to the weight memory 1402 , or to move the input data to the input memory 1401 .
  • the vector computing unit 1407 includes a plurality of computing processing units, and if necessary, further processes the output of the computing circuit 1403, such as vector multiplication, vector addition, exponent operation, logarithmic operation, size comparison and so on. It is mainly used for non-convolutional/fully connected layer network calculations in neural networks, such as Batch Normalization (batch normalization), pixel-level summation, upsampling of predicted label planes, etc.
  • the vector computation unit 1407 can store the vector of the processed output to the unified memory 1406 .
  • the vector calculation unit 1407 can apply a linear function; or, a non-linear function to the output of the operation circuit 1403, such as performing linear interpolation on the predicted label plane extracted by the convolutional layer, and then for example, a vector of accumulated values to generate an activation value .
  • the vector computation unit 1407 generates normalized values, pixel-level summed values, or both.
  • the vector of processed outputs can be used as an activation input to operational circuitry 1403, eg, for use in subsequent layers in a neural network.
  • An instruction fetch buffer 1409 connected to the controller 1404 is used to store instructions used by the controller 1404;
  • the unified memory 1406, the input memory 1401, the weight memory 1402 and the fetch memory 1409 are all On-Chip memories. External memory is private to the NPU hardware architecture.
  • the processor mentioned above can be a general-purpose central processing unit, microprocessor, ASIC, or one or more integrated circuits for controlling the execution of the above-mentioned programs.
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be A physical unit can be located in one place, or it can be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • the connection relationship between the modules indicates that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines.
  • the essence of the technical solution of this application or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a readable storage medium, such as a floppy disk of a computer , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to make a computer device (which can be a personal computer, training device, or network device, etc.) execute the instructions described in various embodiments of the present application method.
  • a computer device which can be a personal computer, training device, or network device, etc.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented using software, it may be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transferred from a website, computer, training device, or data
  • the center transmits to another website site, computer, training device or data center via wired (eg, coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (eg, infrared, wireless, microwave, etc.).
  • wired eg, coaxial cable, fiber optic, digital subscriber line (DSL)
  • wireless eg, infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer, or a data storage device such as a training device or a data center integrated with one or more available media.
  • the available medium may be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (Solid State Disk, SSD)), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Software Systems (AREA)
  • Biophysics (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computational Linguistics (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Operations Research (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Feedback Control In General (AREA)

Abstract

本申请提供一种偏微分方程求解方法及其相关设备,应用于人工智能领域,使用神经网络表示偏微分方程的边界密度函数,故通过神经网络对输入值进行处理后,可得到具备一定准确度的解。本申请的方法包括:获取偏微分方程的第一输入值和N个第二输入值,第一输入值位于偏微分方程的待求解区域中,N个第二输入值位于待求解区域的边界上,N≥1;根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,…,N;通过目标神经网络对第i个第二输入值进行处理,得到第i个第二输出值;根据N个第一输出值以及N个第二输出值,获取第三输出值,第三输出值作为偏微分方程中与第一输入值对应的解。

Description

一种偏微分方程求解方法及其相关设备
本申请要求于2021年09月28日提交中国专利局、申请号为202111146738.5、发明名称为“一种偏微分方程求解方法及其相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能(artificial intelligence,AI)技术领域,尤其涉及一种偏微分方程求解方法及其相关设备。
背景技术
偏微分方程(partial differential equation,PDE)是指包含有多个未知数的函数及其偏导数描述的方程。偏微分方程可应用在许多领域中,例如,电磁学、热力学、流体力学、结构力学等等。因此,在电磁仿真、热仿真、流体仿真等领域都依赖于对偏微分方程的求解。
目前,神经网络因具有通用表示和自动微分的能力,被用于求解偏微分方程。具体地,可用神经网络表示待求解的偏微分方程的解,对于某个待求解的输入值而言,可将该输入值输入至神经网络,以使得神经网络对输入值进行一系列的运算,从而得到相应的输出值,那么,该输出值可作为偏微分方程的解。
由于偏微分方程的解往往较为复杂,用于表示偏微分方程的解的神经网络在对输入值进行处理后,所得到的解不够精准。
发明内容
本申请实施例提供了一种偏微分方程求解方法及其相关设备,使用神经网络表示偏微分方程的边界密度函数,故通过神经网络对输入值进行处理后,可得到具备一定准确度的解。
本申请实施例的第一方面提供了一种偏微分方程求解方法,该方法包括:
在需要处理某个目标任务时,可获取用于描述该目标任务的偏微分方程。随后,在该偏微分方程的待求解区域中采集第一输入值,并在该偏微分方程的待求解区域的边界上采集N个第二输入值,N为大于或等于1的整数。
接着,在N个第二输入值中,对于任意一个第二输入值,即第i个第二输入值,可根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N。需要说明的是,除了第i个第二输入值之外的其余第二输入值,也可执行如同第i个第二输入值的处理,故可得到N个第一输出值。
值得注意的是,可将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可使用目标神经网络(已训练的神经网络模型)表示偏微分方程的边界密度函数,以通过目标神经网络对第i个第二输入值进行处理,得到第i个第二输出值。需要说明的是,除了第i个第二输入值之外的其余第二输入值,也可执行如同第i个第二输入值的处理,故可得到N个第二输出值。
最后,可对N个第一输出值以及N个第二输出值进行计算,从而得到第三输出值,第三输出值可视为偏微分方程中与第一输入值对应的解。
从上述方法可以看出:通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过目标神经网络表示偏微分方程的边界密度函数。相较于偏微分方程的解本身,偏微分方程的边界密度函数较为简单,用于表示偏微分方程的边界密度函数的神经网络在对输入值进行处理后,可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
在一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:直接将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。前述实现方式中,若该边界积分表达式中的被积函数为偏微分方程的基本解与偏微分方程的边界密度函数之间的乘积,则可直接将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。如此一来,则可以得到N个第一输出值。
在一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。前述实现方式中,若该边界积分表达式中的被积函数为目标导数与偏微分方程的边界密度函数之间的乘积,目标导数为将偏微分方程的基本解对待求解区域的边界的外法向量求导所得到的结果,则可先将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数,然后将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。如此一来,则可以得到N个第一输出值。
在一种可能的实现方式中,根据N个第一输出值以及N个第二输出值,获取第三输出值包括:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。前述实现方式中,在N个第一输出值和N个第二输出值中,可先将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值。除了第i个第一输出值之外的其余第一输出值和除了第i个第二输出值之外的其余第二输出值,也可执行如同第i个第一输出值与第i个第二输出值的处理,故可得到N个第四输出值。然后,可将N个第四输出值进行加权求和处理,得到第三输出值。
在一种可能的实现方式中,获取偏微分方程的第一输入值和N个第二输入值之前,方法还包括:获取待处理的目标任务的参数;根据参数构建用于描述目标任务的偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件,其中,偏微分方程的待求解区域既可以是边界开放区域(无穷区域),也可以是边界非开放区域(有限区域)。
在一种可能的实现方式中,通过目标神经网络对第i个第二输入值进行处理,得到第i个第二输出值包括:通过目标神经网络对第i个第二输入值和参数进行处理,得到第i个第二输出值。前述实现方式中,对于不同的目标任务,可用目标任务的参数来标记任务本身。那么,若需要用目标神经网络对某一个目标任务进行求解,可将输入值和该目标任务的参数输入值目标神经网络,从而得到相应的输出值。同样地,若需要用目标神经网络对另一个目标任务进行求解,可将输入值和该目标任务的参数输入值目标神经网络,也可得到相应的输出值。由此可见,目标神经网络可用于对描述不同目标任务的偏微分方程进行求解。
本申请实施例的第二方面提供了一种模型训练方法,该方法包括:获取偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入值位于偏微分方程的待求解区域的边界上,N≥1,偏微分方程用于描述待处理的目标任务;根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N;通过待训练模型对第i个第二输入值进行处理,得到第i个第二输出值;根据N个第一输出值以及N个第二输出值,获取第三输出值;根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的;根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
本申请实施例中,通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过待训练模型表示偏微分方程的边界密度函数,并对其进行训练。在模型的训练过程中,在获取偏微分方程的第一输入值和第二输入值后,可根据偏微分方程的基本解对第一输入值和第二输入值进行处理,得到第一输出值。接着,通过待训练模型对第二输入值进行处理,得到第二输出值。然后,根据第一输出值以及第二输出值,获取第三输出值。随后,根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。最后,根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。前述过程中,由于待训练模型表示偏微分方程的边界密度函数,该边界密度函数为偏微分方程的解的边界积表达式中的一部分,故在获取用于训练待训练模型的第二输入值(训练数据)时,只需在待求解区域(无论该区域为有限区域还是无穷区域)的边界上采集第二输入值即可。如此一来,即使采集有限数量的训练数据,这些数据也可充分表征整个待求解区域。基于这些数据训练得到的目标神经网络,在对偏微分方程的待求解区域中任意一个输入值进行处理后,均可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
在一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。
在一种可能的实现方式中,根据N个第一输出值以及N个第二输出值,获取第三输出值包括:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
在一种可能的实现方式中,获取偏微分方程的第一输入值和N个第二输入值之前,方法还包括:获取待处理的目标任务的参数;根据参数构建偏微分方程、偏微分方程的待求解区 域以及偏微分方程的边界条件。
在一种可能的实现方式中,通过待训练模型对第i个第二输入值进行处理,得到第i个第二输出值包括:通过待训练模型对第i个第二输入值和参数进行处理,得到第i个第二输出值。前述实现方式中,在对待训练模型进行训练的过程中,可令待训练模型学习到不同目标任务的参数,以使得训练得到的目标神经网络在实际应用过程中,可对同一领域的不同目标任务(仿真任务)进行处理,如此一来,不仅可提高模型训练的效率,还可以使得目标神经网络具备对不同任务的处理能力,即对不同偏微分方程的求解能力。
本申请实施例的第三方面提供了一种偏微分方程求解装置,该装置包括:第一获取模块,用于获取偏微分方程的第一输入值和N个第二输入值,第一输入值位于偏微分方程的待求解区域中,N个第二输入值位于待求解区域的边界上,N≥1,偏微分方程用于描述待处理的目标任务;第一处理模块,用于根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N;第二处理模块,用于通过目标神经网络对第i个第二输入值进行处理,得到第i个第二输出值;第二获取模块,用于根据N个第一输出值以及N个第二输出值,获取第三输出值,第三输出值作为偏微分方程中与第一输入值对应的解。
从上述装置可以看出:通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过目标神经网络表示偏微分方程的边界密度函数。相较于偏微分方程的解本身,偏微分方程的边界密度函数较为简单,用于表示偏微分方程的边界密度函数的神经网络在对输入值进行处理后,可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
在一种可能的实现方式中,第一处理模块,用于将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在一种可能的实现方式中,第一处理模块,用于:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。
在一种可能的实现方式中,第二获取模块,用于:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
在一种可能的实现方式中,该装置还包括:第三获取模块,用于获取待处理的目标任务的参数;构建模块,用于根据参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件。
在一种可能的实现方式中,第二处理模块,用于通过目标神经网络对第i个第二输入值和参数进行处理,得到第i个第二输出值。
本申请实施例的第四方面提供了一种模型训练装置,其特征在于,该装置包括:第一获取模块,用于获取偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入 值位于偏微分方程的待求解区域的边界上,N≥1,偏微分方程用于描述待处理的目标任务;第一处理模块,用于根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N;第二处理模块,用于通过待训练模型对第i个第二输入值进行处理,得到第i个第二输出值;第二获取模块,用于根据N个第一输出值以及N个第二输出值,获取第三输出值;第三获取模块,用于根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的;更新模块,用于根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
从上述装置可以看出:通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过待训练模型表示偏微分方程的边界密度函数,并对其进行训练。在模型的训练过程中,在获取偏微分方程的第一输入值和第二输入值后,可根据偏微分方程的基本解对第一输入值和第二输入值进行处理,得到第一输出值。接着,通过待训练模型对第二输入值进行处理,得到第二输出值。然后,根据第一输出值以及第二输出值,获取第三输出值。随后,根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。最后,根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。前述过程中,由于待训练模型表示偏微分方程的边界密度函数,该边界密度函数为偏微分方程的解的边界积表达式中的一部分,故在获取用于训练待训练模型的第二输入值(训练数据)时,只需在待求解区域(无论该区域为有限区域还是无穷区域)的边界上采集第二输入值即可。如此一来,即使采集有限数量的训练数据,这些数据也可充分表征整个待求解区域。基于这些数据训练得到的目标神经网络,在对偏微分方程的待求解区域中任意一个输入值进行处理后,均可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
在一种可能的实现方式中,第一处理模块,用于将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在一种可能的实现方式中,第一处理模块,用于:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。
在一种可能的实现方式中,第二获取模块,用于:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
在一种可能的实现方式中,该装置还包括:第四获取模块,用于获取待处理的目标任务的参数;构建模块,用于根据参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件。
在一种可能的实现方式中,第二处理模块,用于通过待训练模型对第i个第二输入值和参数进行处理,得到第i个第二输出值。
本申请实施例的第五方面提供了一种偏微分方程求解装置,该装置包括存储器和处理器;存储器存储有代码,处理器被配置为执行代码,当代码被执行时,偏微分方程求解装置执行如第一方面或第一方面中任意一种可能的实现方式所述的方法。
本申请实施例的第六方面提供了一种模型训练装置,该装置包括存储器和处理器;存储器存储有代码,处理器被配置为执行代码,当代码被执行时,模型训练装置执行如第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例的第七方面提供了一种电路系统,该电路系统包括处理电路,该处理电路配置为执行如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例的第八方面提供了一种芯片系统,该芯片系统包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
在一种可能的实现方式中,该处理器通过接口与存储器耦合。
在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。
本申请实施例的第九方面提供了一种计算机存储介质,该计算机存储介质存储有计算机程序,该程序在由计算机执行时,使得计算机实施如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例的第十方面提供了一种计算机程序产品,该计算机程序产品存储有指令,该指令在由计算机执行时,使得计算机实施如第一方面、第一方面中任意一种可能的实现方式、第二方面或第二方面中任意一种可能的实现方式所述的方法。
本申请实施例中,通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过待训练模型表示偏微分方程的边界密度函数,并对其进行训练。在模型的训练过程中,在获取偏微分方程的第一输入值和第二输入值后,可根据偏微分方程的基本解对第一输入值和第二输入值进行处理,得到第一输出值。接着,通过待训练模型对第二输入值进行处理,得到第二输出值。然后,根据第一输出值以及第二输出值,获取第三输出值。随后,根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。最后,根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。前述过程中,由于待训练模型表示偏微分方程的边界密度函数,该边界密度函数为偏微分方程的解的边界积表达式中的一部分,故在获取用于训练待训练模型的第二输入值(训练数据)时,只需在待求解区域(无论该区域为 有限区域还是无穷区域)的边界上采集第二输入值即可。如此一来,即使采集有限数量的训练数据,这些数据也可充分表征整个待求解区域。基于这些数据训练得到的目标神经网络,在对偏微分方程的待求解区域中任意一个输入值进行处理后,均可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
附图说明
图1为人工智能主体框架的一种结构示意图;
图2a为本申请实施例提供的偏微分方程求解系统的一个结构示意图;
图2b为本申请实施例提供的偏微分方程求解系统的另一结构示意图;
图2c为本申请实施例提供的偏微分方程求解的相关设备的一个示意图;
图3为本申请实施例提供的系统100架构的一个示意图;
图4为本申请实施例提供的模型训练方法的一个流程示意图;
图5为本申请实施例提供的结果比较的一个示意图;
图6为本申请实施例提供的偏微分方程求解方法的一个流程示意图;
图7为本申请实施例提供的模型训练方法的另一流程示意图;
图8为本申请实施例提供的实验结果的一个示意图;
图9为本申请实施例提供的偏微分方程求解方法的另一流程示意图;
图10为本申请实施例提供的偏微分方程求解装置的一个结构示意图;
图11为本申请实施例提供的模型训练装置的一个结构示意图;
图12为本申请实施例提供的执行设备的一个结构示意图;
图13为本申请实施例提供的训练设备的一个结构示意图;
图14为本申请实施例提供的芯片的一个结构示意图。
具体实施方式
本申请实施例提供了一种偏微分方程求解方法及其相关设备,使用神经网络表示偏微分方程的边界密度函数,故通过神经网络对输入值进行处理后,可得到具备一定准确度的解。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”并他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
偏微分方程是指包含有多个未知数的函数及其偏导数描述的方程。偏微分方程可应用在许多领域中,例如,电磁学、热力学、流体力学、结构力学等等。因此,在电磁仿真、热仿真、流体仿真等各领域的仿真任务都依赖于对偏微分方程的求解。具体而言,诸如手机天线设计、芯片电路设计、基站天线设计、半导体工艺和器件设计、工件热设计、汽车外形设计 等技术问题都依赖对偏微分方程的求解。
近年来,神经网络获得了飞快的发展,神经网络因具有通用表示和自动微分的能力,也被用于求解偏微分方程。在相关技术中,可利用神经网络表示待求解的偏微分方程的解,自动实现数值求解。具体地,对于某个待求解的输入值而言,可将该输入值输入至神经网络,以使得神经网络对输入值进行一系列的运算,从而得到相应的输出值,那么,该输出值可作为偏微分方程的解。
在对用于表示偏微分方程的解的神经网络的训练过程中,若该偏微分方程的待求解区域为边界开放区域(即无穷区域),训练数据的采集效率很低,即无法用有限数量的训练数据来表征整个待求解区域,导致训练得到的神经网络在实际应用过程中,所输出的解不够精准。
为了解决上述问题,本申请实施例提供了一种偏微分方程求解方法,该方法可结合人工智能(artificial intelligence,AI)技术实现。AI技术是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能的技术学科,AI技术通过感知环境、获取知识并使用知识获得最佳结果。换句话说,人工智能技术是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式做出反应的智能机器。利用人工智能实现偏微分方程求解是人工智能常见的一个应用方式。
首先对人工智能系统总体工作流程进行描述,请参见图1,图1为人工智能主体框架的一种结构示意图,下面从“智能信息链”(水平轴)和“IT价值链”(垂直轴)两个维度对上述人工智能主题框架进行阐述。其中,“智能信息链”反映从数据的获取到处理的一列过程。举例来说,可以是智能信息感知、智能信息表示与形成、智能推理、智能决策、智能执行与输出的一般过程。在这个过程中,数据经历了“数据—信息—知识—智慧”的凝练过程。“IT价值链”从人智能的底层基础设施、信息(提供和处理技术实现)到系统的产业生态过程,反映人工智能为信息技术产业带来的价值。
(1)基础设施
基础设施为人工智能系统提供计算能力支持,实现与外部世界的沟通,并通过基础平台实现支撑。通过传感器与外部沟通;计算能力由智能芯片(CPU、NPU、GPU、ASIC、FPGA等硬件加速芯片)提供;基础平台包括分布式计算框架及网络等相关的平台保障和支持,可以包括云存储和计算、互联互通网络等。举例来说,传感器和外部沟通获取数据,这些数据提供给基础平台提供的分布式计算系统中的智能芯片进行计算。
(2)数据
基础设施的上一层的数据用于表示人工智能领域的数据来源。数据涉及到图形、图像、语音、文本,还涉及到传统设备的物联网数据,包括已有系统的业务数据以及力、位置、液位、温度、湿度等感知数据。
(3)数据处理
数据处理通常包括数据训练,机器学习,深度学习,搜索,推理,决策等方式。
其中,机器学习和深度学习可以对数据进行符号化和形式化的智能信息建模、抽取、预处理、训练等。
推理是指在计算机或智能系统中,模拟人类的智能推理方式,依据推理控制策略,利用形式化的信息进行机器思维和求解问题的过程,典型的功能是搜索与匹配。
决策是指智能信息经过推理后进行决策的过程,通常提供分类、排序、预测等功能。
(4)通用能力
对数据经过上面提到的数据处理后,进一步基于数据处理的结果可以形成一些通用的能力,比如可以是算法或者一个通用系统,例如,翻译,文本的分析,计算机视觉的处理,语音识别,图像的识别,仿真任务的处理(即偏微分方程求解)等等。
(5)智能产品及行业应用
智能产品及行业应用指人工智能系统在各领域的产品和应用,是对人工智能整体解决方案的封装,将智能信息决策产品化、实现落地应用,其应用领域主要包括:智能终端、智能交通、智能医疗、自动驾驶、智慧城市等。
接下来介绍几种本申请的应用场景。
图2a为本申请实施例提供的偏微分方程求解系统的一个结构示意图,该偏微分方程求解系统包括用户设备以及数据处理设备。其中,用户设备包括手机、个人电脑或者信息处理中心等智能终端。用户设备为偏微分方程求解的发起端,作为仿真任务处理请求(也可以称为偏微分方程求解请求)的发起方,通常由用户通过用户设备发起请求。
上述数据处理设备可以是云服务器、网络服务器、应用服务器以及管理服务器等具有数据处理功能的设备或服务器。数据处理设备通过交互接口接收来自智能终端的仿真任务处理请求,再通过存储数据的存储器以及数据处理的处理器环节进行机器学习,深度学习,搜索,推理,决策等方式的偏微分方程求解。数据处理设备中的存储器可以是一个统称,包括本地存储以及存储历史数据的数据库,数据库可以在数据处理设备上,也可以在其它网络服务器上。
在图2a所示的偏微分方程求解系统中,用户设备可以接收用户的指令,例如用户设备可以获取用户输入/选择的仿真任务的参数,然后向数据处理设备发起请求,使得数据处理设备针对用户设备得到的该仿真任务的参数执行偏微分方程求解,从而得到该仿真任务的处理结果。示例性的,用户设备可以获取用户输入的某个仿真任务的参数,然后向数据处理设备发起仿真任务处理请求,使得数据处理设备根据该仿真任务的参数构建相应的偏微分方程,并对该方程进行解析,从而得到该方程的解,即该仿真任务的处理结果。
在图2a中,数据处理设备可以执行本申请实施例的偏微分方程求解方法。
图2b为本申请实施例提供的偏微分方程求解系统的另一结构示意图,在图2b中,用户设备直接作为数据处理设备,该用户设备能够直接获取来自用户的输入并直接由用户设备本身的硬件进行处理,具体过程与图2a相似,可参考上面的描述,在此不再赘述。
在图2b所示的偏微分方程求解系统中,用户设备可以接收用户的指令,例如用户设备可以获取用户在用户设备中所选择的某个仿真任务的参数,然后再由用户设备自身针对该仿真任务的参数执行偏微分方程求解,从而得到针对该仿真任务的处理结果。
在图2b中,用户设备自身就可以执行本申请实施例的偏微分方程求解方法。
图2c为本申请实施例提供的偏微分方程求解的相关设备的一个示意图。
上述图2a和图2b中的用户设备具体可以是图2c中的本地设备301或者本地设备302,图2a中的数据处理设备具体可以是图2c中的执行设备210,其中,数据存储系统250可以存储执行设备210的待处理数据,数据存储系统250可以集成在执行设备210上,也可以设 置在云上或其它网络服务器上。
图2a和图2b中的处理器可以通过神经网络模型或者其它模型(例如,基于支持向量机的模型)进行数据训练/机器学习/深度学习,并利用数据最终训练或者学习得到的模型针对图像执行偏微分方程求解,从而得到相应的处理结果。
图3为本申请实施例提供的系统100架构的一个示意图,在图3中,执行设备110配置输入/输出(input/output,I/O)接口112,用于与外部设备进行数据交互,用户可以通过客户设备140向I/O接口112输入数据,所述输入数据在本申请实施例中可以包括:各个待调度任务、可调用资源以及其他参数。
在执行设备110对输入数据进行预处理,或者在执行设备110的计算模块111执行计算等相关的处理(比如进行本申请中神经网络的功能实现)过程中,执行设备110可以调用数据存储系统150中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统150中。
最后,I/O接口112将处理结果返回给客户设备140,从而提供给用户。
值得说明的是,训练设备120可以针对不同的目标或称不同的任务,基于不同的训练数据生成相应的目标神经网络/规则,该相应的目标神经网络/规则即可以用于实现上述目标或完成上述任务,从而为用户提供所需的结果。其中,训练数据可以存储在数据库130中,且来自于数据采集设备160采集的训练样本。
在图3中所示情况下,用户可以手动给定输入数据,该手动给定可以通过I/O接口112提供的界面进行操作。另一种情况下,客户设备140可以自动地向I/O接口112发送输入数据,如果要求客户设备140自动发送输入数据需要获得用户的授权,则用户可以在客户设备140中设置相应权限。用户可以在客户设备140查看执行设备110输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备140也可以作为数据采集端,采集如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果作为新的样本数据,并存入数据库130。当然,也可以不经过客户设备140进行采集,而是由I/O接口112直接将如图所示输入I/O接口112的输入数据及输出I/O接口112的输出结果,作为新的样本数据存入数据库130。
值得注意的是,图3仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图3中,数据存储系统150相对执行设备110是外部存储器,在其它情况下,也可以将数据存储系统150置于执行设备110中。如图3所示,可以根据训练设备120训练得到神经网络。
本申请实施例还提供的一种芯片,该芯片包括神经网络处理器NPU。该芯片可以被设置在如图3所示的执行设备110中,用以完成计算模块111的计算工作。该芯片也可以被设置在如图3所示的训练设备120中,用以完成训练设备120的训练工作并输出目标神经网络/规则。
神经网络处理器NPU,NPU作为协处理器挂载到主中央处理器(central processing unit,CPU)(host CPU)上,由主CPU分配任务。NPU的核心部分为运算电路,控制器控制运算电路提取存储器(权重存储器或输入存储器)中的数据并进行运算。
在一些实现中,运算电路内部包括多个处理单元(process engine,PE)。在一些实现中,运算电路是二维脉动阵列。运算电路还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)中。
向量计算单元可以对运算电路的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。例如,向量计算单元可以用于神经网络中非卷积/非FC层的网络计算,如池化(pooling),批归一化(batch normalization),局部响应归一化(local response normalization)等。
在一些实现中,向量计算单元能将经处理的输出的向量存储到统一缓存器。例如,向量计算单元可以将非线性函数应用到运算电路的输出,例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元生成归一化的值、合并值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路的激活输入,例如用于在神经网络中的后续层中的使用。
统一存储器用于存放输入数据以及输出数据。
权重数据直接通过存储单元访问控制器(direct memory access controller,DMAC)将外部存储器中的输入数据搬运到输入存储器和/或统一存储器、将外部存储器中的权重数据存入权重存储器,以及将统一存储器中的数据存入外部存储器。
总线接口单元(bus interface unit,BIU),用于通过总线实现主CPU、DMAC和取指存储器之间进行交互。
与控制器连接的取指存储器(instruction fetch buffer),用于存储控制器使用的指令;
控制器,用于调用指存储器中缓存的指令,实现控制该运算加速器的工作过程。
一般地,统一存储器,输入存储器,权重存储器以及取指存储器均为片上(On-Chip)存储器,外部存储器为该NPU外部的存储器,该外部存储器可以为双倍数据率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDR SDRAM)、高带宽存储器(high bandwidth memory,HBM)或其他可读可写的存储器。
由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。
(1)神经网络
神经网络可以是由神经单元组成的,神经单元可以是指以xs和截距1为输入的运算单元,该运算单元的输出可以为:
Figure PCTCN2022118577-appb-000001
其中,s=1、2、......n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输 入。激活函数可以是sigmoid函数。神经网络是将许多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。
神经网络中的每一层的工作可以用数学表达式y=a(Wx+b)来描述:从物理层面神经网络中的每一层的工作可以理解为通过五种对输入空间(输入向量的集合)的操作,完成输入空间到输出空间的变换(即矩阵的行空间到列空间),这五种操作包括:1、升维/降维;2、放大/缩小;3、旋转;4、平移;5、“弯曲”。其中1、2、3的操作由Wx完成,4的操作由+b完成,5的操作则由a()来实现。这里之所以用“空间”二字来表述是因为被分类的对象并不是单个事物,而是一类事物,空间是指这类事物所有个体的集合。其中,W是权重向量,该向量中的每一个值表示该层神经网络中的一个神经元的权重值。该向量W决定着上文所述的输入空间到输出空间的空间变换,即每一层的权重W控制着如何变换空间。训练神经网络的目的,也就是最终得到训练好的神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。因此,神经网络的训练过程本质上就是学习控制空间变换的方式,更具体的就是学习权重矩阵。
因为希望神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到神经网络能够预测出真正想要的目标值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么神经网络的训练就变成了尽可能缩小这个loss的过程。
(2)反向传播算法
神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的神经网络模型中参数的大小,使得神经网络模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的神经网络模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的神经网络模型的参数,例如权重矩阵。
下面从神经网络的训练侧和神经网络的应用侧对本申请提供的方法进行描述。
本申请实施例提供的模型训练方法,涉及偏微分方程的处理,具体可以应用于数据训练、机器学习、深度学习等数据处理方法,对训练数据(如本申请实施例提供的模型训练方法中的第一输入值和第二输入值)进行符号化和形式化的智能信息建模、抽取、预处理、训练等,最终得到训练好的神经网络(如本申请实施例中的目标神经网络);并且,本申请实施例提供的偏微分方程求解方法可以运用上述训练好的神经网络,将输入数据(如本申请实施例提供的偏微分方程求解方法中的第一输入值和第二输入值)输入到所述训练好的神经网络中,得到输出数据(如本申请实施例提供的偏微分方程求解方法中,第三输出值等等)。需要说明的是,本 申请实施例提供的模型训练方法和偏微分方程求解方法是基于同一个构思产生的发明,也可以理解为一个系统中的两个部分,或一个整体流程的两个阶段:如模型训练阶段和模型应用阶段。
需要说明的是,本申请实施例中,目标神经网络既可以仅针对某一个领域的仿真任务进行处理,也可以针对某一个领域的多个仿真任务进行处理,即目标神经网络可具备单一的任务处理功能,也可以具备多样化的任务处理功能。下文将分为两种情况进行说明,首先对第一种情况进行介绍,即对目标神经网络具备单一的任务处理功能这一情况进行介绍,并先对第一种情况中的目标神经网络的训练阶段进行具体介绍。图4为本申请实施例提供的模型训练方法的一个流程示意图,如图4所示,该方法包括:
401、获取待处理的目标任务的参数。
402、根据目标任务的参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件,偏微分方程用于描述目标任务。
本实施例中,若需得到能处理某领域的某个仿真任务(后续称为目标任务)的目标神经网络,可先获取目标任务的参数。例如,设需处理一个工件在生产环境下的稳态温度分布的仿真任务,且该工件为方形部件,其材质均匀且各向同性。该工件的内部无热源,该工件的一部分边界与外界非热源的物体(例如,液体或其他工件等等)连接,一部分边界与外界热源接触。因此,该仿真任务的目的是:在此种状态下,获取该工件内部达到稳定状态时温度的分布情况。基于此,可得到该仿真任务的参数,该仿真任务的参数包含工件的形状、工件的材质、工件内部无热源、工件边界的接触物体等等。
得到目标任务的参数后,可根据目标任务的参数构建用于描述目标任务的偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件。依旧如上述例子,该仿真任务为工件内部的温度分布,故该仿真任务可通过拉普拉斯(laplace)方程进行描述,该拉普拉斯方程通过以下公式表示:
-Δu(x)=0,x∈Ω      (2)
上式中,x为拉普拉斯方程的输入值,表示工件中的某一个点;u(x)为拉普拉斯方程的输出值(也可以称为该方程中与x对应的解),u()可理解为工件内部的温度分布(也可以称为温度分布场);Ω为拉普拉斯方程的待求解区域,表示整个工件,可见,该待求解区域为一个边界非开放区域(即有限区域),例如,Ω=[-1,1]×[-1,1]。由于x为工件中的某一个点,故x可视为一个二维的向量,表示x在整个工件中的坐标,即x=(a,b)。
进一步地,该拉普拉斯方程的边界条件为第一类边界条件,即:
Figure PCTCN2022118577-appb-000002
上式中,g(x)为拉普拉斯方程的边界条件;
Figure PCTCN2022118577-appb-000003
表示待求解区域的边界。可见,g(x) 在待求解区域的边界上为不光滑的函数。
如此一来,目标任务的处理则转化为用于描述目标任务的偏微分方程的求解。相关技术的待训练模型用于表示整个偏微分方程,模型训练过程存在各种问题(例如,训练数据采集效率低下等等),导致在实际应用过程中,训练得到的模型所输出的解不够精准。为了优化模型的训练过程,本实施例可先将偏微分方程进行变形,再用待训练模型表示变形得到的函数,从而提高最终得到的解的精确度。
具体地,可将偏微分方程的输出值用边界积分形式进行表示,该边界积分表达式的被积函数包含偏微分方程的基本解以及偏微分方程的边界密度函数。依旧如上述例子,得到拉普拉斯方程后,可获取拉普拉斯方程的基本解:
Figure PCTCN2022118577-appb-000004
上式中,G(x,y)为拉普拉斯方程的基本解;y为拉普拉斯方程的另一输入值,表示工件中的某一个点。同样地,由于y为工件中的某一个点,故y也可视为一个二维的向量,表示y在整个工件中的坐标,即y=(c,d)。
那么,u(x)可表示为G(x,y)的边界积分形式:
Figure PCTCN2022118577-appb-000005
上式中,h(y)为拉普拉斯方程的边界密度函数;n y
Figure PCTCN2022118577-appb-000006
的外法向量;ds y表示对y进行面积分。
至此,可获取待训练模型(即待训练的神经网络模型),该模型可包含多层全连接层,每层中包含40个神经元,且采用ReLU激活函数。接着,使用待训练模型表示边界密度函数,并对待训练模型进行训练,以得到目标神经网络。
应理解,本实施例中,仅以工件在生产环境下的稳态温度分布的仿真任务作为目标任务进行示意性说明,并不对目标任务的具体内容构成限制。例如,目标任务还可以为:接收天线的电磁场分布的仿真任务。在该任务中,天线的形状为蝶形,且为二维结构,可在印刷电路板上实现。因此,该任务的目的是:模拟蝶形天线在二维空间中的电磁场分布。该任务可通过亥姆霍兹方程进行描述,假设该任务在研究波数为12、固定边界条件的情况下进行,那么,亥姆霍兹方程可通过以下公式表示:
-Δu(x)-144u(x)=0,x∈Ω       (6)
上式中,x为亥姆霍兹方程的输入值,表示工件中的某一个点;u(x)为亥姆霍兹方程中与x对应的输出值(也可以称为该方程的解),u()可理解为蝶形天线在二维空间中的电磁场分布;Ω为亥姆霍兹方程的待求解区域,表示蝶形天线之外的其余区域,可见,该待求解 区域为一个边界开放区域(即无穷区域)。由于x为蝶形天线之外的其余区域的某一个点,故x可视为一个二维的向量,表示x在其余区域中的坐标,即x=(a,b)。
进一步地,该亥姆霍兹方程的边界条件为:
Figure PCTCN2022118577-appb-000007
上式中,g(x)为亥姆霍兹方程的边界条件;
Figure PCTCN2022118577-appb-000008
表示待求解区域的边界;
Figure PCTCN2022118577-appb-000009
是Hankel函数。
进一步地,该亥姆霍兹方程的基本解为:
Figure PCTCN2022118577-appb-000010
上式中,G(x,y)为亥姆霍兹方程的基本解;y为亥姆霍兹方程的另一输入值,表示蝶形天线之外的其余区域的某一个点。同样地,由于y为其余区域中的某一个点,故y也可视为一个二维的向量,表示y在整个其余区域中的坐标,即y=(c,d)。
那么,u(x)可表示为G(x,y)的边界积分形式(如前述公式(5)所示),故可以得到亥姆霍兹方程的边界密度函数h(y),此处不再赘述。
还应理解,本实施例中,仅待训练模型包含全连接层进行示意性说明,并不对待训练模型的结构构成限制,例如,待训练模型可包含卷积层、融合层、全连接层和池化层中的任意一种或任意组合等等。
403、获取偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入值位于待求解区域的边界上,N≥1。
得到待训练模型后,可在偏微分方程的待求解区域中采集一批训练数据。其中,该批训练数据包含偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入值位于待求解区域的边界上,N≥1。
依旧如上述例子,对于拉普拉斯方程的待求解区域Ω中,可在待求解区域的边界
Figure PCTCN2022118577-appb-000011
上,采集输入值x 0以及N个输入值y 1,y 2,...,y N。可见,x 0是工件的边界上的点,y i是工件的边界上的点,i=1,...,N。
404、根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N。
得到第一输入值和N个第二输入值后,在N个第二输入值中,对于任意一个第二输入值,即第i个第二输入值,可根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值。具体地,可通过多种方式对第一输入值和第i个第二输入值进行处理,下文将分别进行介绍:
在一种可能的实现方式中,将第一输入值和第i个第二输入值,直接代入偏微分方程的基本解,得到第i个第一输出值。依旧如上述例子,可将x 0和y i直接输入公式(4),得到 G(x 0,y i)。
在另一种可能的实现方式中,将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数。然后,将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。依旧如上述例子,利用G(x,y)在n y方向进行求导,得到目标导数为
Figure PCTCN2022118577-appb-000012
然后,将x 0和y i直接输入
Figure PCTCN2022118577-appb-000013
得到
Figure PCTCN2022118577-appb-000014
需要说明的是,除了第i个第二输入值之外的其余第二输入值,也可执行如同第i个第二输入值的处理,故可得到N个第一输出值,即G(x 0,y 1),G(x 0,y 1),...,G(x 0,y N)或
Figure PCTCN2022118577-appb-000015
405、通过待训练模型对第i个第二输入值进行处理,得到第i个第二输出值。
得到第一输入值和N个第二输入值后,在N个第二输入值中,对于任意一个第二输入值,即第i个第二输入值,可将第i个第二输入值输入至待训练模型,以通过待训练模型对第i个第二输入值进行处理,得到第i个第二输出值。
依旧如上述例子,在y 1,y 2,...,y N中,可将y i输入至待训练模型,以使得待训练模型对y i进行一系列运算,得到h(y i)。
需要说明的是,除了第i个第二输入值之外的其余第二输入值,也可执行如同第i个第二输入值的处理,故可得到N个第二输出值,即h(y 1),h(y 2),...,h(y N)。
406、根据N个第一输出值以及N个第二输出值,获取第三输出值。
在得到N个第一输出值和N个第二输出值后,可对N个第一输出值以及N个第二输出值进行计算,从而得到第三输出值。具体地,在N个第一输出值和N个第二输出值中,可先将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值。除了第i个第一输出值之外的其余第一输出值和除了第i个第二输出值之外的其余第二输出值,也可执行如同第i个第一输出值与第i个第二输出值的处理,故可得到N个第四输出值。然后,可将N个第四输出值进行加权求和处理,得到第三输出值。
依旧如上述例子,得到G(x 0,y 1),G(x 0,y 1),...,G(x 0,y N)和h(y 1),h(y 2),...,h(y N)后,可参照以下公式进行计算,以得到拉普拉斯方程中与x 0对应的解u(x 0):
Figure PCTCN2022118577-appb-000016
或者,得到
Figure PCTCN2022118577-appb-000017
和h(y 1),h(y 2),...,h(y N)后,可参照以下公式进行计算,以得到拉普拉斯方程中与x 0对应的解u(x 0):
Figure PCTCN2022118577-appb-000018
上式中,α 1,...,α N或β 1,...,β N均为预置的权重参数,这部分参数的大小可根据实际需求进行设置,例如,这些参数的大小可根据拉普拉斯方程所描述的仿真任务的参数确定。
得到第三输出值后,则相当于得到偏微分方程中与第一输入值对应的解。
407、根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。
得到第三输出值后,可将第一输入值代入偏微分方程的边界条件,得到第五输出值。然后,基于第三输出值以及第五输出值进行计算,以得到目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异。
依旧如上述例子,x 0代入公式(3),可得到g(x 0)。那么,根据u(x 0)和g(x 0)进行计算,得到(g(x 0)-u(x 0)) 2。因此,可基于(g(x 0)-u(x 0)) 2构建目标损失:
L=(g(x 0)-u(x 0)) 2+(g(x 1)-u(x 1)) 2+...+(g(x M)-u(x M)) 2     (11)
上式中,L为目标损失。需要说明的是,x 1,...,x M也为训练数据中的输入值,可参考x 0的相关说明,获取g(x 1),...,g(x M)的过程可参考获取g(x 0)的相关说明部分,获取u(x 1),...,u(x M)的过程也可参考获取u(x 0)的相关说明部分,此处不再赘述。
408、根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
得到目标损失后,可根据目标损失对待训练模型的参数进行更新,并利用下一批训练数据对更新参数后的待训练模型进行训练(即重新执行步骤403至步骤407),直至满足模型训练条件(例如,目标损失达到收敛等等),得到目标神经网络。
此外,还可将本申请实施例提供的模型训练方法与相关技术的模型训练方法进行比较,如图5所示(图5为本申请实施例提供的结果比较的一个示意图),其中,最左边是在应用阶段的真实解,中间依次是相关技术一训练得到的模型在应用阶段所输出的结果和相关技术二训练得到的模型在应用阶段所输出的结果,最右边是本申请实施例提供的方法训练得到的目标神经网络在应用阶段所输出的结果。
对不同方法的结果计算相对误差,其中相关技术一的方法和相关技术二的方法的相对误差约为1.0%和3.2%,但是本申请实施例的方法的相对误差只有约0.17%,有较大的改善。而且比较图5中的最终结果可以发现,在边界处的边界条件不光滑的位置,本申请实施例的方法可以有效近似表现出不光滑的信息,但是相关技术一的方法和相关技术二的方法受限于神经网络的表示方法,没能表现出边界处的不光滑性。
本申请实施例中,通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过待训练模型表示偏微分方程的边界密度函数,并对其进行训练。在模型的训练过程中,在获取偏微分方程的第一输入值和第二输入值后,可根据偏微分方程的基本解对第一输入值和第二输入值进行处理, 得到第一输出值。接着,通过待训练模型对第二输入值进行处理,得到第二输出值。然后,根据第一输出值以及第二输出值,获取第三输出值。随后,根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。最后,根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。前述过程中,由于待训练模型表示偏微分方程的边界密度函数,该边界密度函数为偏微分方程的解的边界积表达式中的一部分,故在获取用于训练待训练模型的第二输入值(训练数据)时,只需在待求解区域(无论该区域为有限区域还是无穷区域)的边界上采集第二输入值即可。如此一来,即使采集有限数量的训练数据,这些数据也可充分表征整个待求解区域。基于这些数据训练得到的目标神经网络,在对偏微分方程的待求解区域中任意一个输入值进行处理后,均可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
以上是对第一种情况中的目标神经网络的训练阶段进行的详细说明,以下将对第一种情况中的目标神经网络的应用阶段进行介绍。图6为本申请实施例提供的偏微分方程求解方法的一个流程示意图,如图6所示,该方法包括:
601、获取待处理的目标任务的参数。
602、根据参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件,偏微分方程用于描述目标任务。
关于步骤601和步骤602的说明,可参考前述图4实施例中步骤401和步骤402的相关说明部分,此处不再赘述。
603、获取偏微分方程的第一输入值和N个第二输入值,第一输入值位于偏微分方程的待求解区域中,N个第二输入值位于待求解区域的边界上,N≥1。
关于步骤603的说明,可参考前述图4实施例中步骤403的相关说明部分,此处不再赘述。需要说明的是,应用阶段的步骤603和训练阶段的步骤403的区别在于:步骤603中的第一输入值位于偏微分方程的待求解区域中,其既可以待求解区域内部的点,也可以是待求解区域的边界上的点,依旧如上述例子,在目标神经网络的应用阶段,x 0既可以是工件的边界上的点,也可以是工件内部的点。步骤403中的第一输入值位于偏微分方程的待求解区域的边界上,其仅可是待求解区域的边界上的点,依旧如上述例子,在目标神经网络的训练阶段,x 0是工件的边界上的点。
604、根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N。
在一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在另一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个 第一输出值。
605、通过目标神经网络对第i个第二输入值进行处理,得到第i个第二输出值。
606、根据N个第一输出值以及N个第二输出值,获取第三输出值,第三输出值作为偏微分方程中与第一输入值对应的解。
在一种可能的实现方式中,根据N个第一输出值以及N个第二输出值,获取第三输出值包括:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
关于步骤604至步骤606的说明,可参考前述图4实施例中步骤404至步骤406的相关说明部分,此处不再赘述。
本申请实施例中,通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过目标神经网络表示偏微分方程的边界密度函数。相较于偏微分方程的解本身,偏微分方程的边界密度函数较为简单,用于表示偏微分方程的边界密度函数的神经网络在对输入值进行处理后,可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
以上是对第一种情况中的目标神经网络的应用阶段进行的详细说明,以下将对第二种情况中的目标神经网络的训练阶段进行介绍。图7为本申请实施例提供的模型训练方法的另一流程示意图,如图7所示,该方法包括:
701、获取待处理的目标任务的参数。
本实施例中,若需得到能处理某领域的多个仿真任务(后续称为多个目标任务)的目标神经网络,可先获取每个目标任务的参数。例如,设需处理两个工件在生产环境下的稳态温度分布的仿真任务,第一个工件为锐角三角形部件,第二个工件为直角三角形部件,其材质均匀且各向同性。两个工件的内部无热源,两个工件的一部分边界与外界非热源的物体(例如,液体或其他工件等等)连接,一部分边界与外界热源接触。因此,存在两个仿真任务,第一个仿真任务的目的是:在此种状态下,获取第一个工件内部达到稳定状态时温度的分布情况,第二个仿真任务的目的是:在此种状态下,获取第二个工件内部达到稳定状态时温度的分布情况。基于此,可得到第一个仿真任务的参数和第二个仿真任务的参数,两个仿真任务的参数均包含工件的形状、工件的材质、工件内部无热源、工件边界的接触物体等等。
应理解,本实施例中仅以两个仿真任务(目标任务)进行示意性说明,并不对本实施例中目标任务的数量构成限制。
702、根据目标任务的参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件,偏微分方程用于描述目标任务。
对于每个目标任务,均可根据该目标任务的参数构建用于描述该目标任务的偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件。
703、获取偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入值位于待求解区域的边界上,N≥1。
为了训练待训练模型,可在采集一批训练数据。具体地,对于每个偏微分方程,可在该 偏微分方程的待求解区域上采集训练数据,即获取该偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入值位于该偏微分方程的待求解区域的边界上,N≥1。
704、根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N。
对于每个偏微分方程,可根据该偏微分方程的基本解对该偏微分方程的第一输入值和该偏微分方程的第i个第二输入值进行处理,得到第i个第一输出值。如此一来,可得到每个偏微分方程的N个第一输出值。
在一种可能的实现方式中,对于每个偏微分方程,将该偏微分方程的第一输入值和该偏微分方程的第i个第二输入值,代入偏微分方程的基本解,得到该偏微分方程的第i个第一输出值。如此一来,则可以得到该偏微分方程的N个第一输出值。
在另一种可能的实现方式中,对于每个偏微分方程,将该偏微分方程的基本解对该偏微分方程的待求解区域的边界的外法向量求导,得到目标导数。然后,将该偏微分方程的第一输入值和该偏微分方程的第i个第二输入值代入目标导数,得到该偏微分方程的第i个第一输出值。如此一来,则可以得到该偏微分方程的N个第一输出值。
关于步骤702至步骤704的说明,可参考前述图4实施例中步骤402至步骤404的相关说明部分,此处不再赘述。
705、通过待训练模型对第i个第二输入值和目标任务的参数进行处理,得到第i个第二输出值。
由于每个偏微分方程的解,均可以用边界积分形式进行表示,该边界积分表达式的被积函数包含该偏微分方程的基本解以及该偏微分方程的边界密度函数。
那么,可以通过待训练模型表示多个偏微分方程的边界密度函数,并对其进行训练。
具体地,在每个偏微分方程的N个第二输入值中,对于任意一个第二输入值,即第i个第二输入值,可将第i个第二输入值以及该偏微分方程所描述的目标任务的参数输入至待训练模型,以通过待训练模型对第i个第二输入值和该参数进行处理,得到第i个第二输出值。
依旧如上述例子,设描述第一个目标任务的偏微分方程的N个第二输入值为y′y′ 1,y′ 2,...,y′ N,描述第二个目标任务的偏微分方程的N个第二输入值为y″y″ 1,y″ 2,...,y″ N
在y′y′ 1,y′ 2,...,y′ N中,可将y′ i和第一目标任务的参数θ 1(例如,锐角三角形部件的重心坐标等等)输入至待训练模型,以使得待训练模型对y′ 1和θ 1,得到h(y′ i)。
在y″y″ 1,y″ 2,...,y″ N中,可将y″ i和第二目标任务的参数θ 2(例如,直角三角形部件的重心坐标等等)输入至待训练模型,以使得待训练模型对y″ i和θ 2进行一系列运算,得到h(y″ i)。
如此一来,可得到每个偏微分方程的N个第二输出值,即h(y′ 1),...,h(y′ N)和h(y″ 1),...,h(y″ N)。
706、根据N个第一输出值以及N个第二输出值,获取第三输出值。
得到每个偏微分方程的N个第一输出值以及N个第二输出值,可对该偏微分方程的N个第一输出值以及N个第二输出值进行计算,得到该偏微分方程的第三输出值。
在一种可能的实现方式中,对于每个偏微分方程,可将该偏微分方程的第i个第一输出值与该偏微分方程的第i个第二输出值进行相乘处理,得到该偏微分方程的第i个第四输出值。然后,将该偏微分方程的N个第四输出值进行加权求和处理,得到该偏微分方程的第三输出值。
707、根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。
得到每个偏微分方程的第三输出值后,可将该偏微分方程的第一输入值代入至该偏微分方程的边界条件,从而得到该偏微分方程的第五输出值。
然后,根据每个偏微分方程的第三输出值和第五输出值进行计算,以得到目标损失,目标损失可用于描述所有偏微分方程的第三输出值和第五输出值之间的差异。
708、根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
得到目标损失后,可根据目标损失对待训练模型的参数进行更新,并利用下一批训练数据对更新参数后的待训练模型进行训练(即重新执行步骤703至步骤707),直至满足模型训练条件(例如,目标损失达到收敛等等),得到目标神经网络。
关于步骤706至步骤708的说明,可参考前述图4实施例中步骤406至步骤408的相关说明部分,此处不再赘述。
此外,为了验证本申请实施例的方法所得到的目标神经网络的性能,可通过选择100个三角形构建100个仿真任务,并计算基于100个仿真任务的参数训练得到的模型,在应用阶段所输出的结果的相对误差,实验结果如图8所示(图8为本申请实施例提供的实验结果的一个示意图),可见,大约一半的三角形的上解的相对误差小于1%,98%的三角形的相对误差小于4%,这说明本申请实施例提供的方法虽然无法遍历所有的三角形,但是对于训练区域内的不同三角形都能有较好的结果,这体现了神经网络强大的表示能力和良好的泛化能力。
本申请实施例中,在对待训练模型进行训练的过程中,可令待训练模型学习到不同目标任务的参数,以使得训练得到的目标神经网络在实际应用过程中,可对同一领域的不同目标任务(仿真任务)进行处理,如此一来,不仅可提高模型训练的效率,还可以使得目标神经网络具备对不同任务的处理能力,即对不同偏微分方程的求解能力。
以上是对第二种情况中的目标神经网络的训练阶段进行的详细说明,以下将对第二种情况中的目标神经网络的应用阶段进行介绍。图9为本申请实施例提供的偏微分方程求解方法的另一流程示意图,如图9所示,该方法包括:
901、获取待处理的目标任务的参数。
902、根据参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件,偏微分方程用于描述目标任务。
关于步骤901和步骤902的说明,可参考前述图7实施例中步骤701和步骤702的相关说明部分,此处不再赘述。
903、获取偏微分方程的第一输入值和N个第二输入值,第一输入值位于偏微分方程的待求解区域中,N个第二输入值位于待求解区域的边界上,N≥1。
关于步骤903的说明,可参考前述图7实施例中步骤703的相关说明部分,此处不再赘 述。需要说明的是,应用阶段的步骤903和训练阶段的步骤703的区别在于:步骤903中每个偏微分方程的第一输入值位于该偏微分方程的待求解区域中,其既可以待求解区域内部的点,也可以是待求解区域的边界上的点。而步骤703中每个偏微分方程的的第一输入值位于该偏微分方程的待求解区域的边界上,其仅可是待求解区域的边界上的点。
904、根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N。
在一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在另一种可能的实现方式中,根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。
905、通过目标神经网络对第i个第二输入值和目标任务的参数进行处理,得到第i个第二输出值。
906、根据N个第一输出值以及N个第二输出值,获取第三输出值,第三输出值作为偏微分方程中与第一输入值对应的解。
在一种可能的实现方式中,根据N个第一输出值以及N个第二输出值,获取第三输出值包括:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
关于步骤904至步骤906的说明,可参考前述图7实施例中步骤704至步骤706的相关说明部分,此处不再赘述。
本申请实施例中的目标神经网络具备对同一领域中不同任务的处理能力,即对不同偏微分方程的求解能力。
以上是对本申请实施例提供的模型训练方法和偏微分方程求解方法所进行的详细说明,以下将对本申请实施例提供的偏微分方程求解装置和模型训练装置分别进行介绍。图10为本申请实施例提供的偏微分方程求解装置的一个结构示意图。如图10所示,该装置包括:
第一获取模块1001,用于获取偏微分方程的第一输入值和N个第二输入值,第一输入值位于偏微分方程的待求解区域中,N个第二输入值位于待求解区域的边界上,N≥1,偏微分方程用于描述待处理的目标任务;
第一处理模块1002,用于根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N;
第二处理模块1003,用于通过目标神经网络对第i个第二输入值进行处理,得到第i个第二输出值;
第二获取模块1004,用于根据N个第一输出值以及N个第二输出值,获取第三输出值,第三输出值作为偏微分方程中与第一输入值对应的解。
本申请实施例中,通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表 达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过目标神经网络表示偏微分方程的边界密度函数。相较于偏微分方程本身,偏微分方程的边界密度函数较为简单,用于表示偏微分方程的边界密度函数的神经网络在对输入值进行处理后,可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
在一种可能的实现方式中,第一处理模块1002,用于将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在一种可能的实现方式中,第一处理模块1002,用于:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。
在一种可能的实现方式中,第二获取模块1004,用于:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
在一种可能的实现方式中,该装置还包括:第三获取模块,用于获取待处理的目标任务的参数;构建模块,用于根据参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件。
在一种可能的实现方式中,第二处理模块1003,用于通过目标神经网络对第i个第二输入值和参数进行处理,得到第i个第二输出值。
图11为本申请实施例提供的模型训练装置的一个结构示意图。如图11所示,该装置包括:
第一获取模块1101,用于获取偏微分方程的第一输入值和N个第二输入值,第一输入值和N个第二输入值位于偏微分方程的待求解区域的边界上,N≥1,偏微分方程用于描述待处理的目标任务;
第一处理模块1102,用于根据偏微分方程的基本解对第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,...,N;
第二处理模块1103,用于通过待训练模型对第i个第二输入值进行处理,得到第i个第二输出值;
第二获取模块1104,用于根据N个第一输出值以及N个第二输出值,获取第三输出值;
第三获取模块1105,用于根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的;
更新模块1106,用于根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
本申请实施例中,通过将偏微分方程的解以边界积分形式进行表达,由于该边界积分表达式中包含偏微分方程的基本解和偏微分方程的边界密度函数,故可通过待训练模型表示偏微分方程的边界密度函数,并对其进行训练。在模型的训练过程中,在获取偏微分方程的第一输入值和第二输入值后,可根据偏微分方程的基本解对第一输入值和第二输入值进行处理, 得到第一输出值。接着,通过待训练模型对第二输入值进行处理,得到第二输出值。然后,根据第一输出值以及第二输出值,获取第三输出值。随后,根据第三输出值以及第五输出值,获取目标损失,目标损失用于指示第三输出值以及第五输出值之间的差异,第五输出值为将第一输入值代入偏微分方程的边界条件所得到的。最后,根据目标损失更新待训练模型的参数,直至满足模型训练条件,得到目标神经网络。前述过程中,由于待训练模型表示偏微分方程的边界密度函数,该边界密度函数为偏微分方程的解的边界积表达式中的一部分,故在获取用于训练待训练模型的第二输入值(训练数据)时,只需在待求解区域(无论该区域为有限区域还是无穷区域)的边界上采集第二输入值即可。如此一来,即使采集有限数量的训练数据,这些数据也可充分表征整个待求解区域。基于这些数据训练得到的目标神经网络,在对偏微分方程的待求解区域中任意一个输入值进行处理后,均可输出具备足够准确度的中间输出值,基于该中间输出值可精准确定最终输出值(基于边界积分计算的原理),作为偏微分方程中与该输入值对应的解。
在一种可能的实现方式中,第一处理模块1102,用于将第一输入值和第i个第二输入值,代入偏微分方程的基本解,得到第i个第一输出值。
在一种可能的实现方式中,第一处理模块1102,用于:将偏微分方程的基本解对待求解区域的边界的外法向量求导,得到目标导数;将第一输入值和第i个第二输入值代入目标导数,得到第i个第一输出值。
在一种可能的实现方式中,第二获取模块1104,用于:将第i个第一输出值与第i个第二输出值进行相乘处理,得到第i个第四输出值;将N个第四输出值进行加权求和处理,得到第三输出值。
在一种可能的实现方式中,该装置还包括:第四获取模块,用于获取待处理的目标任务的参数;构建模块,用于根据参数构建偏微分方程、偏微分方程的待求解区域以及偏微分方程的边界条件。
在一种可能的实现方式中,第二处理模块1103,用于通过待训练模型对第i个第二输入值和参数进行处理,得到第i个第二输出值。
需要说明的是,上述装置各模块/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其带来的技术效果与本申请方法实施例相同,具体内容可参考本申请实施例前述所示的方法实施例中的叙述,此处不再赘述。
本申请实施例还涉及一种执行设备,图12为本申请实施例提供的执行设备的一个结构示意图。如图12所示,执行设备1200具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1200上可部署有图10对应实施例中所描述的偏微分方程求解装置,用于实现图6或图9对应实施例中求解偏微分方程的功能。具体的,执行设备1200包括:接收器1201、发射器1202、处理器1203和存储器1204(其中执行设备1200中的处理器1203的数量可以一个或多个,图12中以一个处理器为例),其中,处理器1203可以包括应用处理器12031和通信处理器12032。在本申请的一些实施例中,接收器1201、发射器1202、处理器1203和存储器1204可通过总线或其它方式连接。
存储器1204可以包括只读存储器和随机存取存储器,并向处理器1203提供指令和数据。 存储器1204的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器1204存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器1203控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器1203中,或者由处理器1203实现。处理器1203可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1203中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1203可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1203可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1204,处理器1203读取存储器1204中的信息,结合其硬件完成上述方法的步骤。
接收器1201可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1202可用于通过第一接口输出数字或字符信息;发射器1202还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1202还可以包括显示屏等显示设备。
本申请实施例中,在一种情况下,处理器1203,用于通过图6或图9对应实施例中的目标神经网络,对偏微分方程进行求解。
本申请实施例还涉及一种训练设备,图13为本申请实施例提供的训练设备的一个结构示意图。如图13所示,训练设备1300由一个或多个服务器实现,训练设备1300可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1314(例如,一个或一个以上处理器)和存储器1332,一个或一个以上存储应用程序1342或数据1344的存储介质1330(例如一个或一个以上海量存储设备)。其中,存储器1332和存储介质1330可以是短暂存储或持久存储。存储在存储介质1330的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1314可以设置为与存储介质1330通信,在训练设备1300上执行存储介质1330中的一系列指令操作。
训练设备1300还可以包括一个或一个以上电源1326,一个或一个以上有线或无线网络接口1350,一个或一个以上输入输出接口1358;或,一个或一个以上操作系统1341,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
具体的,训练设备可以执行图4或图7对应实施例中的模型训练方法。
本申请实施例还涉及一种计算机存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例还涉及一种计算机程序产品,该计算机程序产品存储有指令,该指令在由计算机执行时使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
具体的,请参阅图14,图14为本申请实施例提供的芯片的一个结构示意图,所述芯片可以表现为神经网络处理器NPU 1400,NPU 1400作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1403,通过控制器1404控制运算电路1403提取存储器中的矩阵数据并进行乘法运算。
在一些实现中,运算电路1403内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1403是二维脉动阵列。运算电路1403还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1403是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1402中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1401中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1408中。
统一存储器1406用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1405,DMAC被搬运到权重存储器1402中。输入数据也通过DMAC被搬运到统一存储器1406中。
BIU为Bus Interface Unit即,总线接口单元1413,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1409的交互。
总线接口单元1413(Bus Interface Unit,简称BIU),用于取指存储器1409从外部存储器获取指令,还用于存储单元访问控制器1405从外部存储器获取输入矩阵A或者权重矩阵B的原数据。
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1406或将权重数据搬运到权重存储器1402中或将输入数据数据搬运到输入存储器1401中。
向量计算单元1407包括多个运算处理单元,在需要的情况下,对运算电路1403的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对预测标签平面进行上采样等。
在一些实现中,向量计算单元1407能将经处理的输出的向量存储到统一存储器1406。例如,向量计算单元1407可以将线性函数;或,非线性函数应用到运算电路1403的输出,例如对卷积层提取的预测标签平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1407生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1403的激活输入,例如用于在神经网络中的后续层中的使用。
控制器1404连接的取指存储器(instruction fetch buffer)1409,用于存储控制器1404使用的指令;
统一存储器1406,输入存储器1401,权重存储器1402以及取指存储器1409均为On-Chip存储器。外部存储器私有于该NPU硬件架构。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电 缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (27)

  1. 一种偏微分方程求解方法,其特征在于,所述方法包括:
    获取偏微分方程的第一输入值和N个第二输入值,所述第一输入值位于所述偏微分方程的待求解区域中,所述N个第二输入值位于所述待求解区域的边界上,N≥1,所述偏微分方程用于描述待处理的目标任务;
    根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,…,N;
    通过目标神经网络对所述第i个第二输入值进行处理,得到第i个第二输出值;
    根据N个第一输出值以及N个第二输出值,获取第三输出值,所述第三输出值作为所述偏微分方程中与所述第一输入值对应的解。
  2. 根据权利要求1所述的方法,其特征在于,根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:
    将所述第一输入值和第i个第二输入值,代入所述偏微分方程的基本解,得到第i个第一输出值。
  3. 根据权利要求1所述的方法,其特征在于,根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:
    将所述偏微分方程的基本解对所述待求解区域的边界的外法向量求导,得到目标导数;
    将所述第一输入值和第i个第二输入值代入所述目标导数,得到第i个第一输出值。
  4. 根据权利要求2或3所述的方法,其特征在于,所述根据N个第一输出值以及N个第二输出值,获取第三输出值包括:
    将所述第i个第一输出值与所述第i个第二输出值进行相乘处理,得到第i个第四输出值;
    将N个第四输出值进行加权求和处理,得到第三输出值。
  5. 根据权利要求1至4任意一项所述的方法,其特征在于,所述获取偏微分方程的第一输入值和N个第二输入值之前,所述方法还包括:
    获取待处理的目标任务的参数;
    根据所述参数构建所述偏微分方程、所述偏微分方程的待求解区域以及所述偏微分方程的边界条件。
  6. 根据权利要求5所述的方法,其特征在于,所述通过目标神经网络对所述第i个第二输入值进行处理,得到第i个第二输出值包括:
    通过目标神经网络对所述第i个第二输入值和所述参数进行处理,得到第i个第二输出值。
  7. 一种模型训练方法,其特征在于,所述方法包括:
    获取偏微分方程的第一输入值和N个第二输入值,所述第一输入值和所述N个第二输入值位于所述偏微分方程的待求解区域的边界上,N≥1,所述偏微分方程用于描述待处理的目标任务;
    根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,…,N;
    通过待训练模型对所述第i个第二输入值进行处理,得到第i个第二输出值;
    根据N个第一输出值以及N个第二输出值,获取第三输出值;
    根据所述第三输出值以及第五输出值,获取目标损失,所述目标损失用于指示所述第三输出值以及所述第五输出值之间的差异,所述第五输出值为将所述第一输入值代入所述偏微分方程的边界条件所得到的;
    根据所述目标损失更新所述待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
  8. 根据权利要求7所述的方法,其特征在于,根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:
    将所述第一输入值和第i个第二输入值,代入所述偏微分方程的基本解,得到第i个第一输出值。
  9. 根据权利要求7所述的方法,其特征在于,根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值包括:
    将所述偏微分方程的基本解对所述待求解区域的边界的外法向量求导,得到目标导数;
    将所述第一输入值和第i个第二输入值代入所述目标导数,得到第i个第一输出值。
  10. 根据权利要求8或9所述的方法,其特征在于,所述根据N个第一输出值以及N个第二输出值,获取第三输出值包括:
    将所述第i个第一输出值与所述第i个第二输出值进行相乘处理,得到第i个第四输出值;
    将N个第四输出值进行加权求和处理,得到第三输出值。
  11. 根据权利要求7至10任意一项所述的方法,其特征在于,所述获取偏微分方程的第一输入值和N个第二输入值之前,所述方法还包括:
    获取待处理的目标任务的参数;
    根据所述参数构建所述偏微分方程、所述偏微分方程的待求解区域以及所述偏微分方程的边界条件。
  12. 根据权利要求11所述的方法,其特征在于,所述通过待训练模型对所述第i个第二输入值进行处理,得到第i个第二输出值包括:
    通过待训练模型对所述第i个第二输入值和所述参数进行处理,得到第i个第二输出值。
  13. 一种偏微分方程求解装置,其特征在于,所述装置包括:
    第一获取模块,用于获取偏微分方程的第一输入值和N个第二输入值,所述第一输入值位于所述偏微分方程的待求解区域中,所述N个第二输入值位于所述待求解区域的边界上,N≥1,所述偏微分方程用于描述待处理的目标任务;
    第一处理模块,用于根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,…,N;
    第二处理模块,用于通过目标神经网络对所述第i个第二输入值进行处理,得到第i个第二输出值;
    第二获取模块,用于根据N个第一输出值以及N个第二输出值,获取第三输出值,所述第三输出值作为所述偏微分方程中与所述第一输入值对应的解。
  14. 根据权利要求13所述的装置,其特征在于,所述第一处理模块,用于将所述第一输入值和第i个第二输入值,代入所述偏微分方程的基本解,得到第i个第一输出值。
  15. 根据权利要求13所述的装置,其特征在于,所述第一处理模块,用于:
    将所述偏微分方程的基本解对所述待求解区域的边界的外法向量求导,得到目标导数;
    将所述第一输入值和第i个第二输入值代入所述目标导数,得到第i个第一输出值。
  16. 根据权利要求14或15所述的装置,其特征在于,所述第二获取模块,用于:
    将所述第i个第一输出值与所述第i个第二输出值进行相乘处理,得到第i个第四输出值;
    将N个第四输出值进行加权求和处理,得到第三输出值。
  17. 根据权利要求13至16任意一项所述的装置,其特征在于,所述装置还包括:
    第三获取模块,用于获取待处理的目标任务的参数;
    构建模块,用于根据所述参数构建所述偏微分方程、所述偏微分方程的待求解区域以及所述偏微分方程的边界条件。
  18. 根据权利要求17所述的装置,其特征在于,所述第二处理模块,用于通过目标神经网络对所述第i个第二输入值和所述参数进行处理,得到第i个第二输出值。
  19. 一种模型训练装置,其特征在于,所述装置包括:
    第一获取模块,用于获取偏微分方程的第一输入值和N个第二输入值,所述第一输入值和所述N个第二输入值位于所述偏微分方程的待求解区域的边界上,N≥1,所述偏微分方程用于描述待处理的目标任务;
    第一处理模块,用于根据所述偏微分方程的基本解对所述第一输入值和第i个第二输入值进行处理,得到第i个第一输出值,i=1,…,N;
    第二处理模块,用于通过待训练模型对所述第i个第二输入值进行处理,得到第i个第二输出值;
    第二获取模块,用于根据N个第一输出值以及N个第二输出值,获取第三输出值;
    第三获取模块,用于根据所述第三输出值以及第五输出值,获取目标损失,所述目标损失用于指示所述第三输出值以及所述第五输出值之间的差异,所述第五输出值为将所述第一输入值代入所述偏微分方程的边界条件所得到的;
    更新模块,用于根据所述目标损失更新所述待训练模型的参数,直至满足模型训练条件,得到目标神经网络。
  20. 根据权利要求19所述的装置,其特征在于,第一处理模块,用于将所述第一输入值和第i个第二输入值,代入所述偏微分方程的基本解,得到第i个第一输出值。
  21. 根据权利要求19所述的装置,其特征在于,第一处理模块,用于:
    将所述偏微分方程的基本解对所述待求解区域的边界的外法向量求导,得到目标导数;
    将所述第一输入值和第i个第二输入值代入所述目标导数,得到第i个第一输出值。
  22. 根据权利要求20或21所述的装置,其特征在于,所述第二获取模块,用于:
    将所述第i个第一输出值与所述第i个第二输出值进行相乘处理,得到第i个第四输出值;
    将N个第四输出值进行加权求和处理,得到第三输出值。
  23. 根据权利要求19至22任意一项所述的装置,其特征在于,所述装置还包括:
    第四获取模块,用于获取待处理的目标任务的参数;
    构建模块,用于根据所述参数构建所述偏微分方程、所述偏微分方程的待求解区域以及所述偏微分方程的边界条件。
  24. 根据权利要求23所述的装置,其特征在于,所述第二处理模块,用于通过待训练模型对所述第i个第二输入值和所述参数进行处理,得到第i个第二输出值。
  25. 一种偏微分方程求解装置,其特征在于,所述装置包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为执行所述代码,当所述代码被执行时,所述偏微分方程求解装置执行如权利要求1至12任一所述的方法。
  26. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至12任一所述的方法。
  27. 一种计算机程序产品,其特征在于,所述计算机程序产品存储有指令,所述指令在由计算机执行时,使得所述计算机实施权利要求1至12任意一项所述的方法。
PCT/CN2022/118577 2021-09-28 2022-09-14 一种偏微分方程求解方法及其相关设备 WO2023051236A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111146738.5 2021-09-28
CN202111146738.5A CN115878947A (zh) 2021-09-28 2021-09-28 一种偏微分方程求解方法及其相关设备

Publications (1)

Publication Number Publication Date
WO2023051236A1 true WO2023051236A1 (zh) 2023-04-06

Family

ID=85755833

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/118577 WO2023051236A1 (zh) 2021-09-28 2022-09-14 一种偏微分方程求解方法及其相关设备

Country Status (2)

Country Link
CN (1) CN115878947A (zh)
WO (1) WO2023051236A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110244817A (zh) * 2019-05-18 2019-09-17 南京惟心光电系统有限公司 一种基于光电计算阵列的偏微分方程求解器及其方法
US20200074295A1 (en) * 2018-09-04 2020-03-05 International Business Machines Corporation Deep learning for partial differential equation (pde) based models
CN112784205A (zh) * 2021-01-30 2021-05-11 西安电子科技大学 偏微分方程数据处理方法、系统、存储介质、设备及应用
CN113297534A (zh) * 2021-07-12 2021-08-24 东南大学 一种基于双神经网络框架的等离子体方程数值计算方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200074295A1 (en) * 2018-09-04 2020-03-05 International Business Machines Corporation Deep learning for partial differential equation (pde) based models
CN110244817A (zh) * 2019-05-18 2019-09-17 南京惟心光电系统有限公司 一种基于光电计算阵列的偏微分方程求解器及其方法
CN112784205A (zh) * 2021-01-30 2021-05-11 西安电子科技大学 偏微分方程数据处理方法、系统、存储介质、设备及应用
CN113297534A (zh) * 2021-07-12 2021-08-24 东南大学 一种基于双神经网络框架的等离子体方程数值计算方法

Also Published As

Publication number Publication date
CN115878947A (zh) 2023-03-31

Similar Documents

Publication Publication Date Title
WO2022022274A1 (zh) 一种模型训练方法及装置
WO2022068623A1 (zh) 一种模型训练方法及相关设备
CN112183718A (zh) 一种用于计算设备的深度学习训练方法和装置
WO2023274052A1 (zh) 一种图像分类方法及其相关设备
WO2021129668A1 (zh) 训练神经网络的方法和装置
WO2022179586A1 (zh) 一种模型训练方法及其相关联设备
WO2023083030A1 (zh) 一种姿态识别方法及其相关设备
WO2022179603A1 (zh) 一种增强现实方法及其相关设备
WO2024001806A1 (zh) 一种基于联邦学习的数据价值评估方法及其相关设备
WO2024160186A1 (zh) 一种模型训练方法及其相关设备
WO2024199404A1 (zh) 一种消费预测方法及其相关设备
WO2024179485A1 (zh) 一种图像处理方法及其相关设备
CN114169393A (zh) 一种图像分类方法及其相关设备
CN111652349A (zh) 一种神经网络的处理方法及相关设备
WO2024061123A1 (zh) 一种图像处理方法及其相关设备
CN113627421B (zh) 一种图像处理方法、模型的训练方法以及相关设备
WO2023246735A1 (zh) 一种项目推荐方法及其相关设备
WO2023197857A1 (zh) 一种模型切分方法及其相关设备
WO2023045949A1 (zh) 一种模型训练方法及其相关设备
WO2023185541A1 (zh) 一种模型训练方法及其相关设备
WO2023020185A1 (zh) 一种图像分类方法及其相关设备
WO2023273934A1 (zh) 一种模型超参数的选择方法及相关装置
WO2023051236A1 (zh) 一种偏微分方程求解方法及其相关设备
CN114998643A (zh) 类别描述的特征信息的获取方法、图像的处理方法及设备
WO2023236900A1 (zh) 一种项目推荐方法及其相关设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22874623

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22874623

Country of ref document: EP

Kind code of ref document: A1