Circuit network gradient descent method, apparatus and device

CN120806027BActive Publication Date: 2026-11-03BEIJING CEC HUADA ELECTRONIC DESIGN CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510905461.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2026-11-03
Estimated Expiration
2045-07-01

AI Technical Summary

Technical Problem

Existing technologies cannot directly optimize circuit network parameters in the hardware field using purely software-based neural network models, and there is a lack of suitable parameter optimization methods.

Method used

This paper presents a gradient descent method for circuit networks. By acquiring the learning rate and input values, the algorithm is tested and run simultaneously, and optimized using hardware. This includes univariate updates, gradient calculation, and learning rate adjustment, thus realizing the algorithm's test-and-run capability.

Benefits of technology

It achieves more efficient parameter optimization in hardware scenarios, reduces steps, improves optimization efficiency, and can find global or local optimal values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120806027B_ABST
    Figure CN120806027B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of circuit network optimization, and discloses a circuit network gradient descent method, device and equipment, the method comprising: obtaining a learning rate and a plurality of input values of a circuit network to be optimized; inputting the input values into the circuit network to be optimized, and obtaining the value of a target function obtained by testing the circuit network to be optimized through hardware, and determining whether to exit the loop according to the value of the target function; obtaining the change amount corresponding to each input value, and performing single-variable updating on any one of all input values according to the change amount; sequentially inputting the single-variable updated input values into the circuit network to be optimized, and obtaining the value of the target function obtained by testing the circuit network to be optimized through hardware, and determining whether to exit the loop according to the value of the target function; updating the input values according to the learning rate, and returning to the step of inputting the input values into the circuit network to be optimized to perform a loop, and the present application can improve the circuit network optimization efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of circuit network optimization technology, and specifically to a method, apparatus, and device for gradient descent in circuit networks. Background Technology

[0002] Gradient descent is an iterative algorithm used to optimize the parameters of a neural network model. Its core idea is to update the parameters along the inverse direction of the gradient of the loss function with respect to the parameters, gradually reducing the value of the loss function until it reaches its global or local minimum, making the model's predictions as close as possible to the true results. Here, the loss function reflects the difference between the model's result and the target result; the closer the model's result is to the target result, the smaller the loss function.

[0003] In the hardware field, such as during NFC automatic antenna tuning, gradient descent algorithms can also be used for automatic parameter optimization. However, unlike in the software field, hardware parameters are physical parameters that vary with manufacturing or processing errors. Therefore, the parameters of each node cannot be determined in advance, and hardware parameters cannot be directly optimized using purely software-based neural network models.

[0004] Therefore, there is an urgent need for a parameter optimization method for circuit networks in the hardware field. Summary of the Invention

[0005] In view of this, the present invention provides a method, apparatus and device for gradient descent of circuit networks to solve the technical problem that hardware parameters cannot be directly optimized through a purely software-based neural network model, and that there is a lack of parameter optimization methods for circuit networks in the hardware field.

[0006] In a first aspect, the present invention provides a gradient descent method for circuit networks, comprising:

[0007] Obtain the learning rate and several input values ​​of the circuit network to be optimized;

[0008] Input the input value into the circuit network to be optimized, and obtain the value of the objective function obtained after testing the circuit network to be optimized through hardware. Determine whether to exit the loop based on the value of the objective function.

[0009] Obtain the change for each input value, and perform a univariate update on any one of all input values ​​based on the change.

[0010] The updated input values ​​of the single variable are sequentially fed into the circuit network to be optimized, and the value of the objective function obtained after testing the circuit network to be optimized through hardware is obtained. The value of the objective function is used to determine whether to exit the loop.

[0011] The input value is updated based on the learning rate, and the process of returning to the step of feeding the input value into the circuit network to be optimized is repeated. After exiting the loop, the current input value is output.

[0012] In one alternative implementation, before updating the input value according to the learning rate, the following steps are included:

[0013] Calculate the gradient for each input value based on the value of the objective function before the univariate update, the value of the objective function after the univariate update, and the amount of change.

[0014] Determine whether the learning rate update condition is met based on the gradient.

[0015] The learning rate is updated when the conditions for updating the learning rate are met.

[0016] In one optional implementation, the gradient corresponding to each input value is calculated based on the value of the objective function before the univariate update, the value of the objective function after the univariate update, and the change, including:

[0017] The gradient for each input value is calculated using the gradient formula, where the gradient formula is:

[0018] gradient_i = (gi - g0) / dxi;

[0019] In the formula, gradient_i represents the gradient corresponding to the i-th input value, gi represents the value of the objective function obtained after the i-th input value is updated univariately, g0 represents the value of the objective function obtained before the univariate update, dxi represents the change corresponding to the i-th input value, and i is 1, 2, ..., n.

