TWI928362B - Photonic computing method, device, and computer equipment - Google Patents
Photonic computing method, device, and computer equipmentInfo
- Publication number
- TWI928362B TWI928362B TW113134009A TW113134009A TWI928362B TW I928362 B TWI928362 B TW I928362B TW 113134009 A TW113134009 A TW 113134009A TW 113134009 A TW113134009 A TW 113134009A TW I928362 B TWI928362 B TW I928362B
- Authority
- TW
- Taiwan
- Prior art keywords
- optical
- data
- summation
- elements
- representing
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06E—OPTICAL COMPUTING DEVICES
- G06E1/00—Devices for processing exclusively digital data
- G06E1/02—Devices for processing exclusively digital data operating upon the order or content of the data handled
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06E—OPTICAL COMPUTING DEVICES
- G06E1/00—Devices for processing exclusively digital data
- G06E1/02—Devices for processing exclusively digital data operating upon the order or content of the data handled
- G06E1/04—Devices for processing exclusively digital data operating upon the order or content of the data handled for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Optical Modulation, Optical Deflection, Nonlinear Optics, Optical Demodulation, Optical Logic Elements (AREA)
- Photometry And Measurement Of Optical Pulse Characteristics (AREA)
Abstract
Description
本發明涉及光子計算技術領域,更為具體而言,涉及一種光子計算的方法、光子計算裝置、電腦設備。This invention relates to the field of photonic computing technology, and more specifically, to a method for photonic computing, a photonic computing device, and a computer device.
現代社會對於計算能力的需求越來越高,晶片是計算的硬體基礎,傳統晶片採用電信號表示資訊並進行計算(處理資訊),上述晶片在物理實現上主要基於CMOS電晶體組成的積體電路。數十年來,積體電路晶片大致按照摩爾總結出的經驗規律發展,即積體電路上可以容納的電晶體數目在大約每經過18個月到24個月會增加一倍。為了支援這種發展,電晶體的特徵尺寸也越來越小,已經接近物理極限。目前,已有提出用光來進行計算。Modern society demands ever-increasing computing power, and chips form the hardware foundation of computing. Traditional chips use electrical signals to represent information and perform calculations (information processing). Physically, these chips are primarily based on integrated circuits composed of CMOS transistors. For decades, integrated circuit chips have largely followed the empirical rule summarized by Moore: the number of transistors that can be accommodated on an integrated circuit roughly doubles every 18 to 24 months. To support this development, the feature size of transistors has become increasingly smaller, approaching physical limits. Currently, the use of light for computation has been proposed.
目前,已有提出用光來進行計算。Currently, there are proposals to use light for calculations.
本發明提供了一種光子計算的方法、光子計算裝置、電腦設備,以解決上述現有技術缺陷。This invention provides a method, apparatus, and computer for photon computation to overcome the aforementioned deficiencies in the prior art.
第一方面,本發明的實施方式提供了一種光子計算的方法,該方法包括:獲取第一資料,所述第一資料包括多個第一元素,每個所述第一元素代表一個數;在電子域,將第一資料中的每個第一元素拆分成多個部分;在光子域,採用光信號表示所述第一資料的每個第一元素拆分後的多個部分,對所述光信號進行光學處理,從而表示對所述多個第一元素進行計算。In a first aspect, embodiments of the present invention provide a method for photonic computation, the method comprising: acquiring first data, the first data comprising a plurality of first elements, each first element representing a number; in the electronic domain, splitting each first element in the first data into a plurality of parts; in the photonic domain, using optical signals to represent the plurality of parts of each first element of the first data after splitting, and performing optical processing on the optical signals to represent computation on the plurality of first elements.
在本發明的一些實施方式中,在所述在電子域將第一資料中的每個第一元素拆分成多個部分包括:在電子域,將第一元素沿位元位進行所述拆分。In some embodiments of the present invention, splitting each first element in the first data into multiple parts in the electronic domain includes: splitting the first element along bits in the electronic domain.
在本發明的一些實施方式中,所述將第一資料中的每個第一元素拆分成多個部分包括:用一組第一電信號表示所述第一元素拆分後的多個部分,用多組第一電信號分別表示所述多個第一元素。In some embodiments of the present invention, splitting each first element in the first data into multiple parts includes: using a set of first electrical signals to represent the multiple parts after the first element is split, and using multiple sets of first electrical signals to represent the multiple first elements respectively.
在本發明的一些實施方式中,所述採用光信號表示所述第一資料的每個第一元素拆分後的多個部分包括:用一組光信號表示所述第一元素拆分後的多個部分,用多組光信號分別表示所述多個第一元素。其中,所述用多組光信號分別表示所述多個第一元素可以包括:根據所述多組第一電信號對多路光進行調變,以產生分別表示多個第一元素的多組光信號。In some embodiments of the present invention, the use of optical signals to represent the multiple parts after each first element of the first data is split includes: using one set of optical signals to represent the multiple parts after the first element is split, and using multiple sets of optical signals to represent the multiple first elements respectively. The use of multiple sets of optical signals to represent the multiple first elements respectively may include: modulating multiple optical paths according to the multiple sets of first electrical signals to generate multiple sets of optical signals representing the multiple first elements.
在本發明的一些實施方式中,所述方法還包括:獲取第二資料,所述第二資料包括多個第二元素,每個所述第二元素代表一個數。其中,所述計算包括將所述第一資料的每個第一元素分別乘以所述第二資料中對應的第二元素。在本發明的一些實施方式中,所述將所述第一資料的每個第一元素分別乘以所述第二資料中對應的第二元素包括:使用電信號表示所述第二資料;將表示所述第二資料的所述電信號作為光計算單元的控制信號,在所述控制信號的控制下,使用所述光計算單元對所述多組光信號進行光學處理。In some embodiments of the present invention, the method further includes: acquiring second data, the second data comprising a plurality of second elements, each second element representing a number. The calculation includes multiplying each first element of the first data by a corresponding second element in the second data. In some embodiments of the present invention, multiplying each first element of the first data by a corresponding second element in the second data includes: representing the second data using an electrical signal; using the electrical signal representing the second data as a control signal for an optical computing unit, and under the control of the control signal, using the optical computing unit to perform optical processing on the plurality of optical signals.
在本發明的一些實施方式中,所述方法還包括:在電子域,將第二資料中的每個第二元素拆分成多個部分。在本發明的一些實施方式中,在所述在電子域將第二資料中的每個第二元素拆分成多個部分包括:在電子域,將第二元素沿位元位進行所述拆分。In some embodiments of the present invention, the method further includes: in the electronic domain, splitting each second element in the second data into multiple parts. In some embodiments of the present invention, splitting each second element in the second data into multiple parts in the electronic domain includes: in the electronic domain, performing the splitting along bit positions of the second element.
在本發明的一些實施方式中,所述在電子域將第二資料中的每個第二元素拆分成多個部分包括:用一組第二電信號表示所述第二元素拆分後的多個部分,用多組第二電信號分別表示所述多個第二元素。In some embodiments of the present invention, splitting each second element in the second data into multiple parts in the electronic domain includes: representing the multiple parts after the second element is split with a set of second electrical signals, and representing the multiple second elements respectively with multiple sets of second electrical signals.
在本發明的一些實施方式中,所述將所述第一資料的每個第一元素分別乘以所述第二資料中對應的第二元素包括:使用所述多組第二電信號作為光計算單元的控制信號;在所述控制信號的控制下,使用所述光計算單元對所述多組光信號進行光學處理。可選地,所述光計算單元包括馬赫-曾德爾干涉儀。In some embodiments of the present invention, multiplying each first element of the first data by the corresponding second element in the second data includes: using the plurality of sets of second electrical signals as control signals for an optical computing unit; and, under the control of the control signals, using the optical computing unit to perform optical processing on the plurality of sets of optical signals. Optionally, the optical computing unit includes a Mach-Zehnder interferometer.
在本發明的一些實施方式中,所述第一資料包括向量或矩陣中的至少一部分元素,所述第二資料包括向量或矩陣中的至少一部分元素。In some embodiments of the present invention, the first data includes at least a portion of the elements in a vector or matrix, and the second data includes at least a portion of the elements in a vector or matrix.
在本發明的一些實施方式中,所述方法還包括:將經過所述光學處理而輸出的光信號轉換為多組數位電信號;對所述多組數位電信號表示的數進行累加操作。在本發明的一些實施方式中,所述方法還包括:在進行所述累加操作之前,對所述數位電信號表示的數進行縮放處理,或者對以二進位形式表示的所述數進行移位操作。In some embodiments of the present invention, the method further includes: converting the optical signal output after optical processing into multiple sets of digital electrical signals; and performing an accumulation operation on the numbers represented by the multiple sets of digital electrical signals. In some embodiments of the present invention, the method further includes: scaling the numbers represented by the digital electrical signals or shifting the numbers represented in binary form before performing the accumulation operation.
在本發明的一些實施方式中,所述將所述第一資料的每個第一元素分別乘以所述第二資料中對應的第二元素包括:在光子域對所述第一元素拆分後的多個部分與所述第二元素拆分後的多個部分分別進行表示乘法操作的光學處理。在本發明的一些實施方式中,所述方法還包括將經所述光學處理的光信號轉換為類比電信號,並對所述類比電信號表示的數進行求和操作,得到多個第一求和結果,每個所述第一求和結果表示多個所述第一元素拆分後的某一部分分別與對應的多個第二元素拆分後的某一部分相乘得到的多個乘積之和。In some embodiments of the present invention, multiplying each first element of the first data by the corresponding second element in the second data includes: performing optical processing in the photonic domain to represent the multiplication operation between the multiple parts of the first element and the multiple parts of the second element. In some embodiments of the present invention, the method further includes converting the optically processed optical signal into an analog electrical signal, and performing a summation operation on the numbers represented by the analog electrical signal to obtain multiple first summation results, each of which represents the sum of multiple products obtained by multiplying a certain part of the multiple first elements by a certain part of the corresponding multiple second elements.
在本發明的一些實施方式中,所述方法還包括:根據所述多個第一求和結果分別經過映射操作得到多個中間結果,所述映射操作為對第一求和結果進行縮放處理或保持不變,並且其中至少一次映射操作為縮放處理;以及對所述多個中間結果進行累加操作,得到第二求和結果。其中,所述多個中間結果中的至少一個為對其相應的第一求和結果保持不變。In some embodiments of the present invention, the method further includes: obtaining multiple intermediate results by performing mapping operations on the multiple first summation results, wherein the mapping operation is to scale the first summation results or keep them unchanged, and at least one of the mapping operations is scaling; and performing an accumulation operation on the multiple intermediate results to obtain a second summation result. Wherein, at least one of the multiple intermediate results is kept unchanged from its corresponding first summation result.
在本發明的一些實施方式中,所述方法包括:將表示所述多個第一求和結果的類比電信號轉換為數位電信號,並以二進位形式表示所述多個第一求和結果;對至少兩個所述二進位形式的第一求和結果進行移位處理。In some embodiments of the present invention, the method includes: converting the analog electrical signals representing the plurality of first summation results into digital electrical signals, and representing the plurality of first summation results in binary form; and performing a shift operation on at least two of the first summation results in binary form.
第二方面,本發明的實施方式提供了一種光子計算裝置,該裝置包括:第一資料拆分模組,被配置為在電子域將第一資料中的每個第一元素拆分成多個部分,其中所述第一資料包括多個所述第一元素,每個所述第一元素代表一個數;光學處理模組,被配置為在光子域採用光信號表示所述第一資料的每個第一元素拆分後的多個部分,並對所述光信號進行光學處理,從而表示對所述多個第一元素進行計算。在本發明的一些實施方式中,在電子域,將第一元素沿位元位進行所述拆分。Secondly, embodiments of the present invention provide a photonic computing apparatus, comprising: a first data splitting module configured to split each first element in first data into multiple parts in the electronic domain, wherein the first data includes multiple first elements, each first element representing a number; and an optical processing module configured to use optical signals in the photonic domain to represent the multiple parts of each first element after splitting in the first data, and to perform optical processing on the optical signals to represent computation on the multiple first elements. In some embodiments of the present invention, in the electronic domain, the first element is split along bits.
在本發明的一些實施方式中,所述第一資料拆分模組在電子域將第一資料中的每個第一元素拆分成多個部分包括:用一組第一電信號表示所述第一元素拆分後的多個部分,用多組第一電信號分別表示所述多個第一元素。In some embodiments of the present invention, the first data splitting module splits each first element in the first data into multiple parts in the electronic domain, including: using a set of first electrical signals to represent the multiple parts after the first element is split, and using multiple sets of first electrical signals to represent the multiple first elements respectively.
在本發明的一些實施方式中,所述光學處理模組在光子域採用光信號表示所述第一資料的每個第一元素拆分後的多個部分包括:用一組光信號表示所述第一元素拆分後的多個部分,用多組光信號分別表示所述多個第一元素。In some embodiments of the present invention, the optical processing module uses optical signals in the photonic domain to represent multiple parts after each first element of the first data is split, including: using one set of optical signals to represent multiple parts after the first element is split, and using multiple sets of optical signals to represent the multiple first elements respectively.
在本發明的一些實施方式中,所述用多組光信號分別表示所述多個第一元素包括:根據所述多組第一電信號對多路光進行調變,以產生分別表示多個第一元素的多組光信號。In some embodiments of the present invention, representing the plurality of first elements with multiple sets of optical signals includes: modulating multiple optical paths according to the multiple sets of first electrical signals to generate multiple sets of optical signals representing the plurality of first elements.
在本發明的一些實施方式中,所述光子計算裝置還包括第二資料拆分模組,該模組被配置為在電子域將第二資料中的每個第二元素拆分成多個部分,其中所述第二資料包括多個所述第二元素,每個所述第二元素代表一個數。在本發明的一些實施方式中,在電子域,將第二元素沿位元位進行所述拆分。In some embodiments of the present invention, the photonic computing device further includes a second data splitting module configured to split each second element in the second data into multiple parts in the electronic domain, wherein the second data includes multiple second elements, each second element representing a number. In some embodiments of the present invention, in the electronic domain, the splitting of the second elements is performed bit-wise.
在本發明的一些實施方式中,所述第二資料拆分模組在電子域將第二資料中的每個第二元素拆分成多個部分包括:用一組第二電信號表示所述第二元素拆分後的多個部分,用多組第二電信號分別表示所述多個第二元素。In some embodiments of the present invention, the second data splitting module splits each second element in the second data into multiple parts in the electronic domain, including: using a set of second electrical signals to represent the multiple parts after the second element is split, and using multiple sets of second electrical signals to represent the multiple second elements respectively.
在本發明的一些實施方式中,所述光學處理模組包括光計算單元。其中,所述光學模組對所述光信號進行光學處理包括:使用所述多組第二電信號作為所述光計算單元的控制信號;在所述控制信號的控制下,使用所述光計算單元對所述多組光信號進行光學處理。可選地,所述光計算單元包括馬赫-曾德爾干涉儀。In some embodiments of the present invention, the optical processing module includes an optical computing unit. The optical processing of the optical signal by the optical module includes: using the plurality of second electrical signals as control signals for the optical computing unit; and, under the control of the control signals, using the optical computing unit to perform optical processing on the plurality of optical signals. Optionally, the optical computing unit includes a Mach-Zehnder interferometer.
在本發明的一些實施方式中,所述第一資料包括向量,所述第二資料包括矩陣。In some embodiments of the present invention, the first data includes a vector and the second data includes a matrix.
在本發明的一些實施方式中,所述光子計算裝置還包括: 光電轉換模組,被配置成將經過所述光學處理而輸出的光信號轉換為類比電信號; 求和處理模組,被配置成對所述類比電信號表示的數進行求和處理,得到多個求和結果; 縮放處理模組,被配置成對所述多個求和結果中的至少一個分別進行縮放處理;以及 累加模組,被配置成將經過所述縮放處理的求和結果和未經縮放處理的求和結果進行累加。 In some embodiments of the present invention, the photonic computing device further includes: a photoelectric conversion module configured to convert the optical signal output after optical processing into an analog electrical signal; a summation processing module configured to sum the numbers represented by the analog electrical signals to obtain multiple summation results; a scaling processing module configured to perform scaling processing on at least one of the multiple summation results; and an accumulation module configured to accumulate the summation result after scaling processing and the summation result without scaling processing.
在本發明的一些實施方式中,所述光子計算裝置還包括: 光電轉換模組,被配置成將經過所述光學處理而輸出的光信號轉換為類比電信號; 求和處理模組,被配置成對所述類比電信號表示的數進行求和處理,得到多個求和結果; 類比/數位轉換模組,被配置成將表示所述求和結果的類比電信號轉換為數位電信號,並以二進位形式表示所述求和結果; 移位模組,被配置成對所述二進位形式的求和結果中的至少一個進行移位操作;以及 累加模組,被配置成將所述多個求和結果中經過所述移位操作及未經移位操作的求和結果進行累加。 In some embodiments of the present invention, the photonic computing device further includes: a photoelectric conversion module configured to convert the optical signal output after optical processing into an analog electrical signal; a summation processing module configured to sum the numbers represented by the analog electrical signals to obtain multiple summation results; an analog-to-digital conversion module configured to convert the analog electrical signal representing the summation result into a digital electrical signal and represent the summation result in binary form; a shift module configured to perform a shift operation on at least one of the binary summation results; and an accumulation module configured to accumulate the summation results obtained after the shift operation and those not obtained from the multiple summation results.
第三方面,本發明的實施方式還提供了一種光子計算的方法,包括:獲取第一資料,所述第一資料包括多個第一元素,每個所述第一元素代表一個數;在光子域,採用光信號表示所述第一資料;對所述光信號進行光學處理,從而表示對所對應的多個第一元素進行計算;在類比電子域,對類比電信號表示的處理結果進行第一求和操作;在數位電子域,對數位電信號表示的處理結果進行第二求和操作。Thirdly, embodiments of the present invention also provide a method for photonic computation, comprising: acquiring first data, the first data including a plurality of first elements, each first element representing a number; in the photonic domain, representing the first data with an optical signal; performing optical processing on the optical signal to represent computation on the corresponding plurality of first elements; in the analog electronics domain, performing a first summation operation on the processing result represented by the analog electrical signal; and in the digital electronics domain, performing a second summation operation on the processing result represented by the digital electrical signal.
在本發明的一些實施方式中,所述方法還包括將經所述光學處理的光信號轉換為所述類比電信號;所述第一求和操作包括根據所述類比電信號表示的數進行求和操作,得到多個第一求和結果。In some embodiments of the present invention, the method further includes converting the optically processed optical signal into the analog electrical signal; the first summation operation includes performing a summation operation based on the number represented by the analog electrical signal to obtain a plurality of first summation results.
在本發明的一些實施方式中,所述數位電信號表示的處理結果包括所述第一求和結果;其中,所述第二求和操作包括:根據所述第一求和結果產生第二求和結果。In some embodiments of the present invention, the processing result represented by the digital signal includes the first summation result; wherein, the second summation operation includes: generating a second summation result based on the first summation result.
在本發明的一些實施方式中,還包括對所述數位電信號表示的所述第一求和結果中的至少一個進行移位操作,在所述移位操作之後進行所述第二求和操作。In some embodiments of the present invention, a shift operation is also performed on at least one of the first summation results represented by the digital electrical signal, and the second summation operation is performed after the shift operation.
在本發明的一些實施方式中,所述方法還包括對所述多個第一求和結果中的至少一個進行縮放處理,得到對應的至少一個中間結果。In some embodiments of the present invention, the method further includes scaling at least one of the plurality of first summation results to obtain at least one corresponding intermediate result.
第四方面,本發明的實施方式提供了一種電腦設備,其包括本發明任意一個實施方式所述的光子計算裝置。Fourthly, embodiments of the present invention provide a computer device that includes the photonic computing device described in any embodiment of the present invention.
根據本發明的實施方式,可以實現以下至少一個技術效果:提高光計算效率或準確性,降低計算系統的硬體實現難度,例如降低光電轉換、電光轉換或調變器等相關硬體的性能要求,或者更適配於特定計算任務例如乘法計算、先乘法後求和的計算或矩陣計算等。本發明實施方式的各個方面、特徵、優點等將在下文結合附圖進行具體描述。根據以下結合附圖的具體描述,本發明的上述方面、特徵、優點等將會變得更加清楚。According to the embodiments of the present invention, at least one of the following technical effects can be achieved: improving the efficiency or accuracy of optical computing, reducing the hardware implementation difficulty of the computing system, such as reducing the performance requirements of related hardware such as photoelectric converters, electro-optic converters, or modulators, or making it more suitable for specific computing tasks such as multiplication calculations, multiplication followed by summation calculations, or matrix calculations. The various aspects, features, and advantages of the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The above-mentioned aspects, features, and advantages of the present invention will become clearer from the following detailed description with reference to the accompanying drawings.
為了便於理解本發明技術方案的各個方面、特徵以及優點,下面結合附圖對本發明進行具體描述。應當理解,下述的各種實施方式只用於舉例說明,而非用於限制本發明的保護範圍。To facilitate understanding of the various aspects, features, and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the various embodiments described below are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
本文使用的術語是為了描述特定實施方式的目的,而非旨在限制本發明。如本文所用, 措辭“一”旨在包括複數情況,除非上下文明確指明表示單個數量。術語“第一”、“第二”或其他類似表述用於區分對象,並不意味著次序或順序,除非明確指明其表示順序。當提到發明人時,指代本公開(本申請)的發明人。The terminology used herein is for the purpose of describing a particular embodiment and is not intended to limit the invention. As used herein, the word “a” is intended to include plural cases unless the context clearly indicates a single quantity. The terms “first,” “second,” or other similar expressions are used to distinguish objects and do not imply order or sequence unless explicitly stated otherwise. When referring to an inventor, the inventor of this disclosure (this application) is referred to.
本發明各實施例對各步驟執行順序不作特別限定,能實現發明目的或功能即可,一些步驟或順序可以是可以並存執行、循序執行、或交替執行。The embodiments of this invention do not impose any particular restrictions on the order of execution of each step, as long as the purpose or function of the invention can be achieved. Some steps or sequences may be executed concurrently, sequentially, or alternately.
本發明人對光子計算進行了研究。發明人發現,在一些情況下,目前光子計算某些方面仍然需要電信號的輸入/輸出,例如需要與傳統的電信號的晶片進行電信號通信。由此,信號會有電光轉換、光電轉換、類比/數位轉換等轉換需求。例如,信號從光子域/類比電子域到數位電子域需要經過類比/數位轉換,但是,當前的類比/數位轉換技術難以實現高速高精度(例如大於8位元精度)的信號轉換,即高速高精度的類比/數位轉換已接近極限。另一方面,在一些計算中需要足夠的資料精度才能保證計算結果的準確性,例如,一些人工智慧計算需要8位元資料精度輸入來保持準確性,而在經過各種計算和處理之後,表示計算結果的資料需要至少16位元精度才能保證準確性,由此,在光計算中用光信號表示16位元的資料,在光信號轉換為最終數位電信號的過程中,採用常規的8位元的類比/數位轉換器顯然會造成資料精度的降低,造成計算模型或演算法的整體準確性下降。The inventors have conducted research on photonic computing. They discovered that, in some cases, current photonic computing still requires electrical signal input/output, such as communication with traditional electrical signal chips. This necessitates signal conversions such as electro-optical conversion, photoelectric conversion, and analog/digital conversion. For example, converting a signal from the photonic/analog electronics domain to the digital electronics domain requires analog/digital conversion. However, current analog/digital conversion technology struggles to achieve high-speed, high-precision signal conversion (e.g., greater than 8-bit precision); in other words, high-speed, high-precision analog/digital conversion is nearing its limits. On the other hand, some calculations require sufficient data precision to ensure the accuracy of the results. For example, some artificial intelligence calculations require 8-bit data precision input to maintain accuracy. After various calculations and processing, the data representing the results needs at least 16-bit precision to ensure accuracy. Therefore, in optical computing, 16-bit data is represented by optical signals. In the process of converting the optical signals into the final digital signals, using a conventional 8-bit analog-to-digital converter will obviously reduce the data precision, resulting in a decrease in the overall accuracy of the calculation model or algorithm.
此外,在一些實現光子計算的系統中,降低電光轉換、調變器等硬體的設計/製造難度,也是有利的。Furthermore, in some systems that implement photonic computing, reducing the design/manufacturing difficulty of hardware such as electro-optical converters and modulators is also beneficial.
本發明主要目的為提供一種適用於實際計算場景的光子計算方案。可以實現以下至少一個技術效果:提高光計算效率或準確性,降低計算系統的硬體實現難度,例如降低光電轉換、電光轉換或調變器等相關硬體的性能要求,或者更適配於特定計算任務例如乘法計算、先乘法後求和的計算或矩陣計算等。The main objective of this invention is to provide a photonic computing solution suitable for practical computing scenarios. It can achieve at least one of the following technical effects: improve the efficiency or accuracy of optical computing, reduce the hardware implementation difficulty of the computing system, such as reducing the performance requirements of related hardware such as photoelectric converters, electro-optic converters, or modulators, or be more suitable for specific computing tasks such as multiplication calculations, multiplication followed by summation calculations, or matrix calculations.
圖1示出了根據本發明一實施方式的光子計算方法的處理過程。在本實施方式中,本發明提出的光子計算的方法包括:S101,獲取第一資料,所述第一資料包括多個第一元素,每個所述第一元素代表一個數;S102,在電子域,將第一資料中的每個第一元素拆分成多個部分;S103,在光子域,採用光信號表示所述第一資料的每個第一元素拆分後的多個部分;S104,對所述光信號進行光學處理,從而表示對所述多個第一元素進行計算。在本發明的一些實施方式中,在電子域執行步驟S101,例如輸入類比電信號或數位電信號形式的待處理的第一資料。Figure 1 illustrates the processing flow of a photonic computing method according to an embodiment of the present invention. In this embodiment, the photonic computing method proposed in the present invention includes: S101, acquiring first data, the first data comprising a plurality of first elements, each first element representing a number; S102, in the electronic domain, splitting each first element in the first data into multiple parts; S103, in the photonic domain, using optical signals to represent the multiple parts of each first element after splitting; S104, performing optical processing on the optical signals to represent calculations on the plurality of first elements. In some embodiments of the present invention, step S101 is performed in the electronic domain, for example, by inputting the first data to be processed in the form of an analog or digital electrical signal.
在本發明的一些實施方式中,在步驟S102中,可以是在數位電子域,將第一資料中的每個第一元素拆分成多個部分。In some embodiments of the present invention, in step S102, each first element in the first data may be split into multiple parts in the digital electronic domain.
在本發明的一些實施方式中,在步驟S102,所述將第一資料中的每個第一元素拆分成多個部分包括:用一組第一電信號表示所述第一元素拆分後的多個部分,用多組第一電信號分別表示所述多個第一元素。亦即,對於所述多個第一元素,由於其中的每個第一元素都進行拆分,需要用多組第一電信號對多個第一元素進行表示。第一元素可以是例如二進位數字、十進位數字的形式,不限於此。所述一組電信號可以包括至少2個電信號,電信號可以是電流信號,也可以是電壓信號,可以是數位電信號,也可以是類比電信號。如圖7所示,將二進位數字“11010100”拆分為高位部分:“1101”和低位元部分:“0100”。示例性地,可以用類比電信號A1表示低位元部分這一部分,用類比電信號A2表示高位部分這一部分,用包括A1、A2的一組電信號可以完整表示第一元素“11010100”拆分後的兩個部分,從而表示該第一元素“11010100”。在一些實施方式中,需要用多個電信號才足夠表示出低位元部分,或者需要用多個電信號才足夠表示出高位部分,例如,為了表示低位元部分,使用了兩個類比電信號A1、A2,為了表示高位部分,使用了兩個類比電信號A3、A4,此時,表示該第一元素的一組電信號包括A1、A2、A3及A4四個電信號。在一些實施方式中,可以用多個數位電信號表示低位元部分這一部分,用另外多個數位電信號表示高位部分這一部分。從而,可以採用一組第一電信號表示所述第一元素拆分後的多個部分(高位部分,低位元部分)。所述一組第一電信號,或者說用於表示高位部分、低位元部分的電信號,可以作為調變器的驅動信號,用以對光進行調變,從而採用光信號表示所述第一資料的每個第一元素拆分後的多個部分。In some embodiments of the present invention, in step S102, splitting each first element in the first data into multiple parts includes: representing the multiple parts after the first element is split using a set of first electrical signals, and representing the multiple first elements respectively using multiple sets of first electrical signals. That is, for the multiple first elements, since each of the multiple first elements is split, multiple sets of first electrical signals are needed to represent the multiple first elements. The first element can be, for example, a binary number or a decimal number, and is not limited thereto. The set of electrical signals can include at least two electrical signals, which can be current signals, voltage signals, digital signals, or analog signals. As shown in Figure 7, the binary number "11010100" is split into a high-order part: "1101" and a low-order part: "0100". For example, analog signal A1 can be used to represent the low-order part, and analog signal A2 can be used to represent the high-order part. A set of signals including A1 and A2 can completely represent the two parts after splitting the first element "11010100", thus representing the first element "11010100". In some embodiments, multiple signals are needed to represent the low-order part, or multiple signals are needed to represent the high-order part. For example, two analog signals A1 and A2 are used to represent the low-order part, and two analog signals A3 and A4 are used to represent the high-order part. In this case, a set of signals representing the first element includes four signals: A1, A2, A3, and A4. In some embodiments, multiple digital signals can be used to represent the low-order part, and other multiple digital signals can be used to represent the high-order part. Therefore, a set of first electrical signals can be used to represent the multiple parts (high-order part and low-order part) after the first element is split. The set of first electrical signals, or the electrical signals used to represent the high-order part and the low-order part, can be used as the driving signals of a modulator to modulate light, thereby using optical signals to represent the multiple parts after each first element of the first data is split.
在本發明的一些實施方式中,在步驟S103,所述採用光信號表示所述第一資料的每個第一元素拆分後的多個部分包括:用一組光信號表示所述第一元素拆分後的多個部分,用多組光信號分別表示所述多個第一元素。在本發明的示例性實施方式中,所述用多組光信號分別表示所述多個第一元素可以包括:根據所述多組第一電信號對多路光進行調變,以產生分別表示多個第一元素的多組光信號。根據所述多組第一電信號對多路光進行調變,可以例如是第一電信號直接驅動調變器,以對光進行調變,也可以是例如通過信號轉換電路將第一電信號轉換為合適的電信號以驅動調變器。本發明不限於此,本發明也可以採用本領域已知的其他電光轉換方法將所述多組第一電信號轉換為多組光信號。In some embodiments of the present invention, in step S103, representing each first element of the first data as a plurality of parts after being split using optical signals includes: representing the plurality of parts after being split using a set of optical signals, and representing the plurality of first elements respectively using multiple sets of optical signals. In exemplary embodiments of the present invention, representing the plurality of first elements respectively using multiple sets of optical signals may include: modulating multiple optical paths according to the multiple sets of first electrical signals to generate multiple sets of optical signals respectively representing the plurality of first elements. Modulating multiple optical paths according to the multiple sets of first electrical signals can, for example, be the first electrical signal directly driving a modulator to modulate the light, or it can be, for example, converting the first electrical signal into a suitable electrical signal through a signal conversion circuit to drive the modulator. The present invention is not limited thereto; other electro-optical conversion methods known in the art can also be used to convert the plurality of first electrical signals into a plurality of optical signals.
在本發明的一些實施方式中,在步驟S104,對所述光信號進行光學處理包括對光信號進行調變、干涉等光學處理。例如,可以採用馬赫-曾德爾干涉儀來對光信號進行干涉處理,以表示對所對應的多個第一元素進行計算。In some embodiments of the present invention, in step S104, optical processing of the optical signal includes optical processing such as modulation and interference of the optical signal. For example, a Mach-Zehnder interferometer can be used to perform interference processing on the optical signal to represent calculations on the corresponding multiple first elements.
本發明通過在電子域對輸入數進行拆分,然後在光子域進行計算處理,可以通過光子域的計算來提高算力,即使輸入資料的位元寬較長,也可以實現良好的準確性。另外,還可以降低計算系統的硬體實現難度,例如降低光電轉換器件、類比/數位轉換、數位/類比轉換等相關硬體的性能要求,降低設計及製造難度。This invention improves computing power by splitting the input data in the electronic domain and then performing calculations in the photonic domain. Even with long input data bit widths, good accuracy can be achieved. Furthermore, it reduces the hardware implementation complexity of the computing system, such as lowering the performance requirements of optoelectronic conversion devices, analog-to-digital converters, and digital-to-analog converters, thus reducing design and manufacturing difficulties.
圖2示出了根據本發明另一實施方式的光子計算方法的處理過程。在本實施方式中,本發明提出的光子計算的方法包括:S101,獲取第一資料,所述第一資料包括多個第一元素,每個所述第一元素代表一個數;S102,在電子域,將第一資料中的每個第一元素拆分成多個部分;S103,在光子域,採用光信號表示所述第一資料的每個第一元素拆分後的多個部分;S104,對所述光信號進行光學處理,從而表示對所述多個第一元素進行計算; S105,將經過所述光學處理而輸出的光信號轉換為多組數位電信號;S106,對所述多組數位電信號表示的數進行累加操作。Figure 2 illustrates the processing flow of a photonic computing method according to another embodiment of the present invention. In this embodiment, the photonic computing method proposed by the present invention includes: S101, acquiring first data, the first data including a plurality of first elements, each first element representing a number; S102, in the electronic domain, splitting each first element in the first data into a plurality of parts; S103, in the photonic domain, using optical signals to represent the plurality of parts after splitting each first element of the first data; S104, performing optical processing on the optical signals to represent calculations on the plurality of first elements; S105, converting the optical signals output after optical processing into a plurality of sets of digital electrical signals; S106, performing an accumulation operation on the numbers represented by the plurality of sets of digital electrical signals.
其中,對所述多組數位電信號表示的數進行累加操作,意味著在數位電子域進行所述累加操作。The accumulation operation on the numbers represented by the multiple sets of digital electrical signals means that the accumulation operation is performed in the digital electronic domain.
在本發明的一些實施方式中,在步驟S105,所述將經過所述光學處理而輸出的光信號轉換為多組數位電信號包括:通過光電轉換,例如採用光電二極體,將經過所述光學處理而輸出的光信號轉換為類比電信號,然後通過類比/數位轉換將所述類比電信號轉換為多組數位電信號。在本發明的一些實施方式中,由於對第一元素進行了拆分再分別進行計算,在後續步驟中需要對拆分後的數進行縮放操作,以還原出真實的計算結果。In some embodiments of the present invention, in step S105, converting the optical signal output after optical processing into multiple sets of digital signals includes: converting the optical signal output after optical processing into an analog signal through photoelectric conversion, for example using a photodiode, and then converting the analog signal into multiple sets of digital signals through analog-to-digital conversion. In some embodiments of the present invention, since the first element is split and calculated separately, the split numbers need to be scaled in subsequent steps to restore the true calculation result.
圖3示出了根據本發明另一實施方式的光子計算方法的處理過程。在本實施方式中,本發明提出的光子計算的方法包括:S101,獲取第一資料(例如向量),所述第一資料包括多個第一元素,每個所述第一元素代表一個數;S102,在電子域,將第一資料中的每個第一元素拆分成多個部分;S103,在光子域,採用光信號表示所述第一資料的每個第一元素拆分後的多個部分;S201,獲取第二資料(例如矩陣),所述第二資料包括多個第二元素,每個所述第二元素代表一個數;S202,在電子域,將第二資料中的每個第二元素拆分成多個部分;S203,用一組第二電信號表示所述第二元素拆分後的多個部分,用多組第二電信號分別表示所述多個第二元素;S301,使用所述多組第二電信號作為光計算單元(例如可以包括馬赫-曾德爾干涉儀)的控制信號,所述光計算單元在所述控制信號的控制下對所述多組光信號進行光學處理,以表示將所述第一資料的第一元素的每一部分分別乘以所述第二資料中對應的第二元素的每一部分;S302,將經所述光學處理的光信號轉換為類比電信號,並對所述類比電信號表示的數(處理結果)進行求和操作,得到多個第一求和結果,其中每個所述第一求和結果表示多個所述第一元素拆分後的某一部分分別與對應的多個第二元素拆分後的某一部分相乘得到的多個乘積之和;S303,根據所述多個第一求和結果分別經過映射操作得到多個中間結果,所述映射操作為對第一求和結果進行縮放處理或保持不變,並且其中至少一次映射操作為縮放處理;S304,對所述多個中間結果進行累加操作,得到第二求和結果。Figure 3 illustrates the processing procedure of a photon computation method according to another embodiment of the present invention. In this embodiment, the photonic computing method proposed in this invention includes: S101, acquiring first data (e.g., a vector), the first data including multiple first elements, each first element representing a number; S102, in the electronic domain, splitting each first element in the first data into multiple parts; S103, in the photonic domain, using optical signals to represent the multiple parts after splitting each first element of the first data; S201, acquiring second data (e.g., a matrix), the second data including multiple second elements, each second element representing a number; S202, in the electronic domain, splitting each second element in the second data into multiple parts; S203, using a set of second electrical signals to represent the multiple parts after splitting the second elements, and using multiple sets of second electrical signals to represent the multiple second elements respectively; S301, using the multiple sets of second electrical signals as control of an optical computing unit (e.g., which may include a Mach-Zehnder interferometer). The optical computing unit, under the control of the control signal, performs optical processing on the multiple sets of optical signals to represent multiplying each part of the first element of the first data by each part of the corresponding second element in the second data; S302, the optically processed optical signals are converted into analog electrical signals, and the numbers represented by the analog electrical signals (processing results) are summed to obtain multiple first summation results, wherein each first summation result represents... S303: The sum of multiple products obtained by multiplying a portion of each of the first elements after being split by a portion of each of the corresponding second elements after being split by a portion of each of the first elements; S304: The sum of multiple intermediate results obtained by performing a mapping operation on the multiple first summation results, wherein the mapping operation is to scale the first summation results or keep them unchanged, and at least one of the mapping operations is to scale them; S305: The sum of the multiple intermediate results is accumulated to obtain a second summation result.
其中,在步驟S302中的“求和操作”也可稱為第一求和操作;在步驟S304中累加操作,可以稱為第二求和操作。The "summation operation" in step S302 can also be called the first summation operation; the accumulation operation in step S304 can be called the second summation operation.
示例性地,在步驟S102中,可以在數位電子域,將第一資料中的每個第一元素拆分成多個部分,在步驟S202,可以在數位電子域,將第二資料中的每個第二元素拆分成多個部分。For example, in step S102, each first element in the first data can be split into multiple parts in the digital electronic field, and in step S202, each second element in the second data can be split into multiple parts in the digital electronic field.
在一些實施方式中,第一求和操作以及第二求和操作分別在類比電子域、數位電子域完成,可以提高計算的效率,降低類比/數位轉換電路設計的要求。其中,本發明對各步驟執行順序不作特別限定,能實現發明目的或功能即可,一些步驟或順序可以是可以並存執行、循序執行、或交替執行。示例性地,步驟S201至S203與步驟S101至S103執行順序不做限定,可以並存執行、循序執行、或交替執行。In some embodiments, the first summation operation and the second summation operation are performed in the analog electronics domain and the digital electronics domain, respectively, which can improve the efficiency of calculation and reduce the requirements for analog/digital conversion circuit design. This invention does not impose a particular limitation on the execution order of each step, as long as the purpose or function of the invention is achieved. Some steps or sequences can be executed concurrently, sequentially, or alternately. For example, the execution order of steps S201 to S203 and steps S101 to S103 is not limited and can be executed concurrently, sequentially, or alternately.
示例性地,所述第一資料可以包括張量中的元素,所述第二資料可以包括張量中的元素。示例性地,所述第一資料包括向量或矩陣中的多個元素,以及所述第二資料包括向量或矩陣中的多個元素。示例性地,所述第一資料的元素可以包括一向量V中的各元素,所述第二資料可以包括矩陣M中的某一列的各元素,通過第一資料與第二資料的點乘乘積(dot product)運算(點積運算),可以至少完成向量V與矩陣M乘法計算的一部分。其中,點乘乘積運算通常包括先對多個第一元素與對應多個第二元素分別進行乘法運算,然後對各乘法運算結果再進行求和。For example, the first data may include elements in a tensor, and the second data may include elements in a tensor. For example, the first data may include multiple elements in a vector or matrix, and the second data may include multiple elements in a vector or matrix. For example, the elements of the first data may include each element in a vector V, and the second data may include each element in a column of a matrix M. At least a portion of the multiplication calculation between vector V and matrix M can be completed through the dot product operation (dot product operation) of the first data and the second data. The dot product operation typically involves first multiplying multiple first elements with corresponding multiple second elements, and then summing the results of each multiplication operation.
在本發明的一些實施方式中,在步驟S303執行的縮放處理可以包括下述處理或可以用下述處理替換所述縮放處理:將表示所述第一求和結果的類比電信號轉換為數位電信號,並以二進位形式表示所述第一求和結果;對所述二進位形式的第一求和結果進行移位處理。例如,在步驟S102和S202,與圖7類似地,將8位元位的第一元素拆分為第一高4位元位和第一低4位元位,將8位元位的第二元素拆分為第二高4位元位和第二低4位元位,其中,第一高4位元位對應的部分與第二高4位元位對應的部分的點乘乘積(即所述二進位形式的求和結果)應當左移8位,第一高4位元位對應的部分與第二低4位元位對應的部分的點乘乘積應當左移4位,第二低4位元位對應的部分與第二高4位元位對應的部分的點乘乘積應當左移4位,第二低4位元位對應的部分與第二低4位元位對應的部分的點乘乘積不做移位處理。In some embodiments of the present invention, the scaling process performed in step S303 may include the following process or may be replaced by the following process: converting the analog electrical signal representing the first summation result into a digital electrical signal and representing the first summation result in binary form; performing a shift operation on the first summation result in binary form. For example, in steps S102 and S202, similar to Figure 7, the 8-bit first element is split into a first high 4 bits and a first low 4 bits, and the 8-bit second element is split into a second high 4 bits and a second low 4 bits. The dot product of the corresponding parts of the first high 4 bits and the corresponding parts of the second high 4 bits (i.e., the summation result in binary form) should be shifted left by 8 bits, the dot product of the corresponding parts of the first high 4 bits and the corresponding parts of the second low 4 bits should be shifted left by 4 bits, the dot product of the corresponding parts of the second low 4 bits and the corresponding parts of the second high 4 bits should be shifted left by 4 bits, and the dot product of the corresponding parts of the second low 4 bits and the corresponding parts of the second low 4 bits is not shifted.
本發明實施方式在步驟S304對所述多個中間結果進行累加操作(第二求和操作),其結果作為第一資料和第二資料所需數學運算的計算結果輸出。應當理解,本發明不僅適用於二進位資料,也可適用於其他進制的資料。In this embodiment of the invention, a summation operation (second summation operation) is performed on the plurality of intermediate results in step S304, and the result is output as the calculation result of the mathematical operations required for the first data and the second data. It should be understood that the invention is not only applicable to binary data, but also to data in other bases.
在一個示例性的實施方式中,光子計算方法包括,獲取第一資料,所述第一資料包括多個第一元素,每個所述第一元素代表一個數;在光子域,採用光信號表示所述第一資料;對所述光信號進行光學處理,從而表示對所對應的多個第一元素進行計算;在類比電子域,對類比電信號表示的處理結果進行第一求和操作;在數位電子域,對數位電信號表示的處理結果進行第二求和操作。通過第一求和操作、第二求和操作,可以提高光子計算精度,降低對光子計算設備的某些硬體的性能要求。In one exemplary embodiment, the photonic computing method includes: acquiring first data, the first data comprising a plurality of first elements, each first element representing a number; representing the first data using an optical signal in the photonic domain; performing optical processing on the optical signal to represent a calculation performed on the corresponding plurality of first elements; performing a first summation operation on the processing result represented by the analog electrical signal in the analog electronics domain; and performing a second summation operation on the processing result represented by the digital electrical signal in the digital electronics domain. Through the first summation operation and the second summation operation, the accuracy of photonic computing can be improved, and the performance requirements of certain hardware components of the photonic computing device can be reduced.
在本發明的一些實施方式中,所述方法還包括將經所述光學處理的光信號轉換為所述類比電信號;所述第一求和操作包括根據所述類比電信號進行求和操作,得到多個第一求和結果。In some embodiments of the present invention, the method further includes converting the optically processed optical signal into the analog electrical signal; the first summation operation includes performing a summation operation based on the analog electrical signal to obtain a plurality of first summation results.
在本發明的一些實施方式中,所述數位電信號表示的處理結果包括所述第一求和結果;其中,所述第二求和操作包括:根據所述第一求和結果產生第二求和結果。In some embodiments of the present invention, the processing result represented by the digital signal includes the first summation result; wherein, the second summation operation includes: generating a second summation result based on the first summation result.
在本發明的一些實施方式中,還包括對所述數位電信號表示的所述第一求和結果中的至少一個進行移位操作,在所述移位操作之後進行所述第二求和操作。In some embodiments of the present invention, a shift operation is also performed on at least one of the first summation results represented by the digital electrical signal, and the second summation operation is performed after the shift operation.
與光子計算方法對應地,本發明還提供了一種光子計算裝置。圖4示出了根據本發明一實施方式的光子計算裝置10,該裝置包括:第一資料拆分模組100,被配置為在電子域將第一資料中的每個第一元素拆分成多個部分,其中所述第一資料包括多個所述第一元素,每個所述第一元素代表一個數;光學處理模組300,被配置為在光子域採用光信號表示所述第一資料的每個第一元素拆分後的多個部分,並對所述光信號進行光學處理,從而表示對所述多個第一元素進行計算。Corresponding to the photonic computing method, the present invention also provides a photonic computing device. Figure 4 illustrates a photonic computing device 10 according to an embodiment of the present invention, the device comprising: a first data splitting module 100 configured to split each first element in first data into multiple parts in the electronic domain, wherein the first data includes multiple first elements, each first element representing a number; and an optical processing module 300 configured to use optical signals in the photonic domain to represent the multiple parts of each first element of the first data after splitting, and to perform optical processing on the optical signals to represent calculations on the multiple first elements.
在本發明的一些實施方式中,所述第一資料拆分模組100在電子域將第一資料中的每個第一元素拆分成多個部分包括:用一組第一電信號表示所述第一元素拆分後的多個部分,用多組第一電信號分別表示所述多個第一元素。In some embodiments of the present invention, the first data splitting module 100 splits each first element in the first data into multiple parts in the electronic domain, including: using a set of first electrical signals to represent the multiple parts after the first element is split, and using multiple sets of first electrical signals to represent the multiple first elements respectively.
在本發明的一些實施方式中,所述光學處理模組300在光子域採用光信號表示所述第一資料的每個第一元素拆分後的多個部分包括:用一組光信號表示所述第一元素拆分後的多個部分,用多組光信號分別表示所述多個第一元素。在本發明的一些實施方式中,所述光學處理模組300包括光學調變器,被配置成根據所述多組第一電信號對多路光進行調變,以產生分別表示多個第一元素的多組光信號。根據所述多組第一電信號對多路光進行調變,可以例如是第一電信號直接驅動調變器,以對光進行調變,也可以是例如通過信號轉換電路將第一電信號轉換為合適的電信號以驅動調變器。在本發明的一些實施方式中,所述光學處理模組300包括光計算單元,配置成對所述光信號進行光學處理,從而表示對所述多個第一元素進行計算。其中,對所述光信號進行光學處理包括對光信號進行調變、干涉等光學處理。例如,所述光計算單元包括馬赫-曾德爾干涉儀,對所述光信號進行干涉處理。In some embodiments of the present invention, the optical processing module 300 uses optical signals in the photonic domain to represent multiple parts after the first element of the first data has been split, including: using one set of optical signals to represent the multiple parts after the first element has been split, and using multiple sets of optical signals to represent the multiple first elements respectively. In some embodiments of the present invention, the optical processing module 300 includes an optical modulator configured to modulate multiple optical signals according to the multiple sets of first electrical signals to generate multiple sets of optical signals representing the multiple first elements respectively. Modulating multiple optical signals according to the multiple sets of first electrical signals can, for example, be the first electrical signal directly driving the modulator to modulate the light, or it can be, for example, by using a signal conversion circuit to convert the first electrical signal into a suitable electrical signal to drive the modulator. In some embodiments of the present invention, the optical processing module 300 includes an optical computing unit configured to perform optical processing on the optical signal, thereby representing calculations on the plurality of first elements. The optical processing of the optical signal includes modulation, interference, and other optical processing. For example, the optical computing unit includes a Mach-Zehnder interferometer to perform interference processing on the optical signal.
圖5示出了根據本發明另一實施方式的光子計算裝置20。與圖4相比,二者的主要區別在於,本實施方式的光子計算裝置還包括第二資料拆分模組200,該模組被配置為在電子域將第二資料中的每個第二元素拆分成多個部分,其中所述第二資料包括多個所述第二元素,每個所述第二元素代表一個數。在一些實施方式中,所述第二資料拆分模組200在電子域將第二資料中的每個第二元素拆分成多個部分包括:用一組第二電信號表示所述第二元素拆分後的多個部分,用多組第二電信號分別表示所述多個第二元素。Figure 5 illustrates a photonic computing device 20 according to another embodiment of the present invention. The main difference between the two, compared to Figure 4, is that the photonic computing device of this embodiment further includes a second data splitting module 200, which is configured to split each second element in second data into multiple parts in the electronic domain, wherein the second data includes multiple second elements, each second element representing a number. In some embodiments, the second data splitting module 200 splitting each second element in the second data into multiple parts in the electronic domain includes: representing the multiple parts after the splitting of the second element with a set of second electrical signals, and representing the multiple second elements respectively with multiple sets of second electrical signals.
在本發明的一些實施方式中,所述光學處理模組300包括光計算單元。其中,所述光學模組300對所述光信號進行光學處理包括:使用來自於第二資料拆分模組200的所述多組第二電信號作為所述光計算單元的控制信號;在所述控制信號的控制下,使用所述光計算單元對來自於第一資料拆分模組100的所述多組光信號進行光學處理。光計算單元可以包括多個光學乘法器。可選地,所述光計算單元包括馬赫-曾德爾干涉儀。In some embodiments of the present invention, the optical processing module 300 includes an optical computing unit. The optical processing of the optical signals by the optical module 300 includes: using the plurality of second electrical signals from the second data splitting module 200 as control signals for the optical computing unit; and, under the control of the control signals, using the optical computing unit to perform optical processing on the plurality of optical signals from the first data splitting module 100. The optical computing unit may include multiple optical multipliers. Optionally, the optical computing unit includes a Mach-Zehnder interferometer.
在本發明的一些實施方式中,所述第一資料包括向量或矩陣中的多個元素,所述第二資料包括向量或矩陣中的多個元素。In some embodiments of the present invention, the first data includes multiple elements in a vector or matrix, and the second data includes multiple elements in a vector or matrix.
圖6示出了根據本發明另一實施方式的光子計算裝置30。與圖5所示的裝置相比,本實施方式的光子計算裝置30還包括:光電轉換模組400,被配置成將經過所述光學處理模組300處理而輸出的光信號轉換為類比電信號;求和處理模組500,被配置成對所述類比電信號表示的數進行求和處理(求和操作),得到多個求和結果;縮放處理模組600,被配置成對所述多個求和結果中的至少一個進行縮放處理;以及累加模組700,被配置成將經過所述縮放處理和未經縮放處理的求和結果進行累加。Figure 6 illustrates a photonic computing device 30 according to another embodiment of the present invention. Compared with the device shown in Figure 5, the photonic computing device 30 of this embodiment further includes: a photoelectric conversion module 400 configured to convert an optical signal output after processing by the optical processing module 300 into an analog electrical signal; a summation processing module 500 configured to perform summation processing (summation operation) on the number represented by the analog electrical signal to obtain multiple summation results; a scaling processing module 600 configured to perform scaling processing on at least one of the multiple summation results; and an accumulation module 700 configured to accumulate the summation results after scaling processing and those without scaling processing.
在本發明的一些實施方式中,替代所述縮放處理模組600,在所述求和處理模組500和累加模組700之間設置類比/數位轉換模組和移位模組(例如,圖8中的類比/數位轉換模組800和移位模組900),其中,所述類比/數位轉換模組包括類比/數位轉換器(ADC),被配置成將表示所述求和結果的類比電信號轉換為數位電信號,並以二進位形式表示所述求和結果;所述移位模組被配置成對所述二進位形式的求和結果中的至少一個進行移位操作;所述累加模組700被配置成將所述多個求和結果中經過所述移位操作及未經移位操作的求和結果進行累加。在可選的實施方式中,所述縮放處理模組600可以包括所述移位模組。In some embodiments of the present invention, instead of the scaling processing module 600, an analog-to-digital conversion module and a shift module (e.g., analog-to-digital conversion module 800 and shift module 900 in FIG. 8) are provided between the summation processing module 500 and the accumulation module 700. The analog-to-digital conversion module includes an analog-to-digital converter (ADC) configured to convert the analog electrical signal representing the summation result into a digital electrical signal and represent the summation result in binary form. The shift module is configured to perform a shift operation on at least one of the binary summation results. The accumulation module 700 is configured to accumulate the summation results that have undergone the shift operation and those that have not. In an alternative embodiment, the scaling processing module 600 may include the shifting module.
相應的,本發明的實施方式還提供了一種電腦設備,其包括本發明任意一個實施方式所述的光子計算裝置。在一些實施方式中,所述電腦設備可以包括,但不限於,個人電腦、伺服器或者網路設備等。Correspondingly, embodiments of the present invention also provide a computer device, which includes the photonic computing device described in any embodiment of the present invention. In some embodiments, the computer device may include, but is not limited to, a personal computer, a server, or a network device.
本發明的實施例可以用於點乘乘積(dot product)計算,點乘乘積(點積)通常可用於向量與向量相乘、向量與矩陣相乘、矩陣與矩陣相乘等。以向量乘以矩陣為例,根據向量與矩陣的乘法規則,以1×2的向量V1與2×2的矩陣M1相乘為例(即其中向量為1行、2列;矩陣為2行、2列),其中主要涉及點積運算,其中,矩陣的每一列都可以視為一個向量,在計算時,可以認為向量V1分別與矩陣M1的第一列、第二列進行點乘乘積,進行了兩次點乘乘積。The embodiments of this invention can be used to calculate dot products, which are commonly used for multiplying vectors, matrices, and other vectors. Taking the multiplication of a vector by a matrix as an example, according to the rules of vector-matrix multiplication, let's take the multiplication of a 1×2 vector V1 with a 2×2 matrix M1 as an example (i.e., the vector has 1 row and 2 columns; the matrix has 2 rows and 2 columns). This mainly involves the dot product operation. Each column of the matrix can be regarded as a vector. In the calculation, it can be considered that the vector V1 is multiplied by the first column and the second column of the matrix M1 respectively, resulting in two dot products.
如圖8所示,以實現一次點積計算為例,例如,以實現向量V1與矩陣M1的第一列的點積為例,其需要進行向量V1中各元素與矩陣M1第一列的相應元素分別進行乘法(標量乘法),再將各乘積進行求和。圖8示出了光子計算裝置的部分結構以及一些資料流程向。示例性地,其中向量、矩陣中的每個元素都是8位元寬。As shown in Figure 8, taking the implementation of a single dot product calculation as an example, such as the dot product of vector V1 and the first column of matrix M1, it requires multiplying each element of vector V1 with the corresponding element of the first column of matrix M1 (scalar multiplication), and then summing the products. Figure 8 shows part of the structure of the photonic computing device and some data flow directions. For example, each element in the vector and matrix is 8 bits wide.
在電子域,接收輸入資料,例如8位元向量,即向量中各元素均用8位元位寬的數表示,並將該向量的各元素拆分為兩個部分:低4位元位和高4位元位(即低位元部分和高位部分)。對於該向量的各元素,通過數位/類比轉換器(DAC)811將低4位元位轉換為類比電信號A1,由該類比電信號A1表示低4位元位;通過DAC 812將高4位元位轉換為類比電信號A2,由該類比電信號A2表示高4位元位。對於向量V1,其包含兩個元素,為了表示所述兩個元素拆分後的每個部分,需要用4個類比電信號。圖8中僅示出了數位/類比轉換器811及數位/類比轉換器812,數位/類比轉換器的數量可根據需要例如向量中元素的數量、拆分後的多個部分的數量而確定。In the electronic domain, input data is received, such as an 8-bit vector, where each element of the vector is represented by an 8-bit wide number. Each element of the vector is then split into two parts: a lower 4-bit portion and a higher 4-bit portion (i.e., a low-order part and a high-order part). For each element of the vector, a digital-to-analog converter (DAC) 811 converts the lower 4 bits into an analog signal A1, which represents the lower 4 bits; a DAC 812 converts the higher 4 bits into an analog signal A2, which represents the higher 4 bits. For a vector V1 containing two elements, four analog signals are needed to represent each of the split portions of these two elements. Figure 8 shows only the digital-to-analog converters 811 and 812. The number of digital-to-analog converters can be determined as needed, such as the number of elements in the vector or the number of multiple parts after splitting.
在光子域,可通過光學調變器(圖8未示出)根據表示低4位元位的類比電信號A1調變一路光,得到表示低4位元位的光信號,以及根據表示高4位元位的類比電信號A2調變一路光,得到表示高4位元位的光信號,其中,光學調變器分別與DAC、光學乘法器耦合(圖8未示出)。對於向量V1的各元素,所述表示低4位元位的光信號被輸入到光學處理模組300的光學乘法器 821,表示高4位元位的光信號被輸入到光學處理模組300的光學乘法器 822,並且,矩陣M1的第一列元素也被輸入到光學乘法器 821和光學乘法器 822。In the photonic domain, an optical signal representing the lower 4 bits can be obtained by modulating one optical path according to the analog electrical signal A1 representing the lower 4 bits using an optical modulator (not shown in Figure 8), and an optical signal representing the higher 4 bits can be obtained by modulating one optical path according to the analog electrical signal A2 representing the higher 4 bits. The optical modulator is coupled to a DAC and an optical multiplier (not shown in Figure 8), respectively. For each element of vector V1, the optical signal representing the lower 4 bits is input to the optical multiplier 821 of the optical processing module 300, and the optical signal representing the higher 4 bits is input to the optical multiplier 822 of the optical processing module 300. Furthermore, the first column elements of matrix M1 are also input to optical multipliers 821 and 822.
示例性地,2×2 矩陣M1的第一列作為第二資料,該第一列的各元素,也被拆分為高位部分(高4位元位)和低位部分(低4位元位)。For example, the first column of the 2×2 matrix M1 serves as the second data, and each element of the first column is also split into a high-order part (high 4 bits) and a low-order part (low 4 bits).
示例性地,在光學乘法器 821中,向量V1的各元素的低位部分與2×2 矩陣的第一列(的各元素)的低位部分分別進行乘法計算,多個乘法計算的結果可以用多路光表示,然後被輸入光電轉換子模組 831進行處理;此外,在光學乘法器821中,向量V1的各元素的低位部分與2×2 矩陣的第一列(的各元素)的高位部分分別進行乘法計算,多個乘法計算的結果可以用多路光表示,然後被輸入光電轉換子模組 832進行處理。For example, in the optical multiplier 821, the low-order part of each element of vector V1 is multiplied by the low-order part of the first column (elements) of the 2×2 matrix, and the result of multiple multiplications can be represented by multiple optical paths and then input into the photoelectric conversion sub-module 831 for processing; in addition, in the optical multiplier 821, the low-order part of each element of vector V1 is multiplied by the high-order part of the first column (elements) of the 2×2 matrix, and the result of multiple multiplications can be represented by multiple optical paths and then input into the photoelectric conversion sub-module 832 for processing.
示例性地,在光學乘法器 822中,向量V1的各元素的高位部分與2×2 矩陣的第一列(各元素)的低位部分分別進行乘法計算,多個乘法計算的結果可以用多路光表示,然後被輸入光電轉換子模組 833進行處理;此外,在光學乘法器822中,向量V1的各元素的高位部分與2×2 矩陣的第一列(的各元素)的高位部分分別進行乘法計算,多個乘法計算的結果可以用多路光表示,然後被輸入光電轉換子模組 834進行處理。For example, in optical multiplier 822, the high-order part of each element of vector V1 is multiplied by the low-order part of the first column (elements) of the 2×2 matrix, and the result of multiple multiplications can be represented by multiple optical paths and then input into optoelectronic conversion module 833 for processing; in addition, in optical multiplier 822, the high-order part of each element of vector V1 is multiplied by the high-order part of the first column (elements) of the 2×2 matrix, and the result of multiple multiplications can be represented by multiple optical paths and then input into optoelectronic conversion module 834 for processing.
其中,2×2 矩陣的第一列作為第二資料,其被拆分為高位部分和低位部分。在一些實施方式中,所述乘法計算包括:使用2×2 矩陣的元素的高位部分或低位部分對應的類比電信號作為控制信號,控制光學乘法器以對輸入該光學乘法器的光信號進行處理,例如控制光學乘法器中的馬赫-曾德爾干涉儀以對輸入該光學乘法器的各光信號進行處理。In this embodiment, the first column of the 2×2 matrix serves as the second data, and it is split into a high-order part and a low-order part. In some embodiments, the multiplication calculation includes: using the analog electrical signals corresponding to the high-order or low-order parts of the elements of the 2×2 matrix as control signals to control an optical multiplier to process the optical signals input to the optical multiplier, for example, controlling a Mach-Zehnder interferometer in the optical multiplier to process each optical signal input to the optical multiplier.
其中,光學乘法器821、822可以作為本發明各實施例光計算單元的一部分,光學乘法器821可以實現多個數分別乘以另外多個數,光學乘法器822可以實現多個數分別乘以另外多個數。示例性地,本發明的各實施例中,光計算單元可以包括多個光學乘法器,光學乘法器可以實現多個數分別乘以另外多個數,光學處理模組則可以包括多個光計算單元。示例性地,光學乘法器的數量可以根據第一資料的元素拆分的多個部分而確定,例如拆分後的多個部分分別對應多個光學乘法器。In this invention, optical multipliers 821 and 822 can be part of the optical computing unit in various embodiments. Optical multiplier 821 can multiply multiple numbers by other multiple numbers, and optical multiplier 822 can multiply multiple numbers by other multiple numbers. Exemplarily, in various embodiments of this invention, the optical computing unit can include multiple optical multipliers, each capable of multiplying multiple numbers by other multiple numbers. The optical processing module can also include multiple optical computing units. Exemplarily, the number of optical multipliers can be determined based on the multiple parts into which the elements of the first data are divided; for example, each of the multiple parts corresponds to a multiple optical multiplier.
通過光電轉換模組400的光電轉換子模組 831、832分別將光學乘法器 821的輸出(即經處理的光信號)轉換為類比電信號;通過光電轉換子模組 833、834分別將光學乘法器 822的輸出(即經處理的光信號)轉換為類比電信號。在一些實施方式中,每一個光電轉換子模組包括兩個光電二極體,輸出兩路類比電信號。具體地,光電轉換子模組 831、832、833、834各自輸出兩路類比電信號,所述兩路類比電信號隨後輸入至求和處理模組500進行求和處理以得到求和結果(屬於點乘乘積),所述求和結果輸入類比/數位轉換模組800進行類比/數位轉換,得到數位信號表示的點乘乘積。如圖8所示,所述求和處理模組500包括求和單元871、872、873和874,類比/數位轉換模組800包括ADC 841、842、843、844。光電轉換子模組 831輸出的兩路類比電信號輸入到求和單元871中進行求和處理,得到求和結果(第一點乘乘積),該求和結果經過類比/數位轉換器(ADC)841轉換為8位元二進位形式的第一點乘乘積,該第一點乘乘積是向量的低位部分與矩陣的第一列的低位部分的點乘乘積;光電轉換子模組832輸出的兩路類比電信號輸入到求和單元872中進行求和處理,得到求和結果(第二點乘乘積),該求和結果經過ADC 842轉換為8位元二進位形式的第二點乘乘積,該第二點乘乘積是向量的高位部分與矩陣的第一列的低位部分的點乘乘積;光電轉換子模組833輸出的兩路類比電信號輸入到求和單元873中進行求和處理,得到求和結果(第三點乘乘積),該求和結果經過ADC 843轉換為8位元二進位形式的第三點乘乘積,該第三點乘乘積是向量的低位部分與矩陣的第一列的高位部分的點乘乘積;光電轉換子模組834輸出的兩路類比電信號輸入到求和單元874中進行求和處理,得到求和結果(第四點乘乘積),該求和結果經過ADC 844轉換為8位元二進位形式的第四點乘乘積,該第四點乘乘積是向量的高位部分與矩陣的第一列的高位部分的點乘乘積。在一些實施方式中,在各點乘乘積類比電信號輸入到ADC之前,可以對各點乘乘積類比電信號進行放大,例如,可以採用跨阻放大器來放大這些類比電信號的幅度。The optoelectronic conversion module 400 uses optoelectronic conversion sub-modules 831 and 832 to convert the output of optical multiplier 821 (i.e., the processed optical signal) into analog electrical signals; and optoelectronic conversion sub-modules 833 and 834 to convert the output of optical multiplier 822 (i.e., the processed optical signal) into analog electrical signals. In some embodiments, each optoelectronic conversion sub-module includes two photodiodes and outputs two analog electrical signals. Specifically, each of the photoelectric conversion sub-modules 831, 832, 833, and 834 outputs two analog electrical signals. These two analog electrical signals are then input to the summation processing module 500 for summation processing to obtain a summation result (a dot product). The summation result is then input to the analog-to-digital conversion module 800 for analog-to-digital conversion to obtain a dot product represented by a digital signal. As shown in Figure 8, the summation processing module 500 includes summation units 871, 872, 873, and 874, and the analog-to-digital conversion module 800 includes ADCs 841, 842, 843, and 844. The two analog electrical signals output from the photoelectric conversion sub-module 831 are input to the summing unit 871 for summation processing, obtaining a summation result (first dot product). This summation result is then converted into an 8-bit binary form of the first dot product by the analog-to-digital converter (ADC) 841. This first dot product is the dot product of the least significant part of the vector and the least significant part of the first column of the matrix. The two analog electrical signals output from the photoelectric conversion sub-module 832 are input to the summing unit 872 for summation processing, obtaining a summation result (second dot product). This summation result is then converted into an ADC... The second dot product is converted by ADC 842 into 8-bit binary form. This second dot product is the dot product of the high-order part of the vector and the low-order part of the first column of the matrix. The two analog signals output from the photoelectric conversion module 833 are input into the summing unit 873 for summation processing to obtain the sum result (third dot product). This sum result is then converted by ADC 843 into 8-bit binary form of the third dot product. This third dot product is the dot product of the low-order part of the vector and the high-order part of the first column of the matrix. The two analog signals output from the photoelectric conversion module 834 are input into the summing unit 874 for summation processing to obtain the sum result (fourth dot product). This sum result is then converted by ADC 843 into 8-bit binary form of the third dot product. The 844 is converted to an 8-bit binary form of a fourth dot product, which is the dot product of the high-order part of the vector and the high-order part of the first column of the matrix. In some embodiments, the analog signals of each dot product can be amplified before being input to the ADC, for example, by using a transimpedance amplifier to amplify the amplitude of these analog signals.
在數位電子域,ADC 841輸出的第一點乘乘積是向量的低位部分與矩陣的第一列的低位部分的點乘乘積,因此該第一點乘乘積無需移位處理。其結果,ADC 841輸出的8位元資料不經過移位模組900而直接輸入累加器860。In the digital electronics domain, the first dot product output by the ADC 841 is the dot product of the least significant part of the vector and the least significant part of the first column of the matrix, therefore this first dot product does not require shifting. As a result, the 8-bit data output by the ADC 841 is directly input into the accumulator 860 without passing through the shift module 900.
ADC 842輸出的第二點乘乘積是向量的高位部分與矩陣的第一列的低位部分的點乘乘積,因此該第二點乘乘積需要左移4位元。其結果,ADC 842輸出的8位元資料登錄移位模組900,移位模組900對其執行左移4位元(擴大2^4倍)的操作851,移位後的資料登錄累加器860。The second dot product output by the ADC 842 is the dot product of the high-order part of the vector and the low-order part of the first column of the matrix. Therefore, this second dot product needs to be shifted left by 4 bits. As a result, the 8-bit data output by the ADC 842 is entered into the shift module 900, which performs a left shift operation of 4 bits (multiplied by 2^4) 851 on it, and the shifted data is entered into the accumulator 860.
ADC 843輸出的第三點乘乘積是向量的低位部分與矩陣的第一列的高位部分的點乘乘積,因此該第三點乘乘積需要左移4位元。其結果,ADC 843輸出的8位元資料登錄移位模組900,移位模組900對其執行左移4位元(擴大了2^4倍)的操作852,移位後的資料登錄累加器860。The third dot product of the ADC 843 output is the dot product of the low-order part of the vector and the high-order part of the first column of the matrix. Therefore, this third dot product needs to be shifted left by 4 bits. As a result, the 8-bit data output of the ADC 843 is entered into the shift module 900, which performs a left shift operation of 4 bits (amplified by a factor of 2^4) on it 852, and the shifted data is entered into the accumulator 860.
ADC 844輸出的第四點乘乘積是向量的高位部分與矩陣的第一列的高位部分的乘積,因此該第四點乘乘積需要左移8位元。其結果,ADC 844輸出的8位元資料登錄移位模組900,移位模組900對其執行左移8位元(擴大了2^8倍)的操作853,移位後的資料登錄累加器860。The fourth point product output by the ADC 844 is the product of the high-order part of the vector and the high-order part of the first column of the matrix. Therefore, this fourth point product needs to be shifted left by 8 bits. As a result, the 8-bit data output by the ADC 844 is entered into the shift module 900, which performs a left shift operation of 8 bits (amplified by a factor of 2^8) on it 853, and the shifted data is entered into the accumulator 860.
所述累加器860將接收的未經移位和經過移位處理的求和結果進行累加,得到16位元的結果,該一個16位元的結果作為1×2向量和2×2矩陣中的一列(例如第一列)的計算結果輸出,其中,向量、矩陣中各元素均為8位元。其中所述累加器860可以作為圖6所示的累加模組700的示例,或者所述累加模組700可以包括該累加器860。The accumulator 860 accumulates the received summation results, both unshifted and shifted, to obtain a 16-bit result. This 16-bit result is output as the calculation result of one column (e.g., the first column) in a 1×2 vector and a 2×2 matrix, where each element in the vector and matrix is 8 bits. The accumulator 860 can be an example of the accumulation module 700 shown in FIG. 6, or the accumulation module 700 can include the accumulator 860.
為了便於理解,下面結合圖9和圖10,以一個具體的例子對本發明將向量V1與一個完整矩陣M1相乘進行說明。如圖9所示,第一資料為向量V1,V1為(23 204),所述第一資料包括兩個第一元素,分別是32和204;第二資料包括一2×2矩陣M1,即: To facilitate understanding, the following example, referring to Figures 9 and 10, illustrates the invention's multiplication of vector V1 with a complete matrix M1. As shown in Figure 9, the first data is vector V1, which is (23 204). This first data includes two first elements, 32 and 204 respectively; the second data includes a 2×2 matrix M1, namely:
如圖10所示,按照位元位將向量和矩陣的元素拆成兩部分,包括第一部分即高4位元位(高位部分)、第二部分即低4位元位(低位部分)。拆分後,向量各元素高位部分對應構成一個新向量,各元素低位部分對應構成另一個新向量。類似地,拆分後,矩陣各元素高位部分對應構成一個新矩陣,矩陣各元素低位部分對應構成另一個新矩陣。As shown in Figure 10, the elements of vectors and matrices are split into two parts according to their bit positions: the first part, namely the high 4 bits (high-order part), and the second part, namely the low 4 bits (low-order part). After splitting, the high-order parts of each element of a vector correspond to form a new vector, and the low-order parts of each element correspond to form another new vector. Similarly, after splitting, the high-order parts of each element of a matrix correspond to form a new matrix, and the low-order parts of each element of a matrix correspond to form another new matrix.
具體而言,向量中的元素32的二進位數字為0b00100000,拆分後為:0b0010(高位部分)(對應十進位數字2)、0b0000(低位部分)(對應十進位數字0);向量中的元素204的二進位數字為0b11001100,拆分後為:0b1100(高位部分)(對應十進位數字12)、0b1100(低位部分)(對應十進位數字12)。按照類似的方式,對2×2矩陣中各元素進行了拆分(參見圖10)。其中,“0b”表示該數對應的二進位形式。Specifically, the binary representation of element 32 in the vector is 0b00100000, which can be split into: 0b0010 (high-order part) (corresponding to the decimal number 2) and 0b0000 (low-order part) (corresponding to the decimal number 0); the binary representation of element 204 in the vector is 0b11001100, which can be split into: 0b1100 (high-order part) (corresponding to the decimal number 12) and 0b1100 (low-order part) (corresponding to the decimal number 12). The elements in the 2×2 matrix are split in a similar manner (see Figure 10). Here, "0b" represents the binary representation of the number.
為了便於說明,下面以十進位數字的形式描述,應當理解,系統實際處理的可以是二進位數字。For ease of explanation, the following description is in decimal form. It should be understood that the system may actually process binary numbers.
拆分後,向量中多個第一元素的第一部分(高位部分)包括(2 12),多個第一元素的第二部分(低位部分)包括(0 12)。After splitting, the first part (high-order part) of multiple first elements in the vector includes (2 12), and the second part (low-order part) of multiple first elements includes (0 12).
矩陣中各第二元素拆分後對應的第一部分(高位部分)為: The first part (high-order part) corresponding to each of the second elements in the matrix after splitting is:
矩陣中各第二元素拆分後對應的第二部分(低位部分)為: The second part (lower-order part) corresponding to each second element in the matrix after splitting is:
將第一元素的兩部分與對應的第二元素的部分兩兩相乘後求和(即點乘)得到四組結果,其中所述兩兩相乘的運算可以在光子域實現,所述四組結果的每組結果包括兩個第一求和結果(兩個點乘乘積),每個所述第一求和結果表示多個所述第一元素拆分後的某一部分分別與對應的多個第二元素拆分後的某一部分相乘得到的多個乘積之和。如圖10所示,根據向量與矩陣的點乘,分別是:The summation (i.e., dot product) of each pair of parts of the first element with the corresponding part of the second element yields four sets of results. This pairwise multiplication can be performed in the photon domain. Each of the four sets of results includes two first summation results (two dot product products). Each first summation result represents the sum of multiple products obtained by multiplying a portion of the first element by its corresponding portion of the second element. As shown in Figure 10, according to the dot product of a vector and a matrix, they are:
多個第一元素的高位部分與對應的第二元素的高位部分的點乘結果:72和58,其中,72=2×6+12×5,58=2×11+12×3;The dot product of the higher-order parts of multiple first elements and the higher-order parts of the corresponding second elements: 72 and 58, where 72 = 2 × 6 + 12 × 5 and 58 = 2 × 11 + 12 × 3;
多個第一元素的低位部分與對應的第二元素的高位部分的點乘結果:60和36;The dot product of the lower part of multiple first elements and the higher part of the corresponding second elements: 60 and 36;
多個第一元素的高位部分與對應的第二元素的低位部分的點乘結果:196和12;The dot product of the higher-order parts of multiple first elements and the lower-order parts of the corresponding second elements: 196 and 12;
多個第一元素的低位部分與對應的第二元素的低位部分的點乘結果:168和12。The dot product of the lower part of multiple first elements and the lower part of the corresponding second element is 168 and 12.
在電子域,如圖10所示,由於進行了拆分,多個第一元素的高位部分與對應的第二元素的高位部分的點乘結果應當左移8位,對於十進位數字而言要乘以2^8倍,因此,二者的點乘結果變為:72×(2^8)=18432和58×(2^8)=14848。In the electronic domain, as shown in Figure 10, due to the splitting, the dot product of the high-order parts of multiple first elements and the corresponding high-order parts of the second elements should be shifted left by 8 bits. For decimal numbers, this should be multiplied by 2^8. Therefore, the dot product of the two becomes: 72×(2^8)=18432 and 58×(2^8)=14848.
由於進行了拆分,多個第一元素的低位部分與對應的第二元素的高位部分的點乘結果應當左移4位,對於十進位數字而言要乘以2^4倍,因此,二者的點乘結果變為:60×(2^4)=960和36×(2^4)=576。Because of the splitting, the dot product of the lower part of the first element and the higher part of the corresponding second element should be shifted 4 places to the left. For decimal numbers, it should be multiplied by 2^4. Therefore, the dot product of the two becomes: 60×(2^4)=960 and 36×(2^4)=576.
由於進行了拆分,多個第一元素的高位部分與對應的第二元素的低位部分的點乘結果應當左移4位,對於十進位數字而言要乘以2^4倍,因此,二者的點乘結果變為:196×(2^4)=3136和12×(2^4)=192。Because of the splitting, the dot product of the high-order part of the first element and the low-order part of the corresponding second element should be shifted 4 positions to the left. For decimal numbers, this should be multiplied by 2^4. Therefore, the dot product of the two becomes: 196×(2^4)=3136 and 12×(2^4)=192.
由於進行了拆分,多個第一元素的低位部分與對應的第二元素的低位部分的點乘結果無需移位,因此,二者的點乘結果仍然為:168和12。Because of the splitting, the dot product of the lower part of multiple first elements and the corresponding lower part of the second element does not need to be shifted. Therefore, the dot product of the two is still 168 and 12.
最後,將以上結果分別累加起來(進行求和),分別得到兩個第二求和結果,即: 18432+960+3136+168=22696, 14848+576+192+12=15628 因此,向量(32 204)與矩陣 相乘的結果為(22696 15628)。 Finally, summing the above results yields two second summation results: 18432 + 960 + 3136 + 168 = 22696, 14848 + 576 + 192 + 12 = 15628. Therefore, the vector (32 204) and the matrix... The result of multiplication is (22696 15628).
以上以將8位元數拆分成兩部分且矩陣為2×2矩陣為例進行了說明,但是本發明不限於此。向量和矩陣中的元素各自拆分的份數及每份的位數可以相同,也可以不相同。例如,將8位元的數按位元位拆分為3位、5位元的兩部分。又如,將16位元的數按位元位拆成5位、5位、6位的三部分。The above explanation uses the example of splitting an 8-bit number into two parts using a 2×2 matrix, but the invention is not limited to this. The number of parts and the number of bits in each part of the vector and matrix can be the same or different. For example, an 8-bit number can be split into two parts of 3 bits and 5 bits. Similarly, a 16-bit number can be split into three parts of 5 bits, 5 bits, and 6 bits.
本領技術人員應當理解,以上所公開的僅為本發明的實施方式而已,當然不能以此來限定本發明請求專利保護的權利範圍,依本發明實施方式所作的等同變化,仍屬本發明之權利要求所涵蓋的範圍。Those skilled in the art should understand that what has been disclosed above is merely an embodiment of the present invention, and should not be used to limit the scope of the patent protection claimed by the present invention. Equivalent variations made according to the embodiments of the present invention are still within the scope of the claims of the present invention.
S101-S106,S201-203,S301-304:步驟 10:光子計算裝置 20:光子計算裝置 30:光子計算裝置 100:第一資料拆分模組 200:第二資料拆分模組 300:光學處理模組 400:光電轉換模組 500:求和處理模組 600:縮放處理模組 700:累加模組 800:類比/數位轉換模組 811,812:數位/類比轉換器 821,822:光學乘法器 831,832,833,834:光電轉換子模組 841,842,843,844:類比/數位轉換器 851,852,853:操作 860:累加器 871,872,873,874:求和單元 900:移位模組 S101-S106, S201-203, S301-304: Steps 10: Photonic Computing Device 20: Photonic Computing Device 30: Photonic Computing Device 100: First Data Splitting Module 200: Second Data Splitting Module 300: Optical Processing Module 400: Optoelectronic Conversion Module 500: Summation Processing Module 600: Scaling Processing Module 700: Accumulation Module 800: Analog/Digital Conversion Module 811, 812: Digital/Analog Converter 821, 822: Optical Multiplier 831, 832, 833, 834: Optoelectronic Conversion Sub-Modules 841, 842, 843, 844: Analog/Digital Converter 851, 852, 853: Operator 860: Accumulator 871, 872, 873, 874: Summation Unit 900: Shift Module
為了更清楚地說明本申請實施例中的技術方案,下面將對實施例描述中所需要使用的附圖作簡單地介紹。顯而易見地,下面描述中的附圖僅僅是本申請的一些實施例,對於本領域技術人員來講,在不付出創造性勞動的前提下,還可以根據這些附圖獲得其他的實施方式,其中, 圖1是根據本發明一實施方式的光子計算的方法的流程圖; 圖2是根據本發明另一實施方式的光子計算的方法的流程圖; 圖3是根據本發明另一實施方式的光子計算的方法的流程圖; 圖4是根據本發明一實施方式的光子計算裝置的方塊圖; 圖5是根據本發明另一實施方式的光子計算裝置的方塊圖; 圖6是根據本發明另一實施方式的光子計算裝置的方塊圖; 圖7是示出根據本發明的實施方式拆分輸入數的示例的示意圖; 圖8是示出根據本發明的實施方式的光子計算裝置的示例架構的示意圖; 圖9是示出根據本發明的實施方式的輸入向量和矩陣的示例的示意圖;以及 圖10是示出本發明的光子計算方法處理圖9所示的輸入資料的邏輯的示意圖。 To more clearly illustrate the technical solutions in this application embodiment, the accompanying drawings used in the embodiment description will be briefly introduced below. It is evident that the accompanying figures described below are merely some embodiments of this application. For those skilled in the art, other embodiments can be derived from these figures without any creative effort. Specifically, Figure 1 is a flowchart of a photon calculation method according to one embodiment of the present invention; Figure 2 is a flowchart of a photon calculation method according to another embodiment of the present invention; Figure 3 is a flowchart of a photon calculation method according to another embodiment of the present invention; Figure 4 is a block diagram of a photon calculation device according to one embodiment of the present invention; Figure 5 is a block diagram of a photon calculation device according to another embodiment of the present invention; Figure 6 is a block diagram of a photon calculation device according to another embodiment of the present invention; Figure 7 is a schematic diagram illustrating an example of splitting input data according to an embodiment of the present invention; Figure 8 is a schematic diagram illustrating an example architecture of a photonic computing device according to an embodiment of the present invention; Figure 9 is a schematic diagram illustrating an example of input vectors and matrices according to an embodiment of the present invention; and Figure 10 is a schematic diagram illustrating the logic of the photonic computing method of the present invention in processing the input data shown in Figure 9.
S101~S104:步驟 S101~S104: Steps
Claims (37)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2023111658610 | 2023-09-08 | ||
| CN202311165861.0A CN119597108A (en) | 2023-09-08 | 2023-09-08 | Photon calculation method, photon calculation device and computer equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TW202511886A TW202511886A (en) | 2025-03-16 |
| TWI928362B true TWI928362B (en) | 2026-06-11 |
Family
ID=94829379
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW113134009A TWI928362B (en) | 2023-09-08 | 2024-09-09 | Photonic computing method, device, and computer equipment |
Country Status (3)
| Country | Link |
|---|---|
| CN (1) | CN119597108A (en) |
| TW (1) | TWI928362B (en) |
| WO (1) | WO2025051089A1 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119882927A (en) * | 2025-03-28 | 2025-04-25 | 清华大学 | Wafer-level photoelectric fusion intelligent computing method and system |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112424796A (en) * | 2018-06-05 | 2021-02-26 | 光子智能股份有限公司 | Photoelectric computing system |
| US11017309B2 (en) * | 2017-07-11 | 2021-05-25 | Massachusetts Institute Of Technology | Optical Ising machines and optical convolutional neural networks |
| CN113325917A (en) * | 2020-02-28 | 2021-08-31 | 华为技术有限公司 | Light computing device, system and computing method |
| TW202201164A (en) * | 2020-06-29 | 2022-01-01 | 美商萊特美特股份有限公司 | Fast prediction processor |
| CN114514490A (en) * | 2019-07-29 | 2022-05-17 | 轻物质公司 | System and method for analog computation using linear optical processors |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115409167A (en) * | 2021-05-27 | 2022-11-29 | 中国科学院上海光学精密机械研究所 | Method, system, terminal and medium for calculating digital optical matrix of any system |
| CN116520937A (en) * | 2022-01-21 | 2023-08-01 | 上海曦智科技有限公司 | Photon computing system |
-
2023
- 2023-09-08 CN CN202311165861.0A patent/CN119597108A/en active Pending
-
2024
- 2024-09-02 WO PCT/CN2024/116313 patent/WO2025051089A1/en not_active Ceased
- 2024-09-09 TW TW113134009A patent/TWI928362B/en active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11017309B2 (en) * | 2017-07-11 | 2021-05-25 | Massachusetts Institute Of Technology | Optical Ising machines and optical convolutional neural networks |
| CN112424796A (en) * | 2018-06-05 | 2021-02-26 | 光子智能股份有限公司 | Photoelectric computing system |
| CN114514490A (en) * | 2019-07-29 | 2022-05-17 | 轻物质公司 | System and method for analog computation using linear optical processors |
| CN113325917A (en) * | 2020-02-28 | 2021-08-31 | 华为技术有限公司 | Light computing device, system and computing method |
| TW202201164A (en) * | 2020-06-29 | 2022-01-01 | 美商萊特美特股份有限公司 | Fast prediction processor |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2025051089A1 (en) | 2025-03-13 |
| TW202511886A (en) | 2025-03-16 |
| CN119597108A (en) | 2025-03-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109784486B (en) | An optical neural network processor and its training method | |
| TWI884162B (en) | Systems and methods for analog computing using a linear photonic processor | |
| US11860666B2 (en) | Matrix multiplication using optical processing | |
| TW202103025A (en) | Hybrid analog-digital matrix processors | |
| CN109784485A (en) | A kind of optical neural network processor and its calculation method | |
| US20220405565A1 (en) | A digital signal modulation method for a photon artificial intelligence computing chip | |
| CN111899147A (en) | Convolution kernel calculation accelerator and convolution kernel calculation method | |
| WO2025051089A1 (en) | Photon computing method and apparatus, and computer device | |
| CN113592084A (en) | Photon neural network on chip based on reverse optimization superstructure convolution kernel | |
| CN119576067B (en) | High-precision analog optical computing method and system based on bit slicing | |
| CN112232487B (en) | Optical neural network chip and its calculation method | |
| Xia et al. | BITLUME: precision-flexible photonic computing for ultra-fast and energy-efficient DNN acceleration | |
| CN119721154A (en) | A large model computing device and method based on MZI cascade network | |
| Pei et al. | Joint device architecture algorithm codesign of the photonic neural processing unit | |
| WO2023168629A1 (en) | Optical computing system and optical signal processing method | |
| JP7679876B2 (en) | Analog-to-digital conversion method and analog-to-digital converter | |
| CN119234195A (en) | Optical computing system and chip | |
| WO2023170406A1 (en) | Optical encoders | |
| CN120560439A (en) | Optical-electrical hybrid computing system | |
| WO2025224278A1 (en) | Hybrid linear algebra optical processing unit without interferometers | |
| CN114168107A (en) | Vector matrix multiplication method with adjustable memory precision and arithmetic unit | |
| CN122111174A (en) | Method and device for processing data by photon-electron hybrid computing system | |
| TWI876417B (en) | Computing system and method of processing photonic computing results | |
| CN121387017A (en) | Optical accelerating device and method based on incoherent superposition and error truncation | |
| US12298801B2 (en) | Method and system for determining a guided random data sampling |