Optical path difference calculation method and device of convolution acceleration system, equipment and storage medium
By calculating the optical path difference and performing phase pre-compensation in the optical tensor convolution acceleration system, the phase error problem caused by the optical path difference is solved, accurate convolution results are achieved, the operation is simplified, and the cost is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUHAN POST & TELECOMM RES INST CO LTD
- Filing Date
- 2023-08-25
- Publication Date
- 2026-05-29
AI Technical Summary
In existing optical tensor convolution systems, the optical path difference caused by the unequal lengths of the two optical paths introduces phase errors, leading to incorrect convolution results.
By obtaining the difference in current amplitude between the real convolution acceleration system and the simulated convolution acceleration system, the optical path difference is calculated using the optical path adjustment method, and phase pre-compensation is performed based on the calculated optical path difference to eliminate phase errors.
It accurately calculates optical path difference, eliminates phase errors, and ensures the validity of convolution results. It is simple to operate, highly efficient, and requires no additional hardware costs.
Smart Images

Figure CN117113840B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of optical communication, optical sensing and optical computing technologies, and in particular to a method, apparatus, device and storage medium for calculating the optical path difference of a convolution acceleration system. Background Technology
[0002] Artificial neural networks (ANNs) are mathematical or computational models in machine learning and cognitive science that mimic the structure and function of biological neural networks, used for estimating or approximating functions. However, current ANNs require a large number of tensor convolution operations, which account for 55% to 90% of the total computation. Therefore, accelerating tensor convolution operations is a crucial way to improve the computational power of neural networks. To enhance the computational power of neural networks, accelerating tensor convolution operations necessitates improving the computational capabilities of the underlying neuromorphic hardware. Optical neural networks (ONNs) have emerged as a trend in next-generation neuromorphic computing due to their potential to overcome the bandwidth bottleneck of electronic artificial neural networks and their high-speed, low-power capabilities.
[0003] Currently, there are several technical approaches to realize optical tensor convolution operations. One approach utilizes IQ modulators, mixers, and balanced detectors to perform multiplication in the time domain and accelerate convolution in the frequency domain. While this system offers advantages such as integrability, programmability, and scalability, it requires equal optical path lengths for the two optical paths to perform tensor convolution operations. However, in practical systems, the various components are connected via optical fibers and cables, making it impossible to ensure equal optical path lengths. This results in an optical path difference, introducing phase errors and leading to incorrect convolution results. Therefore, calculating the optical path difference is a pressing issue that needs to be addressed. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for calculating the optical path difference in a convolution acceleration system, with the aim of calculating the optical path difference to provide a basis for eliminating phase errors.
[0005] Firstly, a method for calculating the optical path difference in a convolution acceleration system is provided, including the following steps:
[0006] The first current amplitude output by the real convolution acceleration system is obtained when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector.
[0007] The theoretical current amplitude of the simulated convolution acceleration system is obtained when the optical path difference between the two optical paths is 0. The simulated convolution acceleration system has the same structure as the real convolution acceleration system.
[0008] Based on the waveform similarity between the first current amplitude and the theoretical current amplitude, the optical path of the simulated convolution acceleration system is adjusted to different degrees to update the theoretical current amplitude until the second current amplitude is obtained, and the difference between the second current amplitude and the first current amplitude reaches the minimum difference.
[0009] The optical path difference corresponding to the second current amplitude is taken as the actual optical path difference in the real convolution acceleration system.
[0010] In some embodiments, the difference between the output current amplitude after varying degrees of optical path adjustment in the simulated convolution acceleration system and the first current amplitude is minimized using the following formula to obtain the second current amplitude:
[0011]
[0012] In the formula, d represents the difference between the current amplitude output by the simulated convolution acceleration system and the current amplitude output by the real convolution acceleration system, M represents the length of the weight tensor, N represents the length of the input tensor, and f k Let k = ij, i represent the position of the input tensor, j represent the position of the weight tensor, ΔL represent the optical path difference set in the simulated convolution acceleration system, and I represent the frequency. test (f k I represents the current amplitude output by the actual convolution acceleration system. meta (f k ΔL) represents the current amplitude output by the simulated convolution acceleration system.
[0013] In some embodiments, the method further includes:
[0014] The real convolution acceleration system determines the convolution result based on the current signal output by the first calculation formula, which is:
[0015]
[0016] In the formula, I(t) represents the current signal, α represents the photoelectric conversion efficiency, C represents the amplitude of the light source, and A i B represents the data of the i-th input tensor. j This represents the data of the j-th weight tensor. This represents the initial frequency corresponding to the input tensor. ω represents the initial frequency corresponding to the weight tensor. c ω0 represents the frequency of a narrow-linewidth single-wavelength laser source, t represents time, ω0 represents the frequency interval, ΔL represents the actual optical path difference in a real convolution acceleration system, and c represents the speed of light.
[0017] In some embodiments, the method further includes:
[0018] The optical path in the real convolution acceleration system is adjusted based on the optical path difference corresponding to the second current amplitude, so that ΔL = 0 in the first calculation formula, in order to eliminate phase error.
[0019] Secondly, a device for calculating the optical path difference of a convolution acceleration system is provided, comprising:
[0020] The first acquisition unit is used to acquire the first current amplitude output by the real convolution acceleration system when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector.
[0021] The second acquisition unit is used to acquire the theoretical current amplitude output by the simulated convolution acceleration system when the optical path difference between the two optical paths is 0. The simulated convolution acceleration system has the same structure as the real convolution acceleration system.
[0022] The optical path difference calculation unit is used to adjust the optical path of the simulated convolution acceleration system to different degrees based on the waveform similarity between the first current amplitude and the theoretical current amplitude, so as to update the theoretical current amplitude until the second current amplitude is obtained, and the difference between the second current amplitude and the first current amplitude reaches the minimum difference; the optical path difference corresponding to the second current amplitude is taken as the actual optical path difference in the real convolution acceleration system.
[0023] In some embodiments, the difference between the output current amplitude after varying degrees of optical path adjustment in the simulated convolution acceleration system and the first current amplitude is minimized using the following formula to obtain the second current amplitude:
[0024]
[0025] In the formula, d represents the difference between the current amplitude output by the simulated convolution acceleration system and the current amplitude output by the real convolution acceleration system, M represents the length of the weight tensor, N represents the length of the input tensor, and f k Let k = ij, i represent the position of the input tensor, j represent the position of the weight tensor, ΔL represent the optical path difference, and I represent the frequency. test (f k I represents the current amplitude output by the actual convolution acceleration system. meta (f k ΔL) represents the current amplitude output by the simulated convolution acceleration system.
[0026] In some embodiments, the apparatus further includes a convolution determination unit, which is used to:
[0027] The real convolution acceleration system determines the convolution result based on the current signal output by the first calculation formula, which is:
[0028]
[0029] In the formula, I(t) represents the current signal, α represents the photoelectric conversion efficiency, C represents the amplitude of the light source, and A i B represents the data of the i-th input tensor. j This represents the data of the j-th weight tensor. This represents the initial frequency corresponding to the input tensor. ω represents the initial frequency corresponding to the weight tensor. c ω0 represents the frequency of a narrow-linewidth single-wavelength laser source, t represents time, ω0 represents the frequency interval, ΔL represents the actual optical path difference in a real convolution acceleration system, and c represents the speed of light.
[0030] In some embodiments, the device further includes an optical path difference adjustment unit, which is used for:
[0031] The optical path in the real convolution acceleration system is adjusted based on the optical path difference corresponding to the second current amplitude, so that ΔL = 0 in the first calculation formula, in order to eliminate phase error.
[0032] Thirdly, an optical path difference calculation device for a convolution acceleration system is provided, comprising: a memory and a processor, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the aforementioned optical path difference calculation method for the convolution acceleration system.
[0033] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned method for calculating the optical path difference of a convolution acceleration system.
[0034] This application provides a method, apparatus, device, and storage medium for calculating the optical path difference of a convolution acceleration system. The method includes obtaining a first current amplitude output by a real convolution acceleration system when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector. It also includes obtaining a theoretical current amplitude output by a simulated convolution acceleration system when the optical path difference between the two optical paths is zero. The simulated convolution acceleration system has the same structure as the real convolution acceleration system. Based on the waveform similarity between the first current amplitude and the theoretical current amplitude, the optical paths in the simulated convolution acceleration system are adjusted to different degrees to update the theoretical current amplitude until a second current amplitude is obtained, where the difference between the second current amplitude and the first current amplitude reaches a minimum. The optical path difference corresponding to the second current amplitude is taken as the actual optical path difference existing in the real convolution acceleration system. This application enables accurate calculation of the optical path difference existing in a real convolution acceleration system, providing a basis for eliminating phase errors. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a schematic diagram of the structure of a real convolution acceleration system provided in the embodiments of this application;
[0037] Figure 2 A flowchart illustrating a method for calculating the optical path difference of a convolution acceleration system provided in an embodiment of this application;
[0038] Figure 3 This is a schematic diagram of the structure of an optical path difference calculation device for a convolution acceleration system provided in an embodiment of this application. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0040] It should be understood that the hardware structure of a real convolution acceleration system is as follows: Figure 1As shown, it mainly includes the following parts: a single-wavelength narrow-linewidth laser source 1, an optical amplification-splitting device 2, an electro-optic modulation system 3, an optical delay-amplification device 4, an optical mixer 5, a photoelectric detection device 6, a data acquisition device 7, and a computer control system 8. All of the above parts (i.e., each system and device) are connected by optical fibers and cables.
[0041] The single-wavelength narrow-linewidth laser source 1 provides a single-wavelength narrow-linewidth laser carrier for the convolution acceleration system. The optical amplification-splitting device 2 amplifies the optical carrier power and provides two coherent light sources with the same frequency and phase for the convolution acceleration system. The electro-optic modulation system 3 based on the IQ modulator modulates the optical carrier according to the input analog data and loads the input information onto the optical carrier. The optical delay-amplification device 4 adjusts the optical path between the two beams to be consistent and amplifies the power of the two beams. The optical mixer 5 based on the 180° optical bridge mixes the two input beams to generate two signal beams. The two signal beams are output through the photoelectric detection device 6 and the results are output to the computer control system 8 through the data acquisition device 7. The computer control system 8 can control the input analog data of the arbitrary waveform generator, the optical path of the adjustable optical delay line, the bias voltage of the IQ modulator, and the detection parameters of the oscilloscope, ultimately realizing the flexible and adjustable optical computing system. Thus, the real convolution acceleration system achieves convolution acceleration through the IQ modulator, mixer, and balanced detector.
[0042] For details, see Figure 1 As shown, the electro-optic modulation system 3 includes two arbitrary waveform generators (i.e., the first arbitrary waveform generator 301 and the second arbitrary waveform generator 302), two modulator drivers (i.e., the first modulator driver 303 and the second modulator driver 304), two 90° electrical phase shifters (i.e., the first 90° electrical phase shifter 305 and the second 90° electrical phase shifter 306), and two I / Q modulators (i.e., the first I / Q modulator 307 and the second I / Q modulator 308). The modulator drivers are used to generate voltages that can regulate the modulators; the 90° electrical phase shifters are used to generate two electrical drive signals with a 90° phase difference; the I / Q modulators can be controlled by a computer control system. The parameters of the arbitrary waveform generators can be set by connecting to the computer control system.
[0043] The optical amplification-splitting device 2 can be controlled by a computer control system. It mainly includes a first fiber amplifier 201 (preferably a high-power polarization-maintaining erbium-doped fiber amplifier) and a 1-to-2 splitter 202. The fiber amplifier is used to amplify the power of the light source and compensate for optical losses during system operation. The optical delay-amplification device 4 includes an adjustable optical delay line 401 and two fiber amplifiers (i.e., a second fiber amplifier 402 and a third fiber amplifier 403, preferably high-power polarization-maintaining erbium-doped fiber amplifiers). The optical mixer 5 is a 180° optical mixer (i.e., a 180° optical bridge), used to generate two optical signals with a 180° phase difference that can be responded to by the optical detection system. The photoelectric detection device 6 consists of a balanced detector and an oscilloscope. The oscilloscope can be controlled by the computer control system and returns data to the computer control system.
[0044] The following combination Figure 1 The connection relationships between the various parts of the hardware structure of a real convolution acceleration system are explained.
[0045] The output port of the single-wavelength narrow-linewidth laser source 1 is connected to the input port of the first fiber amplifier 201. The frequency of the narrow-linewidth single-wavelength laser source 1 can be set to ω. C The output port of the first fiber amplifier 201 is connected to the input port of the 1:1 beam splitter 202, while the two output ports of the 1:1 beam splitter 202 are connected to the optical input ports of the first IQ modulator 307 and the second IQ modulator 308, respectively.
[0046] The analog data input to the first arbitrary waveform generator 301 and the first arbitrary waveform generator 302 can be directly set by the computer control system 8. The signal output port of the first arbitrary waveform generator 301 is connected to the input port of the first modulator driver 303; the signal output port of the second arbitrary waveform generator 302 is connected to the input port of the second modulator driver 304; the output port of the first modulator driver 303 is connected to the input port of the first 90° phase shifter 305, and the output port of the second modulator driver 304 is connected to the input port of the second 90° phase shifter 306; the two output ports of the first 90° phase shifter 305 are respectively connected to the I and Q electrical input ports of the first IQ modulator 307, and the two output ports of the second 90° phase shifter 306 are respectively connected to the I and Q electrical input ports of the second IQ modulator 308, so that the analog data input by the computer control system 8 is finally modulated onto the optical signal after passing through the arbitrary waveform generator, the modulation driver, and the 90° phase shifter.
[0047] The optical output port of the first IQ modulator 307 is connected to the input port of the second fiber amplifier 402; the optical output port of the second IQ modulator 308 is connected to the adjustable optical delay line 401, which can be set by the computer control system 8 to ensure that the two signal lights are in phase; the output port of the adjustable optical delay line 401 is connected to the input port of the third fiber amplifier 403.
[0048] The output port of the second fiber amplifier 402 is connected to the input port ① of the optical mixer 5, and the output port of the third fiber amplifier 403 is connected to the input port ② of the optical mixer 5. The two input optical signals are mixed in the optical mixer 5 to generate two optical signals, which are output from the output ports ③ and ④ respectively.
[0049] The output port ③ of the optical mixer 5 is connected to the input port ① of the photoelectric detection device 6, and the output port ④ is connected to the input port ② of the photoelectric detection device 6. The optical signal is converted into an electrical signal by the photoelectric detection device 6. The output port of the photoelectric detection device 6 is connected to the input port of the data acquisition device 7, and the output port of the data acquisition device 7 is connected to the computer control system 8.
[0050] It should be understood that the aforementioned real convolution acceleration system requires the two optical paths to be of equal length when performing tensor convolution operations. However, because the various parts of a real convolution acceleration system need to be connected through optical fibers, cables, etc., the two optical paths often cannot be of equal length, i.e., there is an optical path difference between the two paths, which introduces phase errors and leads to incorrect convolution results. Therefore, to solve the phase error caused by the optical path difference, the optical path difference must first be calculated.
[0051] Therefore, this application provides a method, apparatus, device and storage medium for calculating optical path difference in a convolution acceleration system. The purpose is to calculate the optical path difference and then perform phase pre-compensation at the signal loading end based on the calculated optical path difference value, thereby eliminating phase errors and ensuring the validity of the convolution result.
[0052] Figure 2 This application provides a method for calculating the optical path difference of a convolution acceleration system, comprising the following steps:
[0053] Step S10: Obtain the first current amplitude output by the real convolution acceleration system when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector.
[0054] As an example, in order to calculate the optical path difference, this embodiment will first construct a system with... Figure 1The actual convolution acceleration system with the structure shown is used to accelerate convolution. The construction process of the actual convolution acceleration system is as follows: The center wavelength of the single-wavelength narrow-linewidth laser source 1 is set to 1550.118nm and the power is set to 0dBm. To ensure that the input power of the photodetector 6 is strong enough, a large power gain needs to be set, for example, the power gain of the optical amplifier is set to 23dB. Then, the computer control system 8 inputs analog data into the first arbitrary waveform generator 301 and the second arbitrary waveform generator 302, so that the first arbitrary waveform generator 301 and the second arbitrary waveform generator 302 generate corresponding electrical signals according to the input analog data. The two electrical signals are amplified by the first modulator driver 303 and the second modulator driver 304 respectively, and are input into the first 90° electrical phase shifter 305 and the second 90° electrical phase shifter 306 respectively to generate I and Q electrical signals, which are then input into the electrical modulation input ports of the IQ modulator, and finally the input analog data is loaded onto the optical carrier.
[0055] The computer control system 8 is used to set an adjustable optical delay line 401 to ensure that the two optical signals are in phase. The obtained in-phase optical signals are input to the second fiber amplifier 402 and the third fiber amplifier 403. The computer control system 8 controls the output gain of the second fiber amplifier 402 and the third fiber amplifier 403 to amplify the optical signals, but not exceeding the power linear receiving range of the photodetector 6. Then, the two optical signals are input to the optical mixer 5 through input ports ① and ②. After passing through the 180° optical bridge, the two optical signals generate optical mixing signals with a phase difference of 0° and 180° respectively at output ports ③ and ④. The obtained optical mixing signals with a phase difference of 0° and 180° are then input to the photodetector 6. The current generated by the photodetector 6 is collected by the data acquisition device 7 and finally uploaded to the computer control system 8 for processing to obtain the final calculation result.
[0056] Because the two optical paths in the real convolution acceleration system are not of equal length, the real convolution acceleration system will perform accelerated convolution with a non-zero optical path difference between the two paths, thereby outputting a first current amplitude. It should be noted that due to the optical path difference between the two paths, there will be a certain deviation between the aforementioned first current amplitude and the theoretical current amplitude corresponding to the absence of an optical path difference. Therefore, this embodiment will obtain the first current amplitude output by the real convolution acceleration system when the optical path difference between the two paths is not zero, for comparison with the current amplitude output by the simulated convolution acceleration system.
[0057] Step S20: Obtain the theoretical current amplitude output by the simulated convolution acceleration system when the optical path difference between the two optical paths is 0. The simulated convolution acceleration system has the same structure as the real convolution acceleration system.
[0058] As an example, in this embodiment, a system with similar characteristics to a convolution acceleration system will be built within a digital computer, based on the principles of such a system. Figure 1 The simulated convolution acceleration system shown is a digital twin system with the same principle as the real convolution acceleration system. Then, the simulated convolution acceleration system is accelerated convolution under theoretical conditions. That is, before the simulated convolution acceleration system is accelerated convolution, the optical path difference between the two paths is set to 0, and then the simulated convolution acceleration system is accelerated convolution. At this time, the current amplitude output by the simulated convolution acceleration system is the theoretical current amplitude.
[0059] Step S30: Based on the waveform similarity between the first current amplitude and the theoretical current amplitude, the optical path in the simulated convolution acceleration system is adjusted to different degrees to update the theoretical current amplitude until a second current amplitude is obtained, and the difference between the second current amplitude and the first current amplitude reaches the minimum difference; wherein, the difference between the output current amplitude after adjusting the optical path in the simulated convolution acceleration system to different degrees and the first current amplitude is minimized by the following calculation formula to obtain the second current amplitude:
[0060]
[0061] In the formula, d represents the difference between the current amplitude output by the simulated convolution acceleration system and the current amplitude output by the real convolution acceleration system, M represents the length of the weight tensor, N represents the length of the input tensor, and f k Let k = ij, i represent the position of the input tensor, j represent the position of the weight tensor, ΔL represent the optical path difference set in the simulated convolution acceleration system, and I represent the frequency. test (f k I represents the current amplitude output by the actual convolution acceleration system. meta (f k ΔL) represents the current amplitude output by the simulated convolution acceleration system.
[0062] It should be understood, as an example, that the waveform corresponding to the current amplitude with optical path difference output is definitely different from the waveform corresponding to the current amplitude without optical path difference output; that is, the two waveforms are different and cannot overlap.
[0063] Therefore, in this embodiment, the adjustable optical delay line 401 in the simulated convolution acceleration system is continuously adjusted based on the difference between the waveform corresponding to the first current amplitude and the waveform corresponding to the theoretical current amplitude. This means the optical path difference between the two optical paths is continuously adjusted, allowing the simulated convolution acceleration system to perform convolution acceleration under different optical path differences between the two optical paths. This adjusts the waveform corresponding to the theoretical current amplitude to output different current amplitudes and their corresponding waveforms. The adjustment continues until the waveform corresponding to the current amplitude output by the simulated convolution acceleration system essentially overlaps or completely overlaps with the waveform corresponding to the first current amplitude, or reaches a preset overlap level. In other words, the difference between the second current amplitude and the first current amplitude reaches its minimum, and the adjustment of the optical path difference between the two optical paths in the simulated convolution acceleration system stops. It can be understood that the optical path difference adjusted to achieve the waveform state corresponding to the theoretical current amplitude to the waveform state corresponding to the second current amplitude is the actual optical path difference present in the real convolution acceleration system.
[0064] In this embodiment, when comparing the convolution calculation results of the real convolution acceleration system with the results of the simulated convolution acceleration system, a conventional search optimization algorithm can be used to minimize the difference between the two results and update the state of the simulated convolution acceleration system until the difference is minimized. It should be noted that the minimization process can be implemented by calling optimizers in mature programs such as Python / MATLAB.
[0065] Specifically, after building a real convolution acceleration system and a corresponding simulated convolution acceleration system, different convolution data and frequencies are configured to read the output result of the real convolution acceleration system (i.e., the current amplitude I). test (f k And compared with the output of the simulated convolution acceleration system (i.e., the current amplitude I) meta (f k Compare ,ΔL) and minimize using the following formula:
[0066]
[0067] In the formula, d represents the difference between the current amplitude output by the real convolution acceleration system and the current amplitude output by the simulated convolution acceleration system, M represents the length of the weight tensor, N represents the length of the input tensor, and f k The frequency is represented by k = ij, where i represents the position of the input tensor, j represents the position of the weight tensor, and ΔL represents the optical path difference set in the simulated convolution acceleration system.
[0068] Step S40: The optical path difference corresponding to the second current amplitude is taken as the actual optical path difference existing in the real convolution acceleration system.
[0069] In this exemplary embodiment, since the waveform corresponding to the second current amplitude is substantially or completely overlapped with the waveform corresponding to the first current amplitude, the optical path difference between the two optical paths in the simulated convolution acceleration system is the same as that in the real convolution acceleration system when outputting the second current amplitude. Therefore, when the adjustable optical delay line 401 is adjusted to make the waveform state corresponding to the theoretical current amplitude reach the waveform state corresponding to the second current amplitude, the adjustment amount of the optical path difference corresponding to the adjustable optical delay line 401 is the actual optical path difference in the real convolution acceleration system. For example, when the waveform state corresponding to the theoretical current amplitude reaches the waveform state corresponding to the first current amplitude, the adjustment amount of the optical path difference corresponding to the adjustable optical delay line 401 in the simulated convolution acceleration system is 0.1 meters, then the actual optical path difference between the two optical paths in the real convolution acceleration system is 0.1 meters.
[0070] Furthermore, the method also includes:
[0071] The real convolution acceleration system determines the convolution result based on the current signal output by the first calculation formula, which is:
[0072]
[0073] In the formula, I(t) represents the current signal, α represents the photoelectric conversion efficiency, C represents the amplitude of the light source, and A i B represents the data of the i-th input tensor. j This represents the data of the j-th weight tensor. This represents the initial frequency corresponding to the input tensor. ω represents the initial frequency corresponding to the weight tensor. c ω0 represents the frequency of a narrow-linewidth single-wavelength laser source, t represents time, ω0 represents the frequency interval, ΔL represents the actual optical path difference in a real convolution acceleration system, and c represents the speed of light.
[0074] As an example, in this embodiment, the mathematical principle behind the implementation of convolution acceleration in a real convolution acceleration system is as follows:
[0075] Suppose that the data for the input tensor is input at the first arbitrary waveform generator 301, and is defined as follows: Among them, A i This is the data of the input tensor, where N represents the length of the input tensor. This is the initial frequency corresponding to the input tensor, and ω0 represents the frequency interval. Assuming the frequency interval is 500 MHz, then the frequency interval between adjacent input tensors is 500 MHz. For example, the frequency interval between A1 and A2 is 500 MHz, and the frequency interval between A2 and A3 is also 500 MHz. Let the data of the weight tensor be input at the second arbitrary waveform generator 302, defined as... Among them, B j The data is for the weight tensor, where M represents the length of the weight tensor. This represents the initial frequency corresponding to the weight tensor, and has...
[0076] Let modulated single-wavelength narrow-linewidth laser source 1 be C cos(ω c t), C is the amplitude of the light source, and the output signals of the first IQ modulator 307 and the second IQ modulator 308 can be expressed as:
[0077]
[0078]
[0079] After the two output signals are received by the input terminals ① and ② of the optical mixer 5, respectively, optical mixing signals E1(t) and E2(t) with a phase difference of 0° and 180° are generated at the output ports ③ and ④.
[0080] E1(t)=M s1 (t)+M s2 (t) (3)
[0081] E2(t)=M s1 (t)-M s2 (t) (4)
[0082] Subsequently, the optical mixing signals E1(t) and E2(t) generated by the output ports ③ and ④ of the optical mixer 5 are received and detected by the input ports ① and ② of the photodetector 6, respectively, and the output electrical signals of the photodetector 6 are I1(t) and I2(t), respectively, where α is the photoelectric conversion efficiency, determined by the performance of the photodetector. Due to the optical path difference ΔK, the generated current is:
[0083]
[0084] Understandably, the operating bandwidth of a detector is often limited, therefore the actual current output is:
[0085]
[0086] Furthermore, this implementation will also use a bandpass filter to filter the frequency in I(t) to 0. The signal is filtered out, and then the current amplitude is read:
[0087]
[0088] Among them, f C =ω c / 2π, f0 = ω0 / 2π.
[0089] It is important to note that when setting the initial frequencies of the input tensor and the weight tensor, the following conditions must be met. z∈Z, where z represents an integer and Z represents the set of integers; otherwise, mirror frequencies would overlap, i.e., The amplitudes of the frequency waveforms are superimposed, which renders the results invalid.
[0090] Then, the above electrical signals are acquired by the data acquisition device 7 and output to the computer control system 8. The convolution result will then be given by formula (6).
[0091] It should be noted that the input tensor Length N and weight tensor The lengths M are all adjustable. Therefore, arbitrary convolution operations can be performed at the computer control system level (where N and M are constrained by the orthogonal frequency interval of the electrical signals and the operating bandwidth of the optical and electrical devices), so as to achieve adjustable configuration.
[0092] Furthermore, the method also includes:
[0093] The optical path in the real convolution acceleration system is adjusted based on the optical path difference corresponding to the second current amplitude, so that ΔL = 0 in the first calculation formula, in order to eliminate phase error.
[0094] As an example, in this embodiment, after determining the actual optical path difference in the real convolution acceleration system, the adjustable optical delay line 401 in the real convolution acceleration system will be adjusted based on the actual optical path difference, that is, the optical path in the real convolution acceleration system will be adjusted so that ΔL = 0 in formula (6), so as to achieve phase pre-compensation at the signal loading end, thereby eliminating phase error and ensuring the validity of the convolution result.
[0095] Therefore, this embodiment can achieve accurate calculation of optical path difference without adding additional hardware costs outside the convolution acceleration system. It is not only simple to operate, efficient and low in cost, but also does not require repeated calculations. In addition, after the optical path difference is calculated, it can be easily adjusted to ensure that the convolution acceleration system can achieve convolution acceleration, which is of great significance in the field of optical computing.
[0096] It should be noted that the step numbers in the embodiments of this application do not limit the order of operations in the technical solution of this application.
[0097] This application provides an optical path difference calculation device for a convolution acceleration system, comprising:
[0098] The first acquisition unit is used to acquire the first current amplitude output by the real convolution acceleration system when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector.
[0099] The second acquisition unit is used to acquire the theoretical current amplitude output by the simulated convolution acceleration system when the optical path difference between the two optical paths is 0. The simulated convolution acceleration system has the same structure as the real convolution acceleration system.
[0100] The optical path difference calculation unit is used to evaluate the waveform similarity between the first current amplitude and the theoretical current amplitude, and to adjust the optical path of the simulated convolution acceleration system to different degrees based on the waveform similarity between the first current amplitude and the theoretical current amplitude, so as to update the theoretical current amplitude until the second current amplitude is obtained, and the difference between the second current amplitude and the first current amplitude reaches the minimum difference; the optical path difference corresponding to the second current amplitude is taken as the actual optical path difference in the real convolution acceleration system.
[0101] Furthermore, the difference between the output current amplitude after adjusting the optical path of the optical path in the simulated convolution acceleration system to different degrees and the first current amplitude is minimized by a calculation formula to obtain the second current amplitude:
[0102]
[0103] In the formula, d represents the difference between the current amplitude output by the real convolution acceleration system and the current amplitude output by the simulated convolution acceleration system, M represents the length of the weight tensor, N represents the length of the input tensor, and f k Let k = ij, i represent the position of the input tensor, j represent the position of the weight tensor, ΔL represent the optical path difference set in the simulated convolution acceleration system, and I represent the frequency. test (f k I represents the current amplitude output by the actual convolution acceleration system. meta (f k ΔL) represents the current amplitude output by the simulated convolution acceleration system.
[0104] Furthermore, the apparatus also includes a convolution determination unit, which is used for:
[0105] The real convolution acceleration system determines the convolution result based on the current signal output by the first calculation formula, which is:
[0106]
[0107] In the formula, I(t) represents the current signal, α represents the photoelectric conversion efficiency, C represents the amplitude of the light source, and Ai B represents the data of the i-th input tensor. j This represents the data of the j-th weight tensor. This represents the initial frequency corresponding to the input tensor. ω represents the initial frequency corresponding to the weight tensor. c ω0 represents the frequency of a narrow-linewidth single-wavelength laser source, t represents time, ω0 represents the frequency interval, ΔL represents the actual optical path difference in a real convolution acceleration system, and c represents the speed of light.
[0108] Furthermore, the device also includes an optical path difference adjustment unit, which is used for:
[0109] The optical path in the real convolution acceleration system is adjusted based on the optical path difference corresponding to the second current amplitude, so that ΔL = 0 in the first calculation formula, in order to eliminate phase error.
[0110] It should be noted that those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the optical path difference calculation device and each unit of the convolution acceleration system described above can be referred to the corresponding process in the aforementioned embodiment of the optical path difference calculation method for the convolution acceleration system, and will not be repeated here.
[0111] The optical path difference calculation device for the convolution acceleration system provided in the above embodiments can be implemented as a computer program, which can be used in, for example... Figure 3 The optical path difference calculation device of the convolution acceleration system shown is running.
[0112] This application also provides an optical path difference calculation device for a convolution acceleration system, including: a memory, a processor, and a network interface connected via a system bus. The memory stores at least one instruction, which is loaded and executed by the processor to implement all or part of the steps of the aforementioned optical path difference calculation method for the convolution acceleration system.
[0113] The network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0114] A processor can be a CPU, or other general-purpose processors, DSPs (Digital Signal Processors), ASICs (Application Specific Integrated Circuits), FPGAs (Field Programmable Gate Arrays), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor, or any conventional processor. The processor is the control center of a computer device, connecting all parts of the computer device through various interfaces and lines.
[0115] Memory can be used to store computer programs and / or modules. The processor performs various functions of the computer device by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can primarily include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on system usage, etc. Furthermore, memory may include high-speed random access memory (RAM), and may also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, SMC (Smart Media Card), SD (Secure Digital) cards, flash memory cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0116] This application also provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements all or part of the steps of the aforementioned method for calculating the optical path difference of the convolution acceleration system.
[0117] The embodiments of this application can implement all or part of the aforementioned processes, or they can be accomplished by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various methods described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, ROM (Read-Only memory), RAM (Random Access memory), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0118] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, servers, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0119] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0120] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0121] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for calculating the optical path difference in a convolution acceleration system, characterized in that, Includes the following steps: The first current amplitude output by the real convolution acceleration system is obtained when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector. The theoretical current amplitude of the simulated convolution acceleration system is obtained when the optical path difference between the two optical paths is 0. The simulated convolution acceleration system has the same structure as the real convolution acceleration system. Based on the waveform similarity between the first current amplitude and the theoretical current amplitude, the optical path of the simulated convolution acceleration system is adjusted to different degrees to update the theoretical current amplitude until the second current amplitude is obtained, and the difference between the second current amplitude and the first current amplitude reaches the minimum difference. The optical path difference corresponding to the second current amplitude is taken as the actual optical path difference in the real convolution acceleration system; The difference between the output current amplitude after adjusting the optical path of the optical path in the simulated convolution acceleration system to different degrees and the first current amplitude is minimized by the following calculation formula to obtain the second current amplitude: In the formula, This represents the difference between the current amplitude output by the simulated convolution acceleration system and the current amplitude output by the real convolution acceleration system. M This represents the length of the weight tensor. N Indicates the length of the input tensor. Indicates frequency, k=i - j , i Indicates the position of the input tensor. j This indicates the position of the weight tensor. This represents the optical path difference set in the simulated convolution acceleration system. This represents the current amplitude output by the actual convolution acceleration system. This represents the current amplitude output by the simulated convolution acceleration system.
2. The method for calculating the optical path difference of a convolution acceleration system as described in claim 1, characterized in that, The method further includes: The real convolution acceleration system determines the convolution result based on the current signal output by the first calculation formula, which is: In the formula, Represents a current signal. Indicates photoelectric conversion efficiency. Indicates the amplitude of the light source. Indicates the first i The data of the input tensor Indicates the first j Data for a weighted tensor This represents the initial frequency corresponding to the input tensor. This represents the initial frequency corresponding to the weight tensor. This indicates the frequency of a narrow-linewidth single-wavelength laser source. t Indicates time, Indicates the frequency interval. This represents the actual optical path difference present in a real convolution acceleration system. It represents the speed of light.
3. The method for calculating the optical path difference of a convolution acceleration system as described in claim 2, characterized in that, The method further includes: The optical path in the real convolution acceleration system is adjusted based on the optical path difference corresponding to the second current amplitude, so that the optical path in the first calculation formula is adjusted accordingly. =0 to eliminate phase error.
4. A device for calculating the optical path difference of a convolution acceleration system, characterized in that, include: The first acquisition unit is used to acquire the first current amplitude output by the real convolution acceleration system when the optical path difference between the two optical paths is not zero. The real convolution acceleration system achieves convolution acceleration through an IQ modulator, a mixer, and a balanced detector. The second acquisition unit is used to acquire the theoretical current amplitude output by the simulated convolution acceleration system when the optical path difference between the two optical paths is 0. The simulated convolution acceleration system has the same structure as the real convolution acceleration system. The optical path difference calculation unit is used to adjust the optical path of the optical path in the simulated convolution acceleration system to different degrees based on the waveform similarity state between the first current amplitude and the theoretical current amplitude, so as to update the theoretical current amplitude until the second current amplitude is obtained, and the difference between the second current amplitude and the first current amplitude reaches the minimum difference. The optical path difference corresponding to the second current amplitude is taken as the actual optical path difference in the real convolution acceleration system; The difference between the output current amplitude after adjusting the optical path of the optical path in the simulated convolution acceleration system to different degrees and the first current amplitude is minimized by the following calculation formula to obtain the second current amplitude: In the formula, This represents the difference between the current amplitude output by the simulated convolution acceleration system and the current amplitude output by the real convolution acceleration system. M This represents the length of the weight tensor. N Indicates the length of the input tensor. Indicates frequency, k=i - j , i Indicates the position of the input tensor. j This indicates the position of the weight tensor. Indicates optical path difference, This represents the current amplitude output by the actual convolution acceleration system. This represents the current amplitude output by the simulated convolution acceleration system.
5. The optical path difference calculation device for the convolution acceleration system as described in claim 4, characterized in that, The apparatus further includes a convolution determination unit, which is used for: The real convolution acceleration system determines the convolution result based on the current signal output by the first calculation formula, which is: In the formula, Represents a current signal. Indicates photoelectric conversion efficiency. Indicates the amplitude of the light source. Indicates the first i The data of the input tensor Indicates the first j Data for a weighted tensor This represents the initial frequency corresponding to the input tensor. This represents the initial frequency corresponding to the weight tensor. This indicates the frequency of a narrow-linewidth single-wavelength laser source. t Indicates time, Indicates the frequency interval. This represents the actual optical path difference present in a real convolution acceleration system. It represents the speed of light.
6. The optical path difference calculation device for the convolution acceleration system as described in claim 5, characterized in that, The device further includes an optical path difference adjustment unit, which is used for: The optical path in the real convolution acceleration system is adjusted based on the optical path difference corresponding to the second current amplitude, so that the optical path in the first calculation formula is adjusted accordingly. =0 to eliminate phase error.
7. An optical path difference calculation device for a convolution acceleration system, characterized in that, include: A memory and a processor, wherein the memory stores at least one instruction, which is loaded and executed by the processor to implement the optical path difference calculation method of the convolution acceleration system according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program that, when executed by a processor, implements the optical path difference calculation method for the convolution acceleration system according to any one of claims 1 to 3.