Inference Method, Apparatus, Device, and Medium for Symbolic Expressions

By generating an expression tree and performing post-order traversal, and processing symbol expressions in combination with the cache mechanism, the problem of low processing efficiency of symbol expressions in the existing technology is solved, and more efficient symbol expression inference is achieved.

CN117744799BActive Publication Date: 2025-05-30BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311767964.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-20
Publication Date
2025-05-30
Estimated Expiration
2043-12-20

AI Technical Summary

Technical Problem

In the prior art, the processing efficiency of symbolic expressions is low, resulting in large calculation overhead and low inference efficiency.

Method used

By generating the expression tree of the target symbol expression and performing a post-order traversal of the expression tree, a sequence of pending nodes is obtained. The nodes in the node sequence to be processed are processed in turn, and the calculation results are judged whether the calculation results of the operation node have been cached. When they are not cached, the calculation reasoning is performed and the results are cached.

Benefits of technology

By caching the calculation results, repeated calculations are avoided, the inference efficiency of symbolic expressions is improved, and the calculation overhead is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117744799B_ABST
    Figure CN117744799B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, apparatus, device, and medium for inferring symbolic expressions, which relates to the field of artificial intelligence technologies, and particularly relates to technologies such as deep learning. The method includes: generating an expression tree of a target symbolic expression, where the expression tree includes a plurality of nodes, and the plurality of nodes include at least one operation node and at least one variable node; performing a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; sequentially processing the nodes in the sequence of nodes to be processed, including: in response to determining that the currently processed node is an operation node, determining whether the operation result corresponding to the operation node has been cached; in response to determining that the operation result corresponding to the operation node has not been cached, performing operation inference on the operation node; and caching the operation result of the operation node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technologies, and in particular to technologies such as deep learning. Specifically, it relates to a method for reasoning about symbolic expressions, a device for reasoning about symbolic expressions, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] Artificial intelligence is a discipline that studies enabling a computer to simulate certain human thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level technologies and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include several major directions such as natural language processing technology, computer vision technology, speech recognition technology, and machine learning / deep learning, big data processing technology, and knowledge graph technology.

[0003] Symbolic computation, also known as a computer symbolic model, is a method of representing problems in a computer using symbols rather than conventional numerical values. It abstracts conventional computational problems using symbols, enabling the computer to automatically identify, process, and reason about these problems. In symbolic computation, mathematical objects are precisely represented rather than approximated, and uncomputed mathematical expressions are retained in symbolic form.

[0004] The methods described in this section are not necessarily methods that have been previously conceived or adopted. Unless otherwise specified, no method described in this section should be considered prior art solely because it is included in this section. Similarly, unless otherwise specified, the problems mentioned in this section should not be considered to have been recognized in any prior art. Summary of the Invention

[0005] The present disclosure provides a method for reasoning about symbolic expressions, a device for reasoning about symbolic expressions, an electronic device, a computer-readable storage medium, and a computer program product.

[0006] According to one aspect of the present disclosure, there is provided a method for reasoning about symbolic expressions, including: generating an expression tree of a target symbolic expression, the expression tree including a plurality of nodes, the plurality of nodes including at least one operation node and at least one variable node; performing a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; sequentially processing the nodes in the sequence of nodes to be processed, including: in response to determining that the currently processed node is an operation node, determining whether the operation result corresponding to the operation node has been cached; in response to determining that the operation result corresponding to the operation node has not been cached, performing operation reasoning on the operation node; and caching the operation result of the operation node.

[0007] According to another aspect of the present disclosure, there is provided an inference device for symbolic expressions, including: a generation unit configured to generate an expression tree of a target symbolic expression, the expression tree including a plurality of nodes, the plurality of nodes including at least one operation node and at least one variable node; a traversal unit configured to perform a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; a processing unit configured to process the nodes in the sequence of nodes to be processed in turn, including: a determination subunit configured to, in response to determining that the currently processed node is an operation node, determine whether the operation result corresponding to the operation node has been cached; an operation subunit configured to, in response to determining that the operation result corresponding to the operation node has not been cached, perform operation inference on the operation node; and a caching subunit configured to cache the operation result of the operation node.

[0008] According to another aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above method.

[0009] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the above method.