[0020] In one optional implementation, determining whether the learning rate update condition is met based on the gradient includes:

[0021] The gradient is used to determine whether there is an input value that meets a preset condition, where the preset condition is:

[0022] k×gradient_i×xi<dxi;

[0023] In the formula, k is the learning rate, gradient_i represents the gradient corresponding to the i-th input value, xi represents the i-th input value, and dxi represents the change corresponding to the i-th input value;

[0024] The learning rate update condition is met when there is at least one input value that satisfies the preset conditions.

[0025] In one optional implementation, updating the learning rate when the learning rate update condition is met includes:

[0026] When the learning rate update condition is met, the reasonable learning rate value for each input value is calculated according to the reasonable value formula, whereby:

[0027] k_i = dxi / gradient_i × xi;

[0028] In the formula, k_i is the reasonable learning rate value corresponding to the i-th input value, dxi represents the change corresponding to the i-th input value, gradient_i represents the gradient corresponding to the i-th input value, and xi represents the i-th input value;

[0029] The learning rate is updated based on a reasonable value.

[0030] In one optional implementation, updating the learning rate based on a reasonable value includes:

[0031] Calculate the average of all reasonable learning rate values;

[0032] Use the average value as the updated learning rate.

[0033] In one alternative implementation, updating the input value based on the learning rate includes:

[0034] The updated input value is obtained by subtracting the learning rate multiplied by the corresponding gradient and then multiplying it by the input value before the update for each input value before the update.

[0035] In one optional implementation, determining whether to exit the loop based on the value of the objective function includes:

[0036] Calculate the value of the loss function based on the value of the objective function;

[0037] Determine if the value of the loss function satisfies the loop exit condition. If the value of the loss function satisfies the loop exit condition, exit the loop.

[0038] Secondly, the present invention provides a circuit network gradient descent device, comprising: an environment variable acquisition module, used to acquire a set of operating system environment parameters when a race condition vulnerability is triggered, the set of environment parameters including several environment variables; an adjustment and replay module, used to adjust the environment variables in the set of environment parameters and replay the adjusted set of environment parameters to obtain several replayed triggering environment sequences of race conditions; and a causal analysis module, used to perform causal analysis based on the triggering environment sequences to obtain the causal relationship between each environment variable and the race condition vulnerability.

[0039] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the circuit network gradient descent method of the first aspect or any corresponding embodiment described above.

[0040] The present invention has the following beneficial effects:

[0041] This invention acquires a learning rate and several input values ​​of the circuit network to be optimized, inputs these input values ​​into the circuit network, and obtains the value of the objective function obtained after hardware testing of the circuit network. Based on the value of the objective function, it determines whether to exit the loop. It then acquires the change corresponding to each input value, performs a univariate update on any one of the input values ​​based on the change, and sequentially inputs the updated univariate values ​​into the circuit network. After obtaining the value of the objective function obtained after hardware testing of the circuit network, it determines whether to exit the loop based on the value of the objective function, updates the input values ​​according to the learning rate, and repeats the process of inputting the input values ​​into the circuit network. Upon exiting the loop, it outputs the current input value. This achieves a test-and-run algorithm, suitable for hardware scenarios. Compared to ordinary hardware optimization, this invention requires fewer steps to achieve convergence and has higher optimization efficiency. Attached Figure Description

[0042] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0043] Figure 1 This is a schematic flowchart of a gradient descent method for a circuit network according to an embodiment of the present invention;

[0044] Figure 2 This is a schematic flowchart of another circuit network gradient descent method according to an embodiment of the present invention;

[0045] Figure 3 This is a schematic diagram of the NFC automatic antenna tuning circuit network according to an embodiment of the present invention;

[0046] Figure 4 This is a Smith chart of NFC automatic antenna tuning circuit network optimization using a traversal method.

[0047] Figure 5 This is a contour plot of the objective function of the NFC automatic antenna tuning circuit.

[0048] Figure 6 This is a flowchart of a circuit network gradient descent method in an NFC automatic antenna tuning circuit network according to an embodiment of the present invention;

[0049] Figure 7 This is a Smith chart of a circuit network gradient descent method using an embodiment of the present invention, but without adjusting the learning rate.

[0050] Figure 8 This is a Smith chart with adjusted learning rate obtained using a circuit network gradient descent method according to an embodiment of the present invention.

[0051] Figure 9 This is a structural block diagram of the circuit network gradient descent device according to an embodiment of the present invention;

