PROGRAM COMPILING METHOD AND APPARATUS
This application discloses a program compilation method and apparatus. The method includes: obtaining a first expression and a second expression of a program, where a dependency relationship is generated between the first expression and the second expression based on a first variable, and an operati...
Gespeichert in:
Hauptverfasser: | , , , |
---|---|
Format: | Patent |
Sprache: | eng ; fre ; ger |
Schlagworte: | |
Online-Zugang: | Volltext bestellen |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | This application discloses a program compilation method and apparatus. The method includes: obtaining a first expression and a second expression of a program, where a dependency relationship is generated between the first expression and the second expression based on a first variable, and an operation type of the first variable in the first expression is different from an operation type of the first variable in the second expression; updating the operation type of the first variable in the first expression and/or the operation type of the first variable in the second expression, where an updated operation type of the first variable indicates that the first variable has no differentiation result or has a differentiation result of zero after undergoing a differentiation operation; processing the first expression and the second expression based on the updated operation type of the first variable, to obtain corresponding derivative function expressions; and combining, according to a chain rule, the derivative function expressions respectively corresponding to the first expression and the second expression, to obtain a compilation result of the program. According to implementations of this application, the compilation result of the program can be simplified, thereby improving running performance of a compiled program. |
---|