[0010] According to another aspect of the present disclosure, there is provided a computer program product including a computer program, wherein the computer program implements the above method when executed by a processor.

[0011] According to one or more embodiments of the present disclosure, the present disclosure generates an expression tree of a target symbolic expression, performs a post-order traversal on the expression tree to obtain a sequence of nodes to be processed, and then determines whether the operation result of each operation node has been cached before processing each operation node in turn, and performs operation inference on the operation node and caches the operation result when it is determined that the operation result of the operation node has not been cached. By the above method, it is possible to facilitate subsequent operation nodes to directly use existing operation structures, avoid repeated calculation overhead, and improve the inference efficiency of symbolic expressions.

[0012] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings exemplarily illustrate embodiments and form a part of the specification, and are used together with the written description of the specification to explain the exemplary embodiments of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. In all the drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0014] Figure 1 A schematic diagram of an exemplary system in which various methods described herein can be implemented according to an embodiment of the present disclosure is shown;

[0015] Figure 2 A flowchart of a method for reasoning about symbolic expressions according to an embodiment of the present disclosure is shown;

[0016] Figure 3 A schematic diagram of an expression tree of a symbolic expression according to an embodiment of the present disclosure is shown;

[0017] Figure 4 A schematic diagram of an expression tree of a symbolic expression according to an embodiment of the present disclosure is shown;

[0018] Figure 5 A flowchart of a method for reasoning about symbolic expressions according to an embodiment of the present disclosure is shown;

[0019] Figure 6 A schematic diagram of the solution result of an elastic equation system for a three-dimensional connection member according to an embodiment of the present disclosure is shown;

[0020] Figure 7 A structural block diagram of an inference device for symbolic expressions according to an embodiment of the present disclosure is shown; and

[0021] Figure 8 A structural block diagram of an exemplary electronic device capable of implementing the embodiments of the present disclosure is shown. Detailed Embodiments

[0022] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0023] In the present disclosure, unless otherwise specified, the use of terms such as "first" and "second" to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements. Such terms are only used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of the element, and in certain cases, based on the context description, they may also refer to different instances.

[0024] In the description of the various examples in the present disclosure, the terms used are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element may be one or more. In addition, the term "and / or" used in the present disclosure covers any one and all possible combinations of the listed items.

[0025] In the related art, the processing efficiency of symbolic expressions is low.

[0026] To solve the above problems, the present disclosure generates an expression tree of a target symbolic expression, performs a post-order traversal on the expression tree to obtain a sequence of nodes to be processed, and then determines whether the operation result of each operation node has been cached before processing each operation node in turn. When it is determined that the operation result of the operation node has not been cached, the operation node is subjected to operation reasoning, and the operation result is cached. By the above method, it is possible to facilitate subsequent operation nodes to directly use the existing operation structures, avoid repeated calculation overhead, and improve the reasoning efficiency of symbolic expressions.

[0027] Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0028] Figure 1 FIG. shows a schematic diagram of an exemplary system 100 in which the various methods and apparatuses described herein can be implemented according to an embodiment of the present disclosure. Refer to Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 that couple the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.

[0029] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable the methods of the present disclosure to be executed.

[0030] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtual environments and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software-as-a-service (SaaS) model.

[0031] In Figure 1 the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or a combination thereof that may be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with server 120 to utilize the services provided by these components. It should be understood that various different system configurations are possible, which may be different from system 100. Thus, Figure 1 is an example of a system for implementing the various methods described herein and is not intended to be limiting.

[0032] Users may use client devices 101, 102, 103, 104, 105, and / or 106 to perform human-computer interactions. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via this interface. Although Figure 1 only six client devices are depicted, those skilled in the art will be able to understand that the present disclosure may support any number of client devices.

[0033] Client devices 101, 102, 103, 104, 105, and / or 106 can include various types of computing devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices, etc. These computing devices can run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux, or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT WindowsMobile OS, iOS, Windows Phone, Android. Portable handheld devices can include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices can include head-mounted displays (such as smart glasses) and other devices. Gaming systems can include various handheld gaming devices, Internet-enabled gaming devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.