[0052] Figure 10 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0053] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0054] In the hardware domain, nodes are circuit networks, not neural networks. Therefore, the parameter values ​​of different nodes need to be obtained through testing during the gradient descent algorithm process. This invention proposes a gradient descent method for circuit networks to address the hardware scenario where node parameters need to be tested while the gradient descent algorithm is being executed.

[0055] According to an embodiment of the present invention, a method for gradient descent of circuit networks is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0056] This embodiment provides a gradient descent method for circuit networks, which can be used in mobile terminals such as computers and servers, combined with... Figure 1 and Figure 2 As shown, the process includes the following steps:

[0057] Step S101: Obtain the learning rate and several input values ​​of the circuit network to be optimized.

[0058] Specifically, the circuit network to be optimized includes antenna tuning networks, filter circuit networks, etc. For example, the circuit network to be optimized is a Near Field Communication (NFC) automatic antenna tuning network.

[0059] The learning rate is a hyperparameter in the gradient descent algorithm, used to control the magnitude of parameter updates at each step during gradient descent iterations.

[0060] The input values ​​are the values ​​of electronic components such as capacitors or inductors in the circuit network to be optimized. There can be one or more input values. For example, in an NFC automatic antenna tuning network, the input values ​​are the capacitance values ​​of two capacitors.

[0061] Pre-set the initial value k0 for learning k, and let k = k0. Set the initial values ​​of the input values ​​of the circuit network to be optimized to (x1, x2, ..., xi, ..., xn). n is the number of input values, which is a natural number with a minimum value of 1, and xi is the i-th input value.

[0062] To accelerate the convergence speed, the initial input value is usually given as the value that is closest to the optimization result, based on experience or test statistics.

[0063] Step S102: Input the input value into the circuit network to be optimized, and obtain the value of the objective function obtained after testing the circuit network to be optimized by hardware. Determine whether to exit the loop based on the value of the objective function.

[0064] Specifically, based on n input values ​​(x1, x2, ..., xi, ..., xn), the feature values ​​of the circuit network to be optimized can be tested by hardware. The objective function g0 = g(x1, x2, ..., xi, ..., xn) corresponding to the input values ​​before the single-variable update can be obtained directly or indirectly through the test data. The value of the loss function is calculated based on the value of the objective function, and it is determined whether to exit the loop.

[0065] The objective function is the optimization target; the goal of optimization is to make the value of the objective function equal to the target value. The loss function can be the same function as the objective function, or it can be a different function set separately from the objective function. The loop exits when the value of the loss function meets a pre-defined exit condition.

[0066] Step S103: Obtain the change amount corresponding to each input value, and perform a univariate update on any one of all input values ​​based on the change amount.

[0067] Specifically, the change amounts corresponding to each input value are dx1, dx2, ..., dxi, ..., dxn. The change amounts corresponding to each input value are pre-set, and the values ​​of dx1, dx2, ..., dxi, ..., dxn should be reasonable according to the situation. If the values ​​are too small, noise interference will occur during the test; if the values ​​are too large, the accuracy will decrease.

[0068] Univariate update refers to changing only one input value based on the initial value. The input values ​​after each univariate update are (x1+dx1, x2, ..., xi, ..., xn), (x1, x2, ..., xi+dxi, ..., xn), and (x1, x2, ..., xi, ..., xn+dxn), etc.

[0069] Step S104: The updated input values ​​of the single variable are sequentially input into the circuit network to be optimized, and the value of the objective function obtained after testing the circuit network to be optimized by hardware is obtained. The value of the objective function is used to determine whether to exit the loop.

[0070] Specifically, set a reasonable change amount dx1, input (x1+dx1, x2, ..., xi, ..., xn) into the circuit network to be optimized, obtain the objective function g1 = g(x1+dx1, x2, ..., xi, ..., xn) through testing, calculate the loss function, and determine whether to exit the loop.

[0071] Set a reasonable dx2, input (x1, x2+dx2, ..., xi, ..., xn) into the circuit network, obtain the objective function g2 = g(x1, x2+dx2, ..., xi, ..., xn) through testing, calculate the loss function, and determine whether to exit the loop.

[0072] …

[0073] Set a reasonable dxi, input (x1, x2, ..., xi+dxi, ..., xn) into the circuit network, obtain the objective function gi = g(x1, x2, ..., xi+dxi, ..., xn) through testing, calculate the loss function, and determine whether to exit the loop.

[0074] …

[0075] Set a reasonable dxn, input (x1, x2, ..., xi, ..., xn+dxn) into the circuit network, obtain the objective function gi = g(x1, x2, ..., xi, ..., xn+dxn) through testing, calculate the loss function, and determine whether to exit the loop.

