The application provides a code block-based model precision alignment test method and
system and
electronic equipment, and relates to the technical field of
deep learning testing. The method comprises the following steps: defining an execution boundary for a code block to be tested by a
context manager and monitoring; based on input data in a reference calculation
record prepared for the code block, executing the code block under monitoring, and automatically capturing a generated forward
data set; the forward
data set at least includes an input
tensor input to the code block and an intermediate
tensor generated inside the code block; after the completion of reverse gradient calculation, a gradient
data set corresponding to the forward data set is automatically captured; finally, the captured forward data set and / or gradient data set is compared with corresponding data in the reference calculation
record, and a precision alignment
test report is generated. The application realizes fine-grained and low-invasive
precision testing of the calculation process of any
code segment in a
deep learning model, and solves the problem of coarse testing
granularity and poor flexibility of traditional methods.