[0034] Network 110 can be any type of network known to those skilled in the art, which can support data communication using any one of a variety of available protocols (including but not limited to TCP / IP, SNA, IPX, etc.). By way of example only, one or more networks 110 can be a local area network (LAN), an Ethernet-based network, token ring, wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (such as Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0035] Server 120 can include one or more general-purpose computers, dedicated server computers (such as PC (personal computer) servers, UNIX servers, midrange servers), blade servers, mainframes, server clusters, or any other suitable arrangement and / or combination. Server 120 can include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (such as one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for the server). In various embodiments, server 120 can run one or more services or software applications that provide the functions described below.

[0036] The computing unit in server 120 can run one or more operating systems including any of the above-mentioned operating systems and any commercially available server operating systems. Server 120 can also run any one of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0037] In some embodiments, server 120 can include one or more applications to analyze and merge data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 106. Server 120 can also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and / or 106.

[0038] In some embodiments, server 120 can be a server of a distributed system, or a server incorporating a blockchain. Server 120 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system to address the deficiencies of high management difficulty and weak business scalability existing in traditional physical hosts and virtual private server (VPS) services.

[0039] System 100 can also include one or more databases 130. In certain embodiments, these databases can be used to store data and other information. For example, one or more of databases 130 can be used to store information such as audio files and video files. Databases 130 can reside in various locations. For example, the databases used by server 120 can be local to server 120, or can be remote from server 120 and can communicate with server 120 via a network-based or dedicated connection. Databases 130 can be of different types. In certain embodiments, the databases used by server 120 can be relational databases, for example. One or more of these databases can store, update, and retrieve data to and from the databases in response to commands.

[0040] In certain embodiments, one or more of databases 130 can also be used by applications to store application data. The databases used by applications can be different types of databases, such as key-value repositories, object repositories, or conventional repositories supported by a file system.

[0041] Figure 1System 100 can be configured and operated in various ways to enable the application of various methods and devices described in this disclosure.

[0042] According to one aspect of the present disclosure, a method for reasoning about symbolic expressions is provided. Figure 2 A flowchart of a method 200 for reasoning about symbolic expressions according to an embodiment of the present disclosure is shown. Method 200 includes: step S201, generating an expression tree for a target symbolic expression, the expression tree including a plurality of nodes, the plurality of nodes including at least one operation node and at least one variable node; step S202, performing a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; step S203, processing the nodes in the sequence of nodes to be processed in turn, including: step S2031, in response to determining that the currently processed node is an operation node, determining whether the operation result corresponding to the operation node has been cached; step S2032, in response to determining that the operation result corresponding to the operation node has not been cached, performing operation reasoning on the operation node; and step S2033, caching the operation result of the operation node.

[0043] Thus, by generating an expression tree for a target symbolic expression and performing a post-order traversal on the expression tree to obtain a sequence of nodes to be processed, and then judging whether the operation result of each operation node has been cached before processing each operation node in turn, and performing operation reasoning on the operation node and caching the operation result when it is determined that the operation result of the operation node has not been cached. In the above manner, it is possible to facilitate subsequent operation nodes to directly use existing operation structures, avoid repeated calculation overhead, and improve the reasoning efficiency of symbolic expressions.

[0044] A symbolic expression generally refers to an expression that represents a mathematical object using symbols (such as variables, operators, functions, etc.). An exemplary symbolic expression can be:

[0045]

[0046] where u, v, w are the outputs of the function f(t, x, y) with respect to the function inputs t, x, y, represents the first-order differential of u with respect to x, represents the second-order differential of u with respect to x, and the same applies to the other differential terms.

[0047] In some embodiments, in step S201, the variables in the symbolic expression can be extracted first as variable nodes, and then these variables are used to establish corresponding tree edges layer by layer according to the operation relationships in the symbolic expression until the root node is reached, and finally an expression tree converted from the symbolic expression is obtained.

[0048] Figure 3A schematic diagram of an expression tree of a symbolic expression according to an embodiment of the present disclosure is shown. Figure 3 The expression tree in x is the expression tree of the above symbolic expression navier

[0049] In some embodiments, the expression tree may include multiple nodes, and the multiple nodes may include at least one operation node and at least one variable node. As Figure 3 shown, the leaf nodes of the expression tree are variable nodes, and the non-leaf nodes (including the root node) are all operation nodes. Two different types of nodes are connected by the calculation relationship corresponding to the operator to form an expression tree.