[0076] In the above steps, after each test to obtain the objective function, it is possible to calculate whether the loss function satisfies the loop exit condition, so that the loop may exit at each step. In an extreme case, in the first loop, the data (x1, x2, ..., xi, ..., xn) input in step S102 is used to test the objective function. If the calculated loss function satisfies the loop exit condition, convergence can be achieved with only one test.

[0077] Step S105: Update the input value according to the learning rate, return to the step of inputting the input value into the circuit network to be optimized and loop, and output the current input value after exiting the loop.

[0078] Specifically, the input values ​​are updated according to the learning rate, and the process returns to step S102 to restart the loop using the updated input values ​​(x1, x2, ..., xi, ..., xn).

[0079] According to the gradient descent method for circuit networks of the present invention, if the objective function is a convex function, the method can find the global optimum. If the objective function is not a convex function, the method can find the local optimum, thereby optimizing the input values ​​in the circuit network to be optimized and determining the optimal combination of capacitor and inductor values ​​for the circuit network to be optimized.

[0080] The gradient descent method for circuit networks in this invention obtains a learning rate and several input values ​​of the circuit network to be optimized. These input values ​​are then fed into the circuit network. The value of the objective function, obtained after hardware testing of the circuit network, is then determined. The loop exit is determined based on the objective function value. The change corresponding to each input value is obtained, and a single-variable update is performed on any one of the input values ​​based on the change. The updated input values ​​are then fed back into the circuit network. The objective function, obtained after hardware testing of the circuit network, is then determined. The loop exit is determined based on the objective function value. The input values ​​are updated according to the learning rate, and the process of feeding the updated input values ​​back into the circuit network is repeated. After exiting the loop, the current input value is output. This method achieves simultaneous testing and execution of the algorithm, making it suitable for hardware scenarios. Compared to ordinary hardware optimization, this invention requires fewer steps to achieve convergence and has higher optimization efficiency.

[0081] In some embodiments, before updating the input value according to the learning rate in step S105, the following is included:

[0082] Step S201: Calculate the gradient corresponding to each input value based on the value of the objective function before the univariate update, the value of the objective function after the univariate update, and the change.

[0083] Specifically, the gradient for each input value is calculated according to the gradient formula, where the gradient formula is:

[0084] gradient_i = (gi - g0) / dxi;

[0085] In the formula, gradient_i represents the gradient corresponding to the i-th input value, gi represents the value of the objective function obtained after the i-th input value is updated univariately, g0 represents the value of the objective function obtained before the univariate update, dxi represents the change corresponding to the i-th input value, and i is 1, 2, ..., n.

[0086] The gradient calculation process for each input value is as follows:

[0087] gradient_1 = (g1 - g0) / dx1;

[0088] gradient_2 = (g2 - g0) / dx2;

[0089] …

[0090] gradient_i = (gi - g0) / dxi;

[0091] …

[0092] gradient_n = (gn - g0) / dxn.

[0093] The gradient formula can quantitatively measure the impact of changes in each input value on the objective function, providing a precise quantitative basis for subsequent gradient-based learning rate updates and input value adjustments, which helps to make more scientific optimization decisions.

[0094] Step S202: Determine whether the learning rate update condition is met based on the gradient.

[0095] Specifically, step S202 includes:

[0096] Step S2021: Determine whether there is an input value that meets the preset conditions based on the gradient, wherein the preset conditions are:

[0097] k×gradient_i×xi<dxi;

[0098] In the formula, k is the learning rate, gradient_i represents the gradient corresponding to the i-th input value, xi represents the i-th input value, and dxi represents the change corresponding to the i-th input value;

[0099] Step S2022: When there is at least one input value that satisfies the preset conditions, the learning rate update condition is satisfied.

[0100] Specifically, calculate k×gradient_1×x1<dx1, k×gradient_2×x2<dx2, …, k×gradient_i×xi<dxi, …, k×gradient_n×xn<dxn. If any of the above n conditions is not met, update the learning rate k; otherwise, the learning rate k remains unchanged.

[0101] Step S203: Update the learning rate when the learning rate update condition is met.

[0102] A larger learning rate k results in faster convergence but also lower accuracy, so it needs to be adjusted according to the situation.

[0103] Based on a comprehensive judgment condition that considers gradient, learning rate, input value and its changes, the applicability of the current learning rate in the optimization process can be more accurately reflected, avoiding blind adjustment of the learning rate and ensuring that the learning rate is updated only when necessary and reasonable, thereby improving the accuracy and effectiveness of learning rate adjustment.

[0104] When a conditional input value exists, it indicates that the current learning rate may lead to an excessively large or small update step size in the direction of that input value, potentially causing over-optimization or under-optimization. This conditional judgment can promptly detect such situations and trigger a learning rate update, thereby preventing the optimization process from stalling or deviating from the optimal solution due to an unreasonable learning rate. This ensures the smooth progress of the optimization process and the final optimization quality.

