This disclosure relates to the field of optical computing technologies, and in particular, to an optical computing apparatus and system, and a convolution computing method.
An artificial neural network (ANN) is a computing model that simulates the human brain to process information, and a convolutional neural network (CNN) is a new ANN proposed in the 1990s and has been widely used in the fields of image processing, video processing, natural language processing, and the like. A core operation in the CNN is convolution. In a conventional convolution computing manner, a convolution operation needs to be decomposed into a plurality of vector or matrix multiplication operations, which consumes much computing power.
Optical computing can implement large-scale parallel signal processing and transmission based on a physical property of light, and has advantages, such as a fast computing speed and low power consumption. However, in the conventional technology, on-chip optical convolution based on an optical chip of a cascaded Mach-Zehnder interferometer (MZI) is implemented by decomposing convolution into a plurality of matrix multiplications, and therefore has low computing efficiency.
This disclosure provides an optical computing apparatus and system, and a convolution computing method, to improve computing efficiency of a convolutional neural network.
According to a first aspect, an embodiment of the present disclosure provides an optical computing apparatus, which is applied to the field of artificial neural networks to perform convolution computing. The optical computing apparatus includes a light source array, a modulator array, and a wavelength router. The light source array is configured to send a plurality of groups of optical signals based on first data to be computed, where each group of optical signals includes a plurality of optical signals obtained based on all elements in the first data, and the first data includes a plurality of elements. The modulator array is configured to receive the plurality of groups of optical signals, and output a plurality of intermediate optical signals based on modulated second data. The wavelength router is configured to receive the plurality of intermediate optical signals output by the modulator array, and output the plurality of intermediate optical signals from a plurality of output ports based on wavelengths and input ports corresponding to the plurality of intermediate optical signals, where a plurality of optical signals output by the plurality of output ports are used to indicate a computing result of the first data and the second data. In an application, the first data may include a vector or a matrix, and the second data may also include a vector or a matrix.
The optical computing apparatus provided in this embodiment of the present disclosure is an on-chip integrated optical convolution system based on the wavelength router. The computing apparatus can implement a convolution operation at one time without splitting convolution computing into a plurality of matrix multiplication operations. This can improve computing efficiency of convolution computing, and improve performance of a neural network. In addition, a core component in the optical computing apparatus provided in this embodiment of the present disclosure is the wavelength router. The wavelength router can be designed according to a convolution operation rule. In a process of performing the convolution operation, no external control is required, and no power consumption is generated. Therefore, the optical computing apparatus provided in this embodiment of the present disclosure can reduce computing power consumption. Further, because a component in the optical computing apparatus provided in this embodiment of the present disclosure may be an on-chip component, the optical computing apparatus may exist in a form of a chip, and an integration degree is high.
In a possible implementation, a first output port in the plurality of output ports is configured to output at least two intermediate optical signals, and each of the at least two intermediate optical signals is used to indicate a product of an element in the first data and an element in the second data. In an application, in a process of implementing convolution of vectors, the wavelength router may route a plurality of intermediate optical signals used to indicate products of elements with a sequence number difference that is the same as a sequence number difference (i-j) of an element a1 in the first data and an element bj in the second data to a same output port, where i indicates a sequence number of the element a1 in the first data, and j indicates a sequence number of the element bj in the second data. For example, the wavelength router may route an intermediate optical signal used to indicate a product a1b2 and an intermediate optical signal used to indicate a product a2b3 to a same output port.
In another possible implementation, each element in the first data corresponds to an optical signal of one wavelength, and a plurality of optical signals belonging to a same group have different wavelengths.
In still another possible implementation, the wavelength router includes an arrayed waveguide grating router (AWGR) or an etched diffraction grating router (EDGR). The AWGR and the EDGR each are a planar waveguide device that implements a routing function based on multi-beam interference. In addition, the AWGR and the EDGR may be designed in advance according to a convolution operation rule, and no additional control is required during working. Therefore, the AWGR and the EDGR each can be easily implemented on a chip and can save power consumption.
In still another possible implementation, the optical computing apparatus further includes a detector array. The detector array includes a plurality of detectors configured to detect light intensities of the optical signals at the plurality of output ports of the wavelength router, to obtain the computing result of the first data and the second data. Further, the computing result of the first data and the second data includes a result of performing convolution on the first data and the second data.
In still another possible implementation, the modulator array includes the plurality of modulators, and each modulator is configured to receive one of the plurality of groups of optical signals, and output a plurality of intermediate optical signals based on modulated data.
In still another possible implementation, the light source array includes a light emitting array and an optical splitting device. The light emitting array is configured to separately emit a plurality of optical signals of different wavelengths based on a plurality of elements in the first data, where each optical signal is used to indicate one element in the first data. The optical splitting device is configured to receive the plurality of optical signals of different wavelengths emitted by the light emitting array, and split the plurality of optical signals of different wavelengths into the plurality of groups of optical signals.
In still another possible implementation, the light emitting array includes a plurality of lasers. The plurality of lasers can send a plurality of optical signals based on the plurality of elements in the first data, where the plurality of optical signals have different wavelengths. In addition, the plurality of optical signals also have different light intensities, and the light intensities of the plurality of optical signals are determined based on values of corresponding elements. The light emitting array is directly implemented by using the laser capable of modulating a light intensity, and the structure is simple.
In still another possible implementation, the light emitting array includes a plurality of lasers and a plurality of modulators. The plurality of lasers are configured to send a plurality of optical signals of different wavelengths. The modulators are configured to receive the plurality of optical signals of different wavelengths, and respectively modulate the plurality of elements in the first data to the plurality of optical signals of different wavelengths. In this case, the plurality of lasers do not have a light intensity modulation function, and therefore, the plurality of elements in the first data need to be modulated by the modulators on the plurality of optical signals of different wavelengths sent by the lasers. It may be understood that, a light intensity of the optical signal modulated by the modulator is determined by a value of a modulated element.
In still another possible implementation, the light emitting array includes an optical frequency comb source, a wavelength division demultiplexer, and a plurality of modulators. The optical frequency comb source is configured to send an optical signal, where the optical signal includes a plurality of different wavelengths. The wavelength division demultiplexer is configured to receive the optical signal emitted by the optical frequency comb source, and decompose the optical signal into a plurality of optical signals of different wavelengths. The plurality of modulators are configured to receive the plurality of optical signals of different wavelengths sent by the wavelength division demultiplexer, and respectively modulate the plurality of elements in the first data to the plurality of optical signals of different wavelengths. In this implementation, the optical frequency comb source, the wavelength division demultiplexer, and the plurality of modulators are all connected through waveguides.
In still another possible implementation, the optical splitting device includes a wavelength division multiplexer and a beam splitter. The wavelength division multiplexer is configured to receive the plurality of optical signals of different wavelengths emitted by the light emitting array, and combine the plurality of optical signals of different wavelengths into a first group of optical signals. The beam splitter is configured to decompose the first group of optical signals into a plurality of groups of optical signals, where each group of optical signals includes the first group of optical signals.
In still another possible implementation, the optical splitting device includes a planar waveguide, and the planar waveguide is configured to split, in space, the plurality of optical signals of different wavelengths emitted by the light emitting array into the plurality of groups of optical signals.
In still another possible implementation, the optical splitting device includes a light splitting element and a planar waveguide. The light splitting element is configured to split the plurality of optical signals of different wavelengths emitted by the light emitting array into n groups of optical signals, where n is a quantity of elements in the second data, and n is an integer greater than 1. The planar waveguide is configured to transmit the plurality of optical signals of different wavelengths split by the optical splitting device to the modulator array, where the modulator array includes n modulators, and each modulator is configured to receive one of the n groups of optical signals, and each group of optical signals includes the plurality of optical signals of different wavelengths emitted by the light emitting array.
In still another possible implementation, the optical computing apparatus includes a chip. Because a component in the optical computing apparatus provided in embodiments of the present disclosure may be an on-chip component, the optical computing apparatus may exist in a form of a chip, and an integration degree is high.
According to a second aspect, an embodiment of the present disclosure provides an optical computing system. The optical computing system includes a processor and the optical computing apparatus according to any one of the first aspect or the implementations of the first aspect that is connected to the processor. The processor is configured to send at least one of first data and second data to the optical computing apparatus.
According to a third aspect, an embodiment of the present disclosure provides a convolution computing method. The method is performed by the optical computing apparatus according to any one of the first aspect or the implementations of the first aspect.
To describe technical solutions in some embodiments of the present disclosure more clearly, the following briefly describes the accompanying drawings for describing embodiments. It is clear that the accompanying drawings in the following description show merely some embodiments of the present disclosure.
To make a person skilled in the art better understand the technical solutions in the present disclosure, the following clearly describes the technical solutions in embodiments of the present disclosure with reference to the accompanying drawings in embodiments of the present disclosure. It is clear that the described embodiments are merely a part but not all of embodiments of the present disclosure.
Convolution is a core operation in the field of artificial nerves. Convolution is a result obtained by multiplying two variables in a range to obtain a product and then adding up the products. Further, convolution starts from a convolution kernel (or a weight matrix), so that the convolution kernel gradually “scans” input data. When the convolution kernel “slides”, a product of the weight matrix and a scanned data matrix is computed. A convolution computing result (or output data) is obtained by summarizing computing results. A convolution operation of data A and data B may be expressed as follows: A⊗B. When the data A and the data B each are a vector including a plurality of elements, the convolution operation of the data A and the data B is a convolution operation between vectors. When the data A and the data B each are a matrix including a plurality of elements, the convolution operation of the data A and the data B is a convolution operation between matrices. The data A may be considered as a convolution kernel, the data B may be referred to as input data, and vice versa. A person skilled in the art may know that the convolution kernel usually slides based on a “sliding step”, and the “sliding step” is usually 1, or may be set to another value as required. In the field of artificial intelligence (AI), convolution may be described as h(step)=Σnf(n)g(n−step). In this description, a vector (or a matrix) h is obtained through convolution of a vector (or a matrix) f and a vector (or a matrix) g, where n is an order used for integration, and step is a sliding step in convolution computing.
An integrated optical circuit (or photonic integrated circuit (PIC)) generally integrates components such as a light emitting element, a lens, an optical transmission component, an optical modulation component, an optical coupling component, and an optical receiving component onto a same chip by using an optical waveguide. Integrated optics can implement miniaturization and integration of optical systems. Compared with a system composed of discrete optical components, a size, power consumption, and reliability of an integrated photonic chip are greatly improved, and system costs are greatly reduced.
However, in conventional convolution computing, a convolution operation is usually decomposed into a multiplication operation of a plurality of sub-vectors or submatrices, which consumes much computing power. Optical computing is also used to implement convolution computing because of its advantages of high computing speed and low power consumption. However, in an existing solution for implementing convolution by using optical computing, a matrix multiplication operation is usually implemented, and convolution needs to be implemented in a plurality of cycles. Efficiency is still low.
The light source array 102 may be configured to send a plurality of groups of optical signals based on first data to be computed. The first data may include a plurality of elements, each group of optical signals includes a plurality of optical signals obtained based on all the elements in the first data, and a plurality optical signals belonging to a same group have different wavelengths. For clarity of description, in this embodiment of the present disclosure, a plurality of optical signals sent to one modulator are referred to as a group of optical signals. Further, the light source array 102 may send a plurality of optical signals based on each element in the first data, and optical signals corresponding to different elements have different wavelengths. Assuming that the first data includes m elements, the light source array 102 may send m optical signals of different wavelengths based on the m elements, and split the m optical signals of different wavelengths into a plurality of groups of optical signals based on a quantity of elements in second data. For example, assuming that the first data includes elements a1 and a2, the light source array 102 may send, based on a1, a plurality of optical signals whose wavelengths are λ1, and may also send, based on a2, a plurality of optical signals whose wavelengths are λ2. The light source array 102 may load data in an intensity modulation manner. For example, different light intensities may be used to represent elements of different values in the first data. After a plurality of optical signals are respectively obtained based on the elements a1 and a2, the plurality of optical signals emitted based on the elements a1 and a2 may be split into a plurality of groups of optical signals. Each group of optical signals includes an optical signal whose wavelength is λ1 and an optical signal whose wavelength is λ2 that are emitted based on the elements a1 and a2. Assuming that there are four elements in the second data, the plurality of optical signals obtained based on the elements a1 and a2 need to be split into four groups of optical signals, where each group of optical signals includes an optical signal whose wavelength is λ1 and an optical signal whose wavelength is λ2.
The modulator array 104 can modulate an intensity of incident light, which is equivalent to performing a multiplication operation on an input optical signal. The modulator array 104 is configured to receive the plurality of groups of optical signals, and output a plurality of intermediate optical signals based on the modulated second data. The modulator array 104 may include a plurality of modulators. Each modulator is configured to receive one of the plurality of groups of optical signals sent by the light source array 102, and separately modulate the plurality of received optical signals based on elements in second data loaded on the modulator, to obtain the plurality of intermediate optical signals. In this manner, each modulator can obtain the plurality of optical signals of different wavelengths sent by the light source array 102, and can separately modulate the plurality of received optical signals of different wavelengths based on the elements loaded on the modulator, to obtain the plurality of intermediate optical signals. A plurality of intermediate optical signals obtained by one modulator are respectively used to indicate products of an element in the second data loaded on the modulator and all the elements in the first data. The plurality of intermediate optical signals obtained by the modulator array 104 are respectively used to indicate products of elements in the first data and elements in the second data. Each intermediate optical signal is used to indicate a product of an element in the first data and an element in the second data.
The modulator array 104 may load the second data in an intensity modulation manner to perform the multiplication operation on the input optical signal. For example, if the first data to be computed includes m (m≥2) elements and the second data to be computed includes n (n≥2) elements, each modulator in the modulator array 104 may load one of the n elements, and n modulators in the modulator array 104 may respectively load the n elements in the second data. Each modulator is configured to receive a group of optical signals sent by the light source array 102, where the group of optical signals includes m optical signals of different wavelengths used to indicate the elements in the first data, and output the plurality of intermediate optical signals based on the modulated data, so as to obtain n×m intermediate optical signals. The n×m intermediate optical signals are used to indicate products of elements in the first data and elements in the second data. Each of the n×m intermediate optical signals is used to indicate a product of an element in the first data and an element in the second data.
In an application, the modulator usually performs thermal modulation, electrical modulation, or modulation by using a phase change material. Electrical modulation may be implemented by using structures such as a doped silicon waveguide, an electro-absorption modulator, and a semiconductor optical amplifier (SOA). When the data loaded on the modulator array does not need to change rapidly, a solution such as the phase change material (PCM) may also be used.
The wavelength router 106 is configured to receive the plurality of intermediate optical signals output by the modulator array 104, and output the plurality of intermediate optical signals from a plurality of output ports based on the wavelengths and input ports corresponding to the plurality of intermediate optical signals. A plurality of optical signals output by the plurality of output ports are used to indicate a computing result of the first data and the second data. In an application, each modulator in the modulator array 104 may correspond to an input port of the wavelength router 106. Further, each modulator in the modulator array 104 may be connected to an input port corresponding to the wavelength router 106 through a waveguide. A quantity of modulators in the modulator array 104 may be equal to a quantity of input ports of the wavelength router 106.
The wavelength router 106 is a component for routing an optical signal. The wavelength router 106 may implement a routing function based on multi-beam interference. The wavelength router 106 includes a plurality of input ports and a plurality of output ports. For any input port and any output port, there is an optical signal of one wavelength, to enable that the input port is connected to the output port. In this manner, the wavelength router 106 can determine an output port corresponding to an intermediate optical signal based on a wavelength of the received intermediate optical signal and an input port corresponding to the intermediate optical signal. To implement convolution of the first data and the second data, in this embodiment of the present disclosure, intermediate optical signals that need to be summed can be routed to a same output port. As described above, one intermediate optical signal is used to indicate a product of an element in the first data and an element in the second data.
It may be understood that at least one output port (for example, a first output port) in the plurality of output ports of the wavelength router 106 may output at least two intermediate optical signals. Each of the at least two intermediate optical signals is used to indicate a product of an element in the first data and an element in the second data. In an application, the wavelength router may route a plurality of intermediate optical signals used to indicate products of elements with a sequence number difference that is the same as a sequence number difference (i-j) of an element ai in the first data and an element bj in the second data to a same output port, where i indicates a sequence number of the element ai in the first data, and j indicates a sequence number of the element bj in the second data. For example, the wavelength router may route an intermediate optical signal used to indicate a product a1b2 and an intermediate optical signal used to indicate a product a2b3 to a same output port.
The detector array 108 is configured to detect a light intensity of an optical signal at each output port of the wavelength router 106, to obtain a convolution computing result of the first data and the second data. In this embodiment of the present disclosure, the detector array 108 may include a plurality of detectors, and one detector is configured to detect a light intensity of an output signal at an output port of the wavelength router 106. Light intensities, of the output signals at the plurality of output ports of the wavelength router 106, detected by the detector array 108 are used to indicate the convolution results of the first data and the second data. It may be understood that, in an application, some output ports may output one intermediate optical signal, and some output ports output an optical signal including an aggregation result of a plurality of intermediate optical signals. When an optical signal output by an output port includes the aggregation result of the plurality of intermediate optical signals, the optical signal output by the output port is used to represent a sum of products of the elements in the first data and the elements in the second data. In a specific implementation, the detector array 108 may be implemented by using a semiconductor photodiode array, a photoconductive detector array (for example, a photoresistor array), or the like.
The optical computing apparatus provided in this embodiment of the present disclosure is an on-chip integrated optical convolution system based on the wavelength router. The computing apparatus can implement a convolution operation at one time without splitting convolution computing into a plurality of matrix multiplication operations. This can improve computing efficiency of convolution computing, and improve performance of a neural network. In addition, a core component in the optical computing apparatus provided in this embodiment of the present disclosure is the wavelength router. The wavelength router can be designed according to a convolution operation rule. In a process of performing the convolution operation, no external control is required, and no power consumption is generated. Therefore, the optical computing apparatus provided in this embodiment of the present disclosure can reduce computing power consumption. Further, because a component in the optical computing apparatus provided in this embodiment of the present disclosure may be an on-chip component, the optical computing apparatus may exist in a form of a chip, and an integration degree is high.
To describe the present disclosure more clearly, the following describes in detail implementations of each component in the optical computing apparatus provided in this embodiment of the present disclosure.
As described above, the light emitting array 1021 may load the data into an optical signal through direct modulation or external modulation. Direct modulation means that an intensity of light emitted by an LD is directly controlled based on the data to be loaded, and the data is loaded to the optical signal. Different light intensities are used to indicate different data. As shown in
As described above, the light emitting array 1021 may also generate a plurality of wavelengths by using an optical frequency comb source and a wavelength division demultiplexer, which may be shown in
During the convolution operation, each element in the first data to be computed needs to be respectively multiplied by each element in the second data. Therefore, in this embodiment of the present disclosure, light emitted by each light source is required to be uniformly input to all modulators. Therefore, design of the optical splitting device is also important. In an embodiment of the present disclosure, the optical splitting device 1022 may split, by using a wavelength division multiplexing solution, the optical signal emitted by the light emitting array, and send the optical signal to each modulator in the modulator array 104.
In an application, the optical splitting device may further enable, by using an optical splitting structure after the light source, the light emitted by each light source to uniformly input all the modulators.
In another case, as shown in
In an application, the optical splitting device 1022 may be next to the light emitting array 1021, so that the plurality of optical signals of different wavelengths emitted by the light emitting array 1021 can be transmitted in free space of the optical splitting device 1022. This can obtain a plurality of groups of optical signals including different wavelengths. For example, after a first optical signal whose wavelength is λ1 emitted by a laser LD 1 passes through the optical splitting device 1022, n optical signals whose wavelengths are λ1 can be obtained. The n optical signals whose wavelengths are λ1 are respectively sent to n modulators in the modulator array 104, and one modulator is configured to receive an optical signal whose wavelength is λ1. In this manner, after passing through the optical splitting device 1022, the plurality of optical signals of different wavelengths emitted by the light emitting array 1021 may be changed into the plurality groups of optical signals, where each group of optical signals includes a plurality of optical signals of different wavelengths. The plurality of groups of optical signals of different wavelengths are separately sent to the plurality of modulators in the modulator array 104, where each modulator needs to receive one of the plurality of groups of optical signals. As described above, in this embodiment of the present disclosure, a plurality of optical signals received by one modulator are referred to as a group of optical signals.
In an application, the wavelength router 106 may be an on-chip wavelength router, and the on-chip wavelength router is mainly implemented as the following two manners: an AWGR and an EDGR. Working principles of the AWGR and the EDGR are based on multi-beam interference to implement a routing function. There is an optical path difference of ΔL between adjacent paths of the AWGR and the EDGR. A difference lies in that the optical path difference of the AWGR is introduced by an array waveguide, and the optical path difference of the EDGR is introduced by a grating reflection surface.
An arrayed waveguide grating (AWG) is a planar waveguide device. The AWG has a filtering feature and versatility, can obtain a large quantity of wavelengths and channels and multiplex and demultiplex dozens to hundreds of wavelengths. Therefore, the AWG can also be used as a router. In this embodiment of the present disclosure, the AWGR refers to an AWG that implements a routing function. Therefore, in this embodiment of the present disclosure, the AWG refers to the AWGR. A basic structure of the AWGR is shown in
A basic structure of the EDGR is shown in
In embodiments of the present disclosure, the wavelength router can be designed according to a convolution computing rule, and the output port corresponding to the intermediate optical signal can be determined based on the wavelength and the input port corresponding to the received intermediate optical signal. For specific rules, refer to
The foregoing describes the structure of the optical computing apparatus provided in embodiments of the present disclosure. For ease of understanding, the following describes, by using an example, with reference to a computing method shown in
For clarity of description, in this embodiment of the present disclosure, for example, m=2 and n=4. Further, descriptions are provided by using an example in which convolution of the first data [a1, a2] and the second data [b1, b2, b3, b4] is performed. As shown in
In step 604, the second data to be computed may be loaded to the modulator array 104, and a plurality of intermediate optical signals are output based on the loaded second data. As described above, the modulator array 104 may include a plurality of modulators, and each modulator may load one element in the second data. As described above, for example, the second data includes n elements, each element bj in the second data may be separately modulated to a modulator MDj in the modulator array 104, where j may range from 1 to n. For example, as shown in
An optical signal emitted by each light source in the light source array 102 uniformly enters each modulator. In this manner, each modulator in the modulator array 104 receives one of the four groups of optical signals emitted by the light source array 102. In this manner, the modulator array 104 may multiply each element a1 in the first data by each element bb in the second data based on the second data loaded on each modulator, to generate eight intermediate optical signals in total. The eight intermediate optical signals each are used to indicate a product aibj of an element ai and an element bj, and a wavelength of each intermediate optical signal may be λ1. As shown in
Each modulator in the modulator array 104 corresponds to an input port of a wavelength router, and each modulator may be connected to an input port of the wavelength router through a waveguide. In this manner, each element bj in the second data corresponds to one input port inj of the wavelength router. Optical signals input from each input port inj of the wavelength router includes optical signals generated based on all the elements in the first data. Therefore, optical signals input from each input port inj carry all wavelengths λi. In other words, each input port inj of the wavelength router 106 needs to receive all optical signals that are emitted by the light source array 102 based on the first data. Because the optical signals input by each input port inj includes all the wavelengths λi, and a modulator MDj on the input port inj corresponding to the optical signals performs a multiplication operation about the element bj in the second data, a plurality of groups of modulated intermediate optical signals can be obtained. The modulator MDj obtains the intermediate optical signal indicating a product aibj of the element ai and the element bj.
In step 606, the wavelength router may route the received intermediate optical signals of different wavelengths to different ports. As described above, the wavelength router 106 may implement a routing function based on multi-beam interference. Further, the wavelength router may route the received intermediate optical signal according to a pre-designed routing rule. For example, there are m elements in the first data and n elements in the second data, and a sliding step of convolution is 1. After convolution is performed on the first data and the second data, there are q elements in a convolution result is q, where q=m+n−1. Therefore, when the sliding step of convolution is 1, (m+n−1) output ports of the router may be designed and numbered in sequence. In this case, the routing rule of the wavelength router 106 may be designed as follows. All optical signals corresponding to aibj with an equal sequence number difference (i-j) are routed to a same output port outk, where i may indicate a sequence number of an element in the first data, or may indicate a sequence number of a wavelength corresponding to an optical signal. Likewise, j may indicate a sequence number of an element in the second data, may indicate a sequence number of an input port of the wavelength router, or may indicate a sequence number of a modulator in the modulator array 104. k is a sequence number of an output port, k=m−(i−j), k may range from 1 to q, and q=m+n−1. In an application, if only a part of the convolution result is concerned, an output of a redundant output port of the router may be discarded based on this correspondence.
It should be noted that, in the foregoing example, that the sliding step of convolution is 1 is used for description. In an application, when the step is not 1, a quantity and change of output ports of the router may be first determined based on a case in which step=1. Then, the redundant output port is discarded according to a principle that an output value at one output port is taken from the quantity of output ports per sliding step. For example, when step=1, there are five output ports: out1 to out5, and when step=2, only optical signals corresponding to three ports: out1, out3, and out5 need to be detected, and outputs of output ports out2 and out4 are discarded. When step=3, only light intensities of optical signals output by output ports out1 and out4 may be detected, or only light intensities of optical signals output by output ports out2 and out5 may be detected.
Further,
For example, as shown in
In step 608, the detector array 108 may detect a light intensity of an optical signal at each output port of the wavelength router 106 to obtain the convolution result of the first data and the second data. It may be understood that the optical intensity of the optical signal output by the output port of the wavelength router 106 is directly proportional to the convolution result of the first data and the second data, and a larger value of the convolution result indicates a larger optical intensity of the output optical signal. In an application, when the complete convolution operation result is required, light intensities at all the output ports need to be detected. In an application, when only a part of the convolution result is concerned, light intensities at some output ports of the wavelength router 106 may be detected.
It can be learned from the foregoing embodiment that, the optical computing apparatus provided in embodiments of the present disclosure can implement the convolution operation on data. In addition, the optical computing apparatus provided in embodiments of the present disclosure performs the convolution operation in one step, and does not need to decompose the convolution computing into a plurality of vector multiplications or matrix multiplications for implementation. Therefore, computing efficiency can be improved. In addition, in the optical computing apparatus provided in embodiments of the present disclosure, the wavelength router can be pre-designed according to the convolution operation rule. No external control is required, and no power consumption is generated. This can reduce computing power consumption. Further, because a component in the optical computing apparatus provided in embodiments of the present disclosure may be an on-chip component, the optical computing apparatus may exist in a form of a chip, and an integration degree is high.
It should be noted that, in the foregoing embodiment, convolution of the vectors is used as an example for description. Further, the light source array and the modulator array each are a line array instead of a planar array. However, in an application, an architecture of an optical convolution system provided in embodiments of the present disclosure may also be used for convolution of matrices. In this case, the light source array and the modulator array each may be a planar array. This is not limited herein.
In another implementation provided in embodiments of the present disclosure, the optical computing apparatus shown in
As shown in
and second data includes the 2×2 matrix
A person skilled in the art may know that, in convolution computing, to keep a size of input data consistent with a size of output data, before convolution operation is performed, boundary padding may be performed on an original matrix, that is, some values are padded on a boundary of the matrix, to increase a size of the matrix. Padding is usually performed with “0”. In a padding manner, when a convolution kernel obtains the input data through scanning, the convolution kernel may extend to a pixel other than an edge of the original image, so that the size of the output data and the size of the input data are the same. In computing of the matrices shown in
may be used as the convolution kernel, and the second data
may be used as the input data. When padding is performed on the second data and a sliding step is 1, a 3×3 convolution result shown in
With reference to
Still as shown in
shown in
It should be noted that, in convolution shown in
It can be learned from the foregoing embodiments that, no matter implementing convolution of vectors or convolution of matrices, the optical computing apparatus provided in embodiments of the present disclosure does not need to divide convolution computing into a plurality of matrix multiplication operations for execution, but completes convolution computing in one step. Convolution computing does not need to be decomposed into a plurality of vector multiplications or matrix multiplications for implementation. Therefore, computing efficiency can be improved. In an application, the optical computing apparatus provided in embodiments of the present disclosure may exist in a form of a chip.
It should be noted that, according to the optical computing apparatus provided in embodiments of the present disclosure, the light source array and the modulator array may be designed according to a design requirement (for example, a chip size and a quantity of components), to maximize use of various components such as the light emitting device, the modulator, and the detector. In other words, quantities of components such as light emitting devices, modulators, and detectors in the optical computing apparatus provided in embodiments of the present disclosure are not limited by specific elements in data to be convolved. It may be understood that, when a quantity of elements in the data to be computed is greater than a quantity of lasers or modulators in the optical computing apparatus, the data to be computed may be split into a plurality of pieces of data that can be computed for computing, or when the quantity of elements in the data to be computed is less than a quantity of lasers or modulators in the optical computing apparatus, only some lasers, some modulators, some detectors, and the like in the optical computing apparatus may be used for computing.
It should be further noted that, the optical computing apparatus provided in embodiments of the present disclosure may also perform 1×1 convolution, that is, the first data or the second data may include only one element. For example, a quantity of weights in a convolution kernel may include one weight (or one element), that is, m=1 in the foregoing embodiment. In this case, in one manner, data including one element may be padded with data including a plurality of elements in a padding manner. For example, “0” may be padded to pad the data as the data including the plurality of elements. In another manner, the data may not be padded, and computing may be directly performed. In a computing process, some lasers (for example, one laser), some modulators, or some detectors may participate in the computing process. The optical computing apparatus provided in embodiments of the present disclosure is not affected by a data volume of the computed data, and can perform computing regardless of the data volume to be computed.
The processor 1202 is an operation core and a control core (or control unit) of the optical computing system 1200. The processor 1202 may include a plurality of processor cores. The processor 1202 may be a very large scale integrated circuit. An operating system and another software program are installed in the processor 1202, so that the processor 1202 can implement access to a memory, a cache, an optical computing apparatus, and the like. In this embodiment of the present disclosure, the processor 1202 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), an artificial intelligence (AI) chip, a system on chip (SoC) or a complex programmable logic device (CPLD), a graphics processing unit (GPU), or the like.
In an application, the processor 1202 may be configured to input, to the optical computing apparatus 1204, data on which convolution computing is to be performed. An example in which the first data is the convolution kernel, and the second data is the input data in the foregoing embodiment is used. The processor 1202 may input the first data and the second data to the convolution computing apparatus 1204. In one case, when the optical computing apparatus provided in this embodiment of the present disclosure is used in a photographing device, and directly performs image processing through convolution, the first data may alternatively be input to the convolution computing apparatus 1204 only by using the processor 1202. The second data may be directly obtained by using an optical signal when a picture is photographed. For details about how the optical computing system implements convolution computing, refer to the description in the foregoing embodiment. Details are not described herein again.
An embodiment of the present disclosure further provides a computer program product for implementing the foregoing convolution computing method. In addition, an embodiment of the present disclosure also provides a computer program product for implementing the foregoing convolution computing method. Each of the computer program products includes a computer-readable storage medium storing program code. Instructions included in the program code are used for executing the method procedure described in any one of the foregoing method embodiments. A person of ordinary skill in the art may understand that, the foregoing storage medium includes various non-transitory machine readable media that can store program code, such as a Universal Serial Bus (USB) flash drive, a removable hard disk, a magnetic disk, an optical disc, a random-access memory (RAM), a solid-state drive (SSD), or a non-volatile memory.
It should be noted that embodiments provided in this disclosure are merely examples. A person skilled in the art may clearly know that, for convenience and conciseness of description, in the foregoing embodiments, embodiments emphasize different aspects, and for a part not described in detail in one embodiment, refer to related descriptions in another embodiment. Features disclosed in embodiments, claims, and accompanying drawings of the present disclosure may exist independently or exist in a combination. Features described in a hardware form in embodiments of the present disclosure may be executed by software, and vice versa. This is not limited herein.
Number | Date | Country | Kind |
---|---|---|---|
202110137148.X | Feb 2021 | CN | national |
202110502270.2 | May 2021 | CN | national |
This is a continuation of International Patent Application No. PCT/CN2021/124511 filed on Oct. 18, 2021, which claims priority to Chinese Patent Application No. 202110502270.2 filed on May 8, 2021 and Chinese Patent Application No. 202110137148.X filed on Feb. 1, 2021. All of the aforementioned patent applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2021/124511 | Oct 2021 | US |
Child | 18362200 | US |