[0050] According to some embodiments, the target symbolic expression described in the present disclosure may be configured to cooperate with a neural network model to perform inference on at least one of the following multiple tasks: fluid mechanics simulation task, structural mechanics simulation task, thermodynamics simulation task, optimization design task, and physical equation inverse problem solving task. Specifically, the fluid mechanics simulation task may include a physical flow field solving task and an aerodynamic simulation task; the structural mechanics simulation task may include a static mechanics solving task; the thermodynamics simulation task may include a heat transfer simulation task; the optimization design task may include a topology optimization design task. It can be understood that the target symbolic expression may be configured to cooperate with a neural network model to perform inference on more physical simulation tasks, which is not limited herein.

[0051] In some embodiments, to perform the above tasks, an intermediate result may be generated based on the input data by using the corresponding neural network model. This intermediate result does not necessarily have a specific physical meaning, or this result cannot complete the above tasks. Therefore, based on the input data and this intermediate result, a specific equation (for example, a simulation equation, a topology optimization equation, a physical equation, etc.) is calculated to obtain an inference result. This process can be realized by the cooperation of the neural network model and the symbolic expression.

[0052] According to some embodiments, at least one operation node may include an operator node (OperatorNode), and the operator node is configured to perform four arithmetic operations, exponential operations, logarithmic operations, trigonometric function operations, extreme value operations, differential operations, integral operations, or numerical truncation operations.

[0053] Thus, by setting the above basic operator nodes, it is possible to support the operation and inference of more complex various equations.

[0054] In some embodiments, the target symbolic expression may include all variables included in the equation corresponding to the task to be performed, including the input data of the neural network model. The target symbolic expression may include nodes for calling the neural network model or implementing the inference of the neural network model.

[0055] According to some embodiments, at least one operation node may include a network layer node (LayerNode), and the network layer node is configured to receive one or more input variables of a neural network model and output one or more output variables of the neural network model.

[0056] Thus, by setting the network layer node, the neural network model can be deeply coupled with the symbolic expression, improving the efficiency of task inference.

[0057] According to some embodiments, at least one variable node may include a constant node and a parameter node. The constant node (ConstantNode) may be configured to store a fixed constant. The parameter node (ParameterNode) may be configured to store learnable parameters that participate in the optimization of the neural network model but do not belong to the neural network model.

[0058] Thus, by separately setting the constant node and the parameter node, better task inference can be achieved.

[0059] According to some embodiments, at least one operation node may include a gradient truncation node (DetachNode), and the gradient truncation node is configured to receive a variable value and output the variable value after gradient truncation.

[0060] Thus, by setting the gradient truncation node, the gradient truncation operation can be completed using the symbolic expression without developing a separate solution for this operation.

[0061] Figure 4 A schematic diagram of an expression tree of a symbolic expression according to an embodiment of the present disclosure is shown. Figure 4 The symbolic expression corresponding to the expression tree in is:

[0062] -sigma_zz(x,y,z)+Derivative(u(x,y,z),x)+Derivative(v(x,y,z),y)+5*Derivative(w(x,y,z),z)

[0063] This symbolic expression represents the elastic equation for three-dimensional connectors. Figure 4 The variables x, y, and z corresponding to the multiple leaf variable nodes at the bottom layer in are both the input variables of the symbolic expression and Figure 4Inputs of multiple network layer nodes u(x, y, z), v(x, y, z), and w(x, y, z) in the second layer. These three network layer nodes can correspond to three neural network models that work in cooperation with symbolic expressions. These three network layer nodes can output the inference results of the corresponding neural network models, namely u, v, and w. The variables x, y, z in the leaf nodes and the u, v, w output by the network layer nodes can be input into other operation nodes in the expression tree to obtain corresponding operation results. Finally, the root node of the expression tree outputs the result of the collaborative inference of the symbolic expression and the neural network model.

[0064] In some embodiments, in step S202, by performing a post-order traversal on the expression tree, a plurality of nodes arranged in post-order traversal can be obtained, that is, a sequence of nodes to be processed.