[0105] Further, step S203 includes:

[0106] Step S2031: When the learning rate update condition is met, calculate the reasonable learning rate value for each input value according to the reasonable value formula, whereby the reasonable value formula is:

[0107] k_i = dxi / gradient_i × xi;

[0108] In the formula, k_i is the reasonable learning rate value corresponding to the i-th input value, dxi represents the change corresponding to the i-th input value, gradient_i represents the gradient corresponding to the i-th input value, and xi represents the i-th input value;

[0109] Step S2032: Update the learning rate based on a reasonable value.

[0110] Specifically, calculate n reasonable learning rate values ​​in sequence: k_1=dx1 / gradient_1×x1, k_2=dx2 / gradient_2×x2, …, k_i=dxi / gradient_i×xi, …, k_n=dxn / gradient_n×xn.

[0111] Based on n reasonable learning rate values, assign a value to the learning rate k as appropriate. For example, assign a value to the learning rate k within the range of the reasonable learning rate value multiplied by 100 and divided by 100.

[0112] In some embodiments, step S2032, updating the learning rate based on a reasonable learning rate value, includes:

[0113] Step S20321: Calculate the average of all reasonable learning rate values;

[0114] Step S20322: Use the average value as the updated learning rate.

[0115] Averaging can smooth out fluctuations in the reasonable learning rate values ​​corresponding to each input value to a certain extent, resulting in a relatively stable learning rate that comprehensively considers the requirements of each input value. This allows the updated learning rate to better adapt to the optimization requirements of the entire circuit network and avoids the optimization process becoming unstable due to the excessive influence of the particularity of individual input values ​​on the learning rate.

[0116] In some embodiments, updating the input value according to the learning rate in step S105 includes:

[0117] Step S1051: Subtract the learning rate multiplied by the corresponding gradient and then multiplied by the input value before the update from each input value before the update to obtain the updated input value.

[0118] Specifically, the input values ​​are updated according to the following formulas: x1 = x1 - k × grandient_1 × x1, x2 = x2 - k × grandient_2 × x2, ..., xi = xi - k × grandient_i × xi, ..., xn = xn - k × grandient_i × xn.

[0119] The gradient reflects the trend and direction of the objective function at the current input value, while the learning rate determines the step size of each adjustment. Combining the gradient and the learning rate to update the input value makes the update of the input value both directional and allows for reasonable control of the adjustment range according to the needs of the optimization process. This improves the stability and convergence of the optimization process while ensuring optimization efficiency, and helps to find the combination of input values ​​that makes the circuit network perform better more quickly.

[0120] In some embodiments, step S102 or step S104, determining whether to exit the loop based on the value of the objective function, includes:

[0121] Step a1: Calculate the value of the loss function based on the value of the objective function;

[0122] Step a2: Determine whether the value of the loss function satisfies the loop exit condition. If the value of the loss function satisfies the loop exit condition, exit the loop.

[0123] Specifically, the objective function and the loss function can be the same function or different functions. The loop exits when the value of the loss function meets the pre-defined loop exit condition.

[0124] For example, in a scenario where the capacitors and inductors are fixed, the values ​​of capacitors C1 and C2 are adjusted so that the function Z equals the target impedance value of 20 ohms. Here, the loss function is set as s11dB = 20 × log10[(Z - 20 / Z + 20)], and the loop exits when s11dB < -20. The objective function is Z = Z(C1, C2) = 20, the loss function is s11dB = 20 × log10[(Z - 20 / Z + 20)], and the loop exit condition is s11dB < -20.

[0125] By introducing a loss function, we can more intuitively measure the gap between the actual performance and the expected performance of the circuit network. When the loss function value meets the exit condition, it means that the performance of the circuit network has reached the predetermined optimization goal. At this time, exiting the loop can avoid unnecessary computation and resource waste.

[0126] The following example uses the NFC automatic antenna tuning circuit network as an example to illustrate the circuit network gradient descent method of this invention.

[0127] NFC automatic antenna tuning circuit network, such as Figure 3 As shown, Figure 3 In the diagram, the NFC chip is labeled with four ports: TX1 and TX2 are transmit ports, X1 and X2 are voltage output ports, and X1 and X2 are connected to the first variable capacitor C1 and the second variable capacitor C2, respectively, controlling their values. Lpicc is an inductor. The NFC chip's impedance value Z can be obtained through hardware testing. Z is a function of all components in the chip's external circuit network, defined as Z = Z(C1, C2, Lpicc, ...). This means that when the independent variables C1 and C2 change, the function Z also changes. Since the other independent variables are fixed, Z = Z(C1, C2), meaning that in this example, the number of input values ​​n = 2.