[0065] According to some embodiments, Figure 5 FIG. shows a flowchart of an inference method 500 for a symbolic expression according to an embodiment of the present disclosure. The operations of steps S501 - step S502 and step S504 and their sub-steps in method 500 can respectively refer to the descriptions of steps S201 - step S203 and their sub-steps in method 200 above. Method 500 may include: step S503. Before sequentially processing the nodes in the sequence of nodes to be processed, duplicate elimination is performed on the sequence of nodes to be processed, including: step S5031. Duplicate elimination is performed on the same variable nodes in the sequence of nodes to be processed, and the variable node that appears first in the same variable nodes is retained; and step S5032. Duplicate elimination is performed on the same operation nodes in the sequence of nodes to be processed, and the operation node that appears first in the same operation nodes is retained. The same operation nodes include the root nodes of exactly the same subtrees in the expression tree.

[0066] Thus, through the above method, during the process of inferring the target symbolic expression, it is only necessary to perform a read operation on the variables corresponding to the same variable nodes once, and perform an operation operation or a read operation on the same operation nodes once, avoiding duplicate read overhead and calculation overhead, and improving the inference efficiency of the symbolic expression. In some embodiments, in step S203, the nodes in the sequence of nodes to be processed are sequentially processed to obtain the processing result (for example, the operation result) of the symbolic expression.

[0067] In some embodiments, in step S203, different processing can be performed on operation nodes and variable nodes. In step S2031, in response to determining that the currently processed node is an operation node, it can be determined whether the operation result corresponding to the operation node has been cached. If not cached, step S2032 can be executed to perform operation inference on the operation node, and step S2033 can be executed to cache the operation node so that subsequent identical operation nodes can directly use the existing operation results.

[0068] In some embodiments, in step S2032, when performing operation inference on an operation node, all inputs corresponding to the operation node can be read from the cache. Since the nodes in the sequence of nodes to be processed are arranged in the post-order traversal order of the expression tree, all inputs of the operation node have been calculated and stored in the cache.

[0069] In some embodiments, after obtaining the sequence of nodes to be processed, it can also be determined how the operation results of each operation node are used by other nodes. Then, after the operation inference is completed, in step S2023, based on how the operation results of the operation node are used by other nodes, it can be determined whether to skip caching the operation results of the operation node. In this way, the number of cached operation results can be reduced, thereby saving the use of cache space.

[0070] In an exemplary embodiment, it can be determined the number of times the operation result of each operation node is used by other nodes, and when the number is less than a preset threshold, caching the operation result of the operation node can be skipped.

[0071] According to some embodiments, step S2031, in response to determining that the currently processed node is an operation node, determining whether the operation result corresponding to the operation node has been cached can include: using the sub-symbolic expression corresponding to the operation node as a keyword to determine whether the operation result corresponding to the operation node has been cached. Step S2033, caching the operation result of the operation node can include: using the sub-symbolic expression corresponding to the operation node as a keyword to cache the operation result of the operation node.

[0072] Thus, by using the sub-symbolic expression corresponding to the operation node as a keyword, fast reading of the operation result of the operation node can be achieved, and due to the uniqueness of the sub-symbolic expression, accurate operation results can be ensured.

[0073] In some embodiments, the sub-symbolic expression corresponding to an operation node can be the expression corresponding to the subtree with the operation node as the root node. The sub-symbolic expression can be converted into a string, and the string can be used as a keyword.

[0074] According to some embodiments, step S203 of sequentially processing the nodes in the node sequence to be processed may include: in response to determining that the operation result corresponding to the operation node has been cached, reading the cached operation result.

[0075] Thus, in the above manner, when the corresponding operation result has been cached, the operation result can be quickly obtained, avoiding repeated calculations and improving the inference efficiency of the symbolic expression tree.

[0076] According to some embodiments, step S203 of sequentially processing the nodes in the node sequence to be processed may include: in response to determining that the currently processed node is a variable node, reading the variable value corresponding to the variable node. For a variable node, the corresponding variable value can be directly read when it is processed. In some embodiments, before processing the nodes in the node sequence to be processed, the variable values of the variable nodes have been cached, so that when performing inference, the variable values of the variable nodes can be directly read.

[0077] In some embodiments, the same variable nodes in the node sequence to be processed are de-duplicated, and only the variable nodes that appear for the first time are retained. Therefore, when processing the node sequence to be processed, each variable node only needs to be read once.

[0078] In some embodiments, the inference method of the symbolic expression of the present disclosure can be encapsulated in a function, and the cache can be released after the function ends. After the inference of the symbolic expression is completed and before the cache is released, since the operation results corresponding to each operation node are still stored in the cache, users can quickly and conveniently obtain the intermediate results generated during these inferences.

[0079] In an exemplary embodiment, the elastic equations for three-dimensional connectors are as follows:

[0080]

[0081] The above equations can be inferred by using the inference method of the symbolic expression of the present disclosure to achieve fast and accurate solution. In the above equations, x, y, z, λ, μ, n x , n y , n z are input variables, u, v, w are inferred from the network layer nodes in the symbolic expression, σ xx , σ xy , σ xz , σ yx , σ yy , σ yz , σ zx , σ zy , σ zzIt is obtained by reasoning about the operator nodes in the symbolic expression. Other operations such as partial derivatives, addition, subtraction, and multiplication are obtained by reasoning about the operator nodes in the symbolic expression. Figure 6 Figure 6 shows a schematic diagram of the solution result of the elastic equation system for the three-dimensional connector according to an embodiment of the present disclosure. It can be seen that by using the reasoning method of the symbolic expression of the present disclosure, an accurate solution result can be obtained.

[0082] According to another aspect of the present disclosure, there is provided a reasoning device for symbolic expressions. Figure 7 Figure 7 shows a structural block diagram of a reasoning device 700 for symbolic expressions according to an embodiment of the present disclosure. The device 700 includes: a generation unit 710 configured to generate an expression tree of a target symbolic expression, the expression tree including a plurality of nodes, the plurality of nodes including at least one operation node and at least one variable node; a traversal unit 720 configured to perform a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; a processing unit 730 configured to process the nodes in the sequence of nodes to be processed in turn, including: a determination subunit 732 configured to, in response to determining that the currently processed node is an operation node, determine whether the operation result corresponding to the operation node has been cached; an operation subunit 734 configured to, in response to determining that the operation result corresponding to the operation node has not been cached, perform operation reasoning on the operation node; and a caching subunit 736 configured to cache the operation result of the operation node.

[0083] It can be understood that the operations of the units 710 - 730 and their subunits in the device 700 can refer to the descriptions of the steps S201 - S203 and their sub-steps in the method 200 above, and will not be elaborated here.

[0084] According to some embodiments, the target symbolic expression can be configured to cooperate with a neural network model to perform reasoning on at least one of the following multiple tasks: fluid mechanics simulation task, structural mechanics simulation task, thermodynamics simulation task, optimization design task, and physical equation inverse problem solving task.

[0085] According to some embodiments, at least one operation node may include an operator node, and the operator node is configured to perform four arithmetic operations, exponential operations, logarithmic operations, trigonometric function operations, extreme value operations, differential operations, integral operations, or numerical truncation operations.

[0086] According to some embodiments, at least one operation node may include a network layer node, and the network layer node is configured to receive one or more input variables of the neural network model and output one or more output variables of the neural network model.

[0087] According to some embodiments, at least one variable node may include a constant node and a parameter node, and the parameter node is configured to store learnable parameters that participate in the optimization of the neural network model but do not belong to the neural network model.

[0088] According to some embodiments, at least one operation node includes a gradient truncation node, and the gradient truncation node is configured to receive a variable value and output the variable value after gradient truncation.

[0089] According to some embodiments, the apparatus 700 may further include (not shown in the figure): a deduplication unit configured to deduplicate the sequence of nodes to be processed before processing the nodes in the sequence of nodes to be processed in sequence. The deduplication unit may include: a first deduplication subunit configured to deduplicate the same variable nodes in the sequence of nodes to be processed and retain the first-occurring variable node among the same variable nodes; and a second deduplication subunit configured to deduplicate the same operation nodes in the sequence of nodes to be processed and retain the first-occurring operation node among the same operation nodes, and the same operation nodes include the root nodes of exactly the same subtrees in the expression tree.

[0090] According to some embodiments, the determination subunit may be configured to, in response to determining that the currently processed node is an operation node, determine whether the operation result corresponding to the operation node has been cached using the sub-symbolic expression corresponding to the operation node as a keyword. The caching subunit may be configured to cache the operation result of the operation node using the sub-symbolic expression corresponding to the operation node as a keyword.