[0128] The optimization objective is to adjust the values ​​of C1 and C2 to make the function Z equal to the target impedance value of 20 ohms, given that the LPICC and other capacitors and inductors are fixed. The loss function is set as s11dB = 20 × log10[(Z - 20 / Z + 20)]. The loop exits when s11dB < -20. The objective function is Z = Z(C1, C2) = 20, the loss function is s11dB = 20 × log10[(Z - 20 / Z + 20)], and the loop exit condition is s11dB < -20.

[0129] Since the values ​​of capacitance and inductance in a circuit network are physical parameters, they are subject to variations in manufacturing processes and production. Therefore, these values ​​cannot be predetermined. Consequently, common optimization algorithms lose their foundation. Optimization algorithms must be implemented and tested concurrently.

[0130] The traditional traversal method involves two nested loops scanning the values ​​of C1 and C2. This traversal yields the trace of the objective function Z = g(C1, C2) on the Smith chart corresponding to each value of C1 and C2, as shown below. Figure 4 As shown. Figure 4 The Smith chart has been normalized to 20 ohms, so the point in the middle of the Smith chart corresponds to an impedance Z = 20 ohms. As you can see, after scanning to the middle point, a crescent-shaped mark is left. Each black dot in the Smith chart corresponds to a test step, requiring thousands of test points in total.

[0131] Before implementing the gradient descent algorithm, we can examine the gradient of the objective function. Figure 5 This is a contour plot of the objective function of the NFC automatic antenna tuning circuit. Figure 5 As we can see, the contour lines are concentric circles with only one vertex, indicating that the function is convex. The gradient descent algorithm can optimize and find the global optimum.

[0132] According to the process of this embodiment of the invention, when n=2, the gradient descent algorithm in the NFC automatic antenna tuning circuit network is as follows: Figure 6 As shown.

[0133] Steps begin: Set the initial value of the learning rate k to k0, k = k0. Initialize the input values ​​(c1, c2) of the circuit network.

[0134] Step S0: Based on the n input values ​​(c1, c2), the objective function g0 = s11dB(c1, c2) can be directly or indirectly calculated from the test data using the feature values ​​of the hardware test circuit network.

[0135] Step S1: Set a reasonable variation dx1, input (c1+dx1, c2) into the circuit network, and obtain the objective function g1=s11dB(c1+dx1, c2) through testing;

[0136] Step S2: Set a reasonable variation dx2, input (c1, c2+dx2) into the circuit network, and obtain the objective function g2=s11dB(c1, c2+dx2) through testing;

[0137] Step Sn+1: Calculate the gradient, gradient_1=(g1-g0) / dx1; gradient_2=(g2-g0) / dx2;

[0138] Step Sn+2: Update the learning rate k. Calculate k×gradient_1×c1<dx1, k×gradient_2×c2<dx2. If any of the above 2 conditions is not satisfied, update the learning rate k, otherwise the learning rate k remains unchanged. The method for updating the learning rate is to calculate two reasonable learning rate values k_1 and k_2: k_1=dx1 / gradient_1×c1, k_2=dx2 / gradient_2×c2. Assign a value to k according to the situation. Here the value of k is equal to the average of k_1 and k_2.

[0139] Step sn+3: Refresh the input values. c1=c1-k×gradient_1×c1; c2=c2-k×gradient_2×c2; return to step S1, and restart the loop using the updated (c1, c2).

[0140] Figure 7 is a Smith chart when using the gradient descent algorithm of this patent without adjusting the learning rate. From the traces on the Smith chart, 19 black dots can be seen, and the optimization efficiency is greatly improved compared with the traversal method. Compared with Figure 4 the traces, it can be seen that the number of test points is greatly reduced.

[0141] Figure 8 is the Smith chart after the learning rate is adjusted by the gradient descent algorithm of this patent. The value of the learning rate k is adjusted through step Sn+2, and the value of k is increased by 16 times. The convergence speed can be further accelerated, and convergence is completed in only 7 steps. In Figure 8 the traces, it can be seen that the number of test points is further reduced.

[0142] The embodiment of the present invention further provides a circuit network gradient descent apparatus, as shown in Figure 9 the figure, comprising:

[0143] A parameter obtaining module 901, configured to obtain a learning rate and a plurality of input values of a circuit network to be optimized;

[0144] The first objective function calculation module 902 is used to input the input value into the circuit network to be optimized, obtain the value of the objective function after testing the circuit network to be optimized through hardware, and determine whether to exit the loop based on the value of the objective function.