[0091] According to some embodiments, the processing unit 730 may include (not shown in the figure): a first reading subunit configured to read the cached operation result in response to determining that the operation result corresponding to the operation node has been cached.

[0092] According to some embodiments, the processing unit 730 may include (not shown in the figure): a second reading subunit configured to read the variable value corresponding to the variable node in response to determining that the currently processed node is a variable node.

[0093] In the technical solution of the present disclosure, the processing of collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0094] According to an embodiment of the present disclosure, an electronic device, a readable storage medium, and a computer program product are further provided.

[0095] Reference Figure 8, a block diagram of an electronic device 800 that can be a server or a client of the present disclosure will now be described. It is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as, for example, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0096] As Figure 8 shown, the electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0097] A plurality of components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 can be any type of device that can input information into the electronic device 800. The input unit 806 can receive input digital or character information, and generate key signal inputs related to the user settings and / or function controls of the electronic device, and can include, but is not limited to, a mouse, a keyboard, a touch screen, a trackpad, a trackball, a joystick, a microphone, and / or a remote control. The output unit 807 can be any type of device that can present information, and can include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 808 can include, but is not limited to, magnetic disks, optical disks. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks, and can include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0098] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 executes the various methods, processes, and / or operations described above. For example, in some embodiments, these methods, processes, and / or operations can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the methods, processes, and / or operations described above can be executed. Alternatively, in other embodiments, the computing unit 801 can be configured to execute these methods, processes, and / or operations in any other suitable manner (e.g., by means of firmware).

[0099] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), system-on-a-chip systems (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0100] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0101] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0102] In order to provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0103] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), the Internet, and blockchain networks.

[0104] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact via a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system or a server combined with a blockchain.

[0105] It should be understood that the various forms of processes shown above can be used, and steps can be reordered, added, or deleted. For example, the steps described in the present disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and no limitations are imposed herein.

[0106] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above methods, systems, and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but is only defined by the authorized claims and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, the steps can be executed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. Importantly, with the evolution of technology, many of the elements described herein can be replaced by equivalent elements that emerge after the present disclosure.

Claims

1. A method for reasoning of symbolic expressions, comprising: generating an expression tree of a target symbolic expression, the expression tree including a plurality of nodes, the plurality of nodes including at least one operation node and at least one variable node; performing a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; and processing the nodes in the sequence of nodes to be processed in turn, including: in response to determining that the currently processed node is an operation node, determining whether the operation result corresponding to the operation node has been cached; in response to determining that the operation result corresponding to the operation node has not been cached, performing operation reasoning on the operation node; and caching the operation result of the operation node.

2. The method according to claim 1, wherein in response to determining that the currently processed node is an operation node, determining whether the operation result corresponding to the operation node has been cached includes: using the sub-symbolic expression corresponding to the operation node as a keyword to determine whether the operation result corresponding to the operation node has been cached; wherein caching the operation result of the operation node includes: using the sub-symbolic expression corresponding to the operation node as a keyword to cache the operation result of the operation node.

3. The method according to claim 1 or 2, wherein processing the nodes in the sequence of nodes to be processed in turn includes: in response to determining that the operation result corresponding to the operation node has been cached, reading the cached operation result.

4. The method according to claim 1 or 2, wherein processing the nodes in the sequence of nodes to be processed in turn includes: in response to determining that the currently processed node is a variable node, reading the variable value corresponding to the variable node.

5. The method according to claim 4, further comprising: before processing the nodes in the sequence of nodes to be processed in turn, removing duplicates from the sequence of nodes to be processed, including: removing duplicates from the same variable nodes in the sequence of nodes to be processed and retaining the first-occurring variable node among the same variable nodes; and removing duplicates from the same operation nodes in the sequence of nodes to be processed and retaining the first-occurring operation node among the same operation nodes, the same operation nodes including the root nodes of exactly the same subtrees in the expression tree.

6. The method according to claim 1 or 2, wherein the target symbolic expression is configured to cooperate with a neural network model to perform reasoning on at least one of the following tasks: fluid mechanics simulation task, structural mechanics simulation task, thermodynamics simulation task, optimization design task, and physical equation inverse problem solving task.

7. The method according to claim 6, wherein the at least one variable node includes a constant node and a parameter node, and the parameter node is configured to store learnable parameters that participate in the optimization of the neural network model and do not belong to the neural network model.

8. The method according to claim 6, wherein the at least one operation node includes a gradient truncation node, and the gradient truncation node is configured to receive a variable value and output the variable value after gradient truncation.

9. The method according to claim 6, wherein The at least one operation node includes an operator node, and the operator node is configured to perform four arithmetic operations, exponential operation, logarithmic operation, trigonometric function operation, extreme value operation, differential operation, integral operation or numerical truncation operation.

10. The method according to claim 6, wherein, the at least one operation node includes a network layer node, and the network layer node is configured to receive one or more input variables of the neural network model and output one or more output variables of the neural network model.

11. An inference device for symbolic expressions, comprising: a generation unit configured to generate an expression tree of a target symbolic expression, the expression tree including a plurality of nodes, the plurality of nodes including at least one operation node and at least one variable node; a traversal unit configured to perform a post-order traversal on the expression tree to obtain a sequence of nodes to be processed; and a processing unit configured to process the nodes in the sequence of nodes to be processed in turn, the processing unit including: a determination subunit configured to determine whether the operation result corresponding to the operation node has been cached in response to determining that the currently processed node is an operation node; an operation subunit configured to perform operation inference on the operation node in response to determining that the operation result corresponding to the operation node has not been cached; and a caching subunit configured to cache the operation result of the operation node.

12. The device according to claim 11, wherein, the determination subunit is configured to determine whether the operation result corresponding to the operation node has been cached by using the sub-symbolic expression corresponding to the operation node as a keyword in response to determining that the currently processed node is an operation node; wherein, the caching subunit is configured to cache the operation result of the operation node by using the sub-symbolic expression corresponding to the operation node as a keyword.

13. The device according to claim 11 or 12, wherein, the processing unit includes: a first reading subunit configured to read the cached operation result in response to determining that the operation result corresponding to the operation node has been cached.

14. The device according to claim 11 or 12, wherein, the processing unit includes: a second reading subunit configured to read the variable value corresponding to the variable node in response to determining that the currently processed node is a variable node.

15. The device according to claim 14, further comprising: a deduplication unit configured to deduplicate the sequence of nodes to be processed before processing the nodes in the sequence of nodes to be processed in turn, the deduplication unit including: a first deduplication subunit configured to deduplicate the same variable nodes in the sequence of nodes to be processed and retain the variable node that appears first among the same variable nodes; and a second deduplication subunit configured to deduplicate the same operation nodes in the sequence of nodes to be processed and retain the operation node that appears first among the same operation nodes, the same operation nodes including the root nodes of exactly the same subtrees in the expression tree.

16. The device according to claim 11 or 12, wherein, The target symbolic expression is configured to perform inference on at least one of the following tasks in cooperation with a neural network model: a fluid mechanics simulation task, a structural mechanics simulation task, a thermodynamics simulation task, an optimal design task, and a physical equation inverse problem solving task.

17. The apparatus according to claim 16, wherein, the at least one variable node includes a constant node and a parameter node, and the parameter node is configured to store learnable parameters that participate in the optimization of the neural network model and do not belong to the neural network model.

18. The apparatus according to claim 16, wherein, the at least one operation node includes a gradient truncation node, and the gradient truncation node is configured to receive a variable value and output the variable value after gradient truncation.

19. The apparatus according to claim 16, wherein, the at least one operation node includes an operator node, and the operator node is configured to perform arithmetic operations, exponential operations, logarithmic operations, trigonometric function operations, extreme value operations, differential operations, integral operations, or numerical truncation operations.

20. The apparatus according to claim 16, wherein, the at least one operation node includes a network layer node, and the network layer node is configured to receive one or more input variables of the neural network model and output one or more output variables of the neural network model.

21. An electronic device, characterized in that the electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-10.

22. A non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.

23. A computer program product comprising a computer program, wherein, the computer program, when executed by a processor, implements the method according to any one of claims 1-10.

Citation Information

Patent Citations

  • Deep learning model reasoning method and device, electronic equipment and storage medium

    CN115759260A

  • Automatic level-of-detail for physically-based materials

    US20180165868A1