[0145] The univariate update module 903 is used to obtain the change corresponding to each input value and perform univariate update on any one of all input values ​​according to the change.

[0146] The second objective function calculation module 904 is used to sequentially input the updated input values ​​of the single variable into the circuit network to be optimized, and obtain the value of the objective function after testing the circuit network to be optimized through hardware, and determine whether to exit the loop based on the value of the objective function;

[0147] The input value update module 905 is used to update the input value according to the learning rate, loop back to the step of inputting the input value into the circuit network to be optimized, and output the current input value after exiting the loop.

[0148] The circuit network gradient descent device of this invention acquires a learning rate and several input values ​​of the circuit network to be optimized, inputs the input values ​​into the circuit network to be optimized, and acquires the value of the objective function obtained after testing the circuit network to be optimized through hardware. Based on the value of the objective function, it determines whether to exit the loop, acquires the change corresponding to each input value, updates any one of all input values ​​individually based on the change, sequentially inputs the updated individual variable values ​​into the circuit network to be optimized, acquires the value of the objective function obtained after testing the circuit network to be optimized through hardware, determines whether to exit the loop based on the value of the objective function, updates the input value according to the learning rate, and returns to the step of inputting the input value into the circuit network to be optimized for looping. After exiting the loop, it outputs the current input value. This achieves the algorithm running while testing, is suitable for hardware scenarios, and compared with ordinary hardware optimization, this invention requires fewer steps to complete convergence, resulting in higher optimization efficiency.

[0149] Furthermore, the circuit network gradient descent device also includes:

[0150] The gradient calculation module is used to calculate the gradient corresponding to each input value based on the value of the objective function before the univariate update, the value of the objective function after the univariate update, and the amount of change.

[0151] The learning rate update judgment module is used to determine whether the learning rate update condition is met based on the gradient.

[0152] The learning rate update module is used to update the learning rate when the learning rate update conditions are met.

[0153] Furthermore, the gradient calculation module includes:

[0154] The first formula calculation module is used to calculate the gradient corresponding to each input value according to the gradient formula, where the gradient formula is:

[0155] gradient_i = (gi - g0) / dxi;

[0156] In the formula, gradient_i represents the gradient corresponding to the i-th input value, gi represents the value of the objective function obtained after the i-th input value is updated univariately, g0 represents the value of the objective function obtained before the univariate update, dxi represents the change corresponding to the i-th input value, and i is 1, 2, ..., n.

[0157] Furthermore, the learning rate update judgment module includes:

[0158] The first condition judgment module is used to determine whether there is an input value that meets a preset condition based on the gradient. The preset condition is:

[0159] k×gradient_i×xi<dxi;

[0160] In the formula, k is the learning rate, gradient_i represents the gradient corresponding to the i-th input value, xi represents the i-th input value, and dxi represents the change corresponding to the i-th input value;

[0161] The condition satisfaction judgment module is used to satisfy the learning rate update condition when there is at least one input value that satisfies the preset condition.

[0162] Furthermore, the learning rate update module includes:

[0163] The second formula calculation module is used to calculate the reasonable learning rate value for each input value according to the reasonable value formula when the learning rate update condition is met. The reasonable value formula is as follows:

[0164] k_i = dxi / gradient_i × xi;

[0165] In the formula, k_i is the reasonable learning rate value corresponding to the i-th input value, dxi represents the change corresponding to the i-th input value, gradient_i represents the gradient corresponding to the i-th input value, and xi represents the i-th input value;

[0166] The core module for updating the learning rate is used to update the learning rate based on a reasonable value.

[0167] Furthermore, the core module for learning rate updates includes:

[0168] The average calculation module is used to calculate the average of all reasonable learning rate values;

[0169] The learning rate assignment module is used to use the average value as the updated learning rate.

[0170] Furthermore, the input value update module includes:

[0171] The input value calculation module is used to subtract the learning rate multiplied by the corresponding gradient and then multiplied by the input value before the update for each input value before the update, so as to obtain the updated input value.

[0172] Furthermore, in the first objective function calculation module or the second objective function calculation module, determining whether to exit the loop based on the value of the objective function includes:

[0173] Calculate the value of the loss function based on the value of the objective function;

[0174] Determine if the value of the loss function satisfies the loop exit condition. If the value of the loss function satisfies the loop exit condition, exit the loop.

[0175] This invention also provides a schematic diagram of the structure of a computer device, such as... Figure 10 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 10 Take a processor 10 as an example.

[0176] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0177] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0178] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0179] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0180] The computer device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 10 Taking the example of a connection between China and Israel via a bus.

[0181] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.

[0182] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0183] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0184] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and all such modifications and variations fall within the scope of protection.

Claims

1. A gradient descent method for circuit networks, characterized in that, include: Acquire a learning rate and several input values ​​of the circuit network to be optimized, wherein the circuit network to be optimized is an antenna tuning network or a filter circuit network, and the input values ​​are the values ​​of the electronic components in the circuit network to be optimized; The input value is input into the circuit network to be optimized, and the value of the objective function obtained after testing the circuit network to be optimized by hardware is obtained. The value of the objective function is used to determine whether to exit the loop. Obtain the change amount corresponding to each of the input values, and perform a univariate update on any one of the input values ​​based on the change amount; The updated input values ​​of the single variable are sequentially input into the circuit network to be optimized, and the value of the objective function obtained after testing the circuit network to be optimized by hardware is obtained. The value of the objective function is used to determine whether to exit the loop. The input value is updated according to the learning rate, and the process of looping through the step of inputting the input value into the circuit network to be optimized is repeated. After exiting the loop, the current input value is output. Before updating the input value according to the learning rate, the process includes: Calculate the gradient corresponding to each input value based on the value of the objective function before the univariate update, the value of the objective function after the univariate update, and the amount of change; Determine whether the learning rate update condition is met based on the gradient. The learning rate is updated when the learning rate update condition is met; Calculate the gradient corresponding to each input value based on the value of the objective function before the univariate update, the value of the objective function after the univariate update, and the change, including: The gradient for each input value is calculated according to the gradient formula, wherein the gradient formula is: gradient_i = (gi - g0) / dxi; In the formula, gradient_i represents the gradient corresponding to the i-th input value, gi represents the value of the objective function obtained after the i-th input value is updated univariately, g0 represents the value of the objective function obtained before the univariate update, dxi represents the change corresponding to the i-th input value, and i is 1, 2, ..., n; Determining whether the learning rate update condition is met based on the gradient includes: Based on the gradient, it is determined whether there exists an input value that satisfies a preset condition, wherein the preset condition is: k×gradient_i×xi<dxi; In the formula, k is the learning rate, gradient_i represents the gradient corresponding to the i-th input value, xi represents the i-th input value, and dxi represents the change corresponding to the i-th input value; The learning rate update condition is satisfied when there is at least one input value that satisfies the preset condition. The learning rate is updated when the learning rate update condition is met, including: When the learning rate update condition is met, a reasonable learning rate value is calculated for each input value according to the reasonable value formula, wherein the reasonable value formula is: k_i = dxi / gradient_i × xi; In the formula, k_i is the reasonable learning rate value corresponding to the i-th input value, dxi represents the change corresponding to the i-th input value, gradient_i represents the gradient corresponding to the i-th input value, and xi represents the i-th input value; The learning rate is updated based on the reasonable value of the learning rate; Updating the learning rate based on the reasonable value of the learning rate includes: Calculate the average of all the reasonable learning rate values ​​mentioned; The average value is used as the updated learning rate.

2. The gradient descent method for circuit networks according to claim 1, characterized in that, Updating the input value according to the learning rate includes: The updated input value is obtained by subtracting the learning rate multiplied by the corresponding gradient and then multiplying it by the input value before the update for each input value before the update.

3. The gradient descent method for circuit networks according to claim 1, characterized in that, The step of determining whether to exit the loop based on the value of the objective function includes: Calculate the value of the loss function based on the value of the objective function; Determine if the value of the loss function satisfies the loop exit condition. If the value of the loss function satisfies the loop exit condition, exit the loop.

4. A gradient descent device for a circuit network, applied to the method as described in any one of claims 1 to 3, characterized in that, include: The parameter acquisition module is used to acquire the learning rate and several input values ​​of the circuit network to be optimized. The first objective function calculation module is used to input the input value into the circuit network to be optimized, and obtain the value of the objective function obtained after testing the circuit network to be optimized by hardware, and determine whether to exit the loop based on the value of the objective function; The univariate update module is used to obtain the change amount corresponding to each of the input values, and perform univariate update on any one of the input values ​​according to the change amount; The second objective function calculation module is used to sequentially input the updated input values ​​of the single variable into the circuit network to be optimized, and obtain the value of the objective function obtained after testing the circuit network to be optimized by hardware, and determine whether to exit the loop based on the value of the objective function; The input value update module is used to update the input value according to the learning rate, return to the step of inputting the input value into the circuit network to be optimized in a loop, and output the current input value after exiting the loop.

5. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the circuit network gradient descent method of any one of claims 1 to 3.

Citation Information

Patent Citations

  • Parameter updating method and device of neural network optimizer, terminal and storage medium

    CN110458287A

  • Inverter model parameter self-adaptive identification method based on steepest descent method

    CN111740575A