Quantification method and system, chip, equipment, storage medium and product
By extracting and processing the high and low-bit information of the input data of the memory and computing integrated chip, combined with the memory and computing integrated matrix multiplication and addition principle, high-precision data quantification is achieved, solving the problems of low calculation accuracy and information loss in the existing technology, and improving the The accuracy of matrix multiplication and addition operation.
Patent Information
- Application Number
- CN202411195207.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-03
AI Technical Summary
The calculation accuracy of existing memory and computing chips only supports 4 bits of integers or less, resulting in low calculation accuracy and large errors when performing matrix multiplication and addition operations. The quantization method will lose some information when mapping floating point numbers to low bits. .
By obtaining the high- and low-bit information of the input vector and vector, it is processed and combined separately to form a new vector so that the multiplication and addition operations are performed on the integrated memory chip, retaining the high-bit main information and low-bit details of the data, and reducing the information Loss, improve calculation accuracy.
The calculation accuracy of the memory and computing chip is improved, ensuring that data with high similarity in scenarios such as vector search is not quantized into the same data, and improving the accuracy of matrix multiplication and addition operations.
Smart Images

Figure CN119065632A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to but is not limited to the field of communications, and in particular to a quantization method, a quantization system, a storage and computing integrated chip, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] At present, storage-computing integration is a technology that uses a memory crossbar array to implement matrix-vector multiplication. By presetting weight parameters to the storage array, inputting source data, and implementing in-situ calculations in the storage unit, the required calculation results are obtained. Then, with the help of storage-computing integration technology, the core operations of related intelligent applications, namely matrix multiplication and addition operations, can be realized.
[0003] It should be noted that the storage-computing technology is in its early stages of development. Due to the constraints of its principles, processes, manufacturing and other factors, it only supports integer (int) 4-bit and below calculation accuracy. Therefore, before using the storage-computing chip for matrix multiplication and addition operations, it is necessary to first quantize the floating-point numbers to be quantized, that is, directly map a certain range of floating-point numbers to a low-bit fixed point, and then deploy the quantized data to the storage-computing chip, so that it can adapt to the calculation accuracy supported by the storage-computing chip.
[0004] However, the quantization method in the related art will lose some information of the floating-point number to be quantized during quantization, resulting in low calculation accuracy and large errors when the storage and computing integrated chip performs matrix multiplication and addition operations. Summary of the invention
[0005] The embodiments of the present application provide a quantization method, a quantization system, a storage-computing integrated chip, an electronic device, a computer-readable storage medium, and a computer program product, and provide a data quantization method and system for a storage-computing integrated chip.
[0006] In a first aspect, an embodiment of the present application provides a quantification method, including:
[0007] Obtain a first vector and a second vector input by a first object; wherein each data in the first vector and the second vector is normalized to a first range;
[0008] Extracting high-order information and low-order information of each data;
[0009] Based on the high-bit information of each data and the low-bit information of each data, a third vector corresponding to the first vector and a fourth vector corresponding to the second vector are obtained;
[0010] A multiplication and addition operation is performed on the third vector and the fourth vector to obtain and output a first result.
[0011] In a second aspect, an embodiment of the present application provides a quantization system, the quantization system comprising:
[0012] A quantization module, used for acquiring a first vector and a second vector input by a first object; wherein each data in the first vector and the second vector is normalized to a first range;
[0013] The quantization module is further used to extract high-bit information and low-bit information of each data;
[0014] The quantization module is further used to obtain a third vector corresponding to the first vector and a fourth vector corresponding to the second vector based on high-bit information of each data and low-bit information of each data;
[0015] A calculation module, used for performing a multiplication and addition operation on the third vector and the fourth vector to obtain a first result;
[0016] An output module is used to output the first result.
[0017] In a third aspect, an electronic device includes: a storage-computing integrated chip; the storage-computing integrated chip includes:
[0018] A memory for storing executable instructions;
[0019] The processor is used to implement the above quantization method when executing the executable instructions stored in the memory.
[0020] In a fourth aspect, an embodiment of the present application provides a chip for implementing the above-mentioned quantization method.
[0021] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, which enables a computer to execute the above-mentioned quantization method.
[0022] In a sixth aspect, an embodiment of the present application provides a computer program product, including computer program instructions, which enable a computer to execute the above-mentioned quantization method.
[0023] In a seventh aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned quantization method.
[0024] The quantization method provided in the present application retains both the high-order main information of the data and the low-order detailed information of the data, thereby minimizing the loss of data information, improving the accuracy of data quantization, and thereby improving the calculation accuracy based on the integrated storage and computing chip; at the same time, for scenarios such as vector retrieval that require calculating the similarity of tens of millions of vectors, different vectors can be accurately distinguished so that data with high similarity will not be quantized as the same data. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of a memristor provided in the related art;
[0026] Figure 2 A schematic diagram of a quantization process provided in the related art;
[0027] Figure 3 Schematic diagram of the quantification method provided in the embodiment of the present application Figure 1 ;
[0028] Figure 4 A schematic block diagram of a quantization system provided in an embodiment of the present application
[0029] Figure 5 Schematic diagram of the quantification method provided in the embodiment of the present application Figure 2 ;
[0030] Figure 6 A schematic diagram of a quantization process provided in an embodiment of the present application;
[0031] Figure 7 A schematic block diagram of a quantization system provided in an embodiment of the present application;
[0032] Figure 8 A schematic structural diagram of a communication device provided in an embodiment of the present application;
[0033] Fig. 9 A schematic structural diagram of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0036] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0037] Before explaining this application, the quantification method in the related art is described here:
[0038] Whether it is artificial intelligence (AI) model reasoning or intelligent applications such as vector retrieval, their core operations are matrix multiplication and addition operations, such as convolution operations in AI models, full connection operations, query key value (QKV) attention matrix operations in transform architectures, and similarity operations between vectors in vector retrieval. These are typical matrix multiplication and addition operations, and these operations are all computationally intensive. Related technologies can perform matrix multiplication and addition operations based on the von Neumann architecture. However, the graphics processing unit (GPU) and central processing unit (CPU) of the von Neumann architecture have the problems of high computing energy consumption and slow computing speed.
[0039] The emerging storage-computing integrated technology can break through the power consumption wall and storage wall of the von Neumann architecture; therefore, the advantages of storage-computing integrated in matrix multiplication and addition can be used to improve the speed of matrix multiplication and addition operations and reduce computing energy consumption. However, storage-computing integrated technology is in its early stages of development. Restricted by its principles, processes, manufacturing and other factors, the calculation accuracy of existing storage-computing integrated chips only supports the calculation accuracy of int4 bits and below. Therefore, when using storage-computing integrated chips, it is necessary to quantize the existing float32 floating-point numbers to adapt to the calculation accuracy of storage-computing integrated chips. However, the quantization method in the relevant technology will lose part of the information of the floating-point numbers to be quantized during quantization, resulting in low calculation accuracy and large errors when the storage-computing integrated chip performs matrix multiplication and addition operations. Therefore, it is currently necessary to provide a high-precision data quantization method based on the storage-computing integrated characteristics and adapted to storage-computing integrated, so as to effectively improve the quantization accuracy of data and promote the application of storage-computing integrated in scenarios such as AI model reasoning and vector retrieval.
[0040] Storage-computing integration is a technology that uses a memory crossbar array to implement matrix-vector multiplication. By presetting weight parameters to the memory array and inputting source data, in-situ calculations are performed in the memory cells to obtain the required calculation results. Below, we take the new non-volatile memory device: memristor as an example to introduce the calculation principle of storage-computing integration.
[0041] Figure 1 is a schematic diagram of a memristor provided in the related art, such as Figure 1 As shown in FIG. 1 , the memory-computing integration based on memristors mainly utilizes the non-volatile resistance of the device to encode the data matrix into the resistance value of the device, and uses the resistance value as the matrix analog weights. For example, G 11 , G 12 , G 13 , G 21 , G 22 , G 23 , ..., G n1 , G n2 , G n3 ; Use Ohm's law by applying voltages on one side of the device, e.g., v1, v2, and v3, and reading the current on the other side, e.g., l1 = ∑G 1j v j , l2=∑G 2j v j and l3=∑G 3j v j , where j = 1, 2, 3, that is, the multiplication operation between the primary voltage and the conductance corresponding to formula (1) is completed. By preparing this device in a cross-shaped manner, multiplication operations in multiple dimensions can be realized.
[0042]
[0043] It should be noted that a memristor (Resistive Random Access Memory, ReRAM) can be equivalently viewed as the superposition of an adder, a multiplier and a memory.
[0044] According to the above calculation principle, in the matrix multiplication and addition operation, only one voltage operation is required, and then the output current signal of each column is collected to obtain the result of a matrix-vector multiplication operation. Since the entire operation process does not need to repeatedly read a large number of model parameters from the memory, the bottleneck of the von Neumann architecture is bypassed, so the energy efficiency ratio is significantly improved, which has obvious advantages in memory-intensive computing scenarios such as vector retrieval and AI computing.
[0045] However, the calculation accuracy of the storage and computing integrated chip in the related technology only supports the calculation accuracy of int4 bits and below. For example, if the storage and computing integrated chip supports int2, the floating point number needs to be quantized to an integer between [-3, 3]. If the storage and computing integrated chip supports int4, the floating point number needs to be quantized to an integer between [-7, 7]. Therefore, when using the storage and computing integrated chip, the existing float32 floating point numbers need to be quantized to adapt to the calculation accuracy of the storage and computing integrated chip.
[0046] Quantization is to establish a data mapping relationship between fixed-point and floating-point data, so as to obtain better benefits at the cost of less precision loss. It can be simply understood as using "low-bit" numbers to represent FP32 and other values. The commonly used floating-point to fixed-point quantization method is as follows:
[0047]
[0048] in, R represents the real floating-point value, Q represents the quantized fixed-point value, Z represents the quantized fixed-point value corresponding to the floating-point value, and S represents the minimum scale that can be represented after fixed-point quantization; R max Represents the largest floating point number; R min Indicates the smallest floating point number; Q max Represents the largest fixed-point number, Q min Represents the smallest fixed-point number.
[0049] Figure 2 It is a quantitative schematic diagram provided in the related art; Figure 2 As shown, the floating point number is quantized into int5 bits and integers between (0, 31) are recorded.
[0050] The embodiment of the present application provides a quantization method, which is applied to electronic equipment, referring to Figure 3 As shown, the method comprises the following steps:
[0051] Step 301: Obtain a first vector and a second vector input by a first object.
[0052] Each data in the first vector and the second vector is normalized to be within a first range.
[0053] In the embodiment of the present application, the first object includes but is not limited to a person and an electronic device.
[0054] It should be noted that the first vector and the second vector are two vectors to be subjected to matrix operation.
[0055] Here, each data in the first vector and each data in the second vector may be a single parameter or a set of parameters.
[0056] In the embodiment of the present application, the number of rows of the first vector is the same as the number of columns of the second vector; or the number of rows of the second vector is the same as the number of columns of the first vector.
[0057] In an embodiment of the present application, the normalized value range space of the vector data, that is, the first range is a real number greater than or equal to 0 and less than or equal to 1; or the normalized value range space of the vector data, that is, the first range is a real number greater than or equal to -1 and less than or equal to 1.
[0058] Step 302: extract high-order information and low-order information of each data.
[0059] In the embodiment of the present application, the high-bit information of the data is the main information of the data; the low-bit information of the data represents the detailed information of the data.
[0060] In an embodiment of the present application, the high-order information and the low-order information of each data in the first vector are extracted to obtain the high-order information of each data in the first vector and the low-order information of each data in the first vector; the high-order information and the low-order information of each data in the second vector are extracted to obtain the high-order information of each data in the second vector and the low-order information of each data in the second vector.
[0061] Step 303: Based on the high-bit information of each data and the low-bit information of each data, obtain a third vector corresponding to the first vector and a fourth vector corresponding to the second vector.
[0062] In an embodiment of the present application, each data in the first vector is decomposed into high and low bits, and based on the high-bit information of each data and the low-bit information of each data, the processed data corresponding to each data is obtained; for example, the high-bit information of each data and the low-bit information of each data are recombined to obtain the processed data corresponding to each data; or the high-bit information of each data and the low-bit information of each data are encrypted to obtain the processed data corresponding to each data; and each data in the first vector is replaced with the corresponding processed data to obtain a third vector; and each data in the second vector is replaced with the corresponding processed data to obtain a fourth vector.
[0063] Step 304: perform multiplication and addition operations on the third vector and the fourth vector to obtain and output a first result.
[0064] In the embodiment of the present application, each data in the fourth vector is encoded as a resistance value and deployed in the storage and computing integrated chip. The third vector is encoded as a voltage and input into the storage and computing integrated chip, and is calculated with each data in the fourth vector to obtain a first result.
[0065] The embodiment of the present application provides a quantization method, which includes: obtaining a first vector and a second vector input by a first object; wherein each data in the first vector and the second vector is normalized to within a first range; extracting high-order information and low-order information of each data; based on the high-order information of each data and the low-order information of each data, obtaining a third vector corresponding to the first vector and a fourth vector corresponding to the second vector; performing multiplication and addition operations on the third vector and the fourth vector to obtain and output a first result. In other words, the quantization method provided by the present application retains both the high-order main information of the data and the low-order detailed information of the data, minimizes the loss of data information, improves the accuracy of data quantization, and thereby improves the calculation accuracy based on the storage and computing integrated chip; at the same time, for scenarios such as vector retrieval that require calculating the similarity of tens of millions of vectors, different vectors are accurately distinguished so that data with high similarity will not be quantized as the same data.
[0066] In some embodiments, step 302, extracting high-order information and low-order information of each data, can be implemented by the following steps:
[0067] Step A1: Obtain the calculation accuracy supported by the storage and computing integrated chip.
[0068] In some embodiments, the computing accuracy supported by the integrated storage and computing chip may be preset before the integrated storage and computing chip leaves the factory.
[0069] In some embodiments, if the executor of the quantization method of the present application is an electronic device, the electronic device obtains the supported calculation accuracy from the storage and computing integrated chip based on relevant requests; if the executor of the quantization method of the present application is the storage and computing integrated chip, step A1 is omitted and step A2 is directly executed.
[0070] In some embodiments, the computing precision supported by the integrated storage and computing chip includes int2 and int4.
[0071] Step A2: extract high-order information and low-order information of each data based on calculation accuracy.
[0072] In some embodiments, based on the calculation accuracy, the magnification corresponding to the first range is calculated; based on the magnification, the high-bit information of each data is obtained; based on the magnification and the high-bit information, the low-bit information of each data is obtained.
[0073] Exemplarily, for each data y in the first vector, the magnification s is calculated according to the precision n supported by the integrated storage and computing chip and formula (3).
[0074] s=2 n-1 -1 (3)
[0075] According to the magnification s and formula (4), high-order information A is obtained;
[0076] A= roundInt(y i *s) (4)
[0077] According to the magnification s, the high-bit information A and formula (5), the low-bit information B is obtained.
[0078] B = roundInt((y i -A / s)*s*s) (5)
[0079] Among them, y i is the i-th data in the first vector.
[0080] Furthermore, based on the high-order information of the i-th data in the first vector and the low-order information of the i-th data in the first vector, the quantized data corresponding to the i-th data is obtained, that is, y i ≈A / s+B / s 2 .
[0081] Exemplarily, for each data x in the second vector, the magnification s is calculated according to the precision n supported by the integrated storage and computing chip and formula (3).
[0082] According to the magnification s and formula (6), high-order information C is obtained;
[0083] C = roundInt(x ij *s) (6)
[0084] According to the magnification s, the high-bit information C and formula (7), the low-bit information D is obtained.
[0085] D = roundInt((x ij -C / s)*s*s) (7)
[0086] Among them, x ij It is the j-th data in the second vector corresponding to the i-th data in the first vector.
[0087] Further, based on the high-bit information of the j-th data in the second vector corresponding to the i-th data in the first vector and the low-bit information of the j-th data in the second vector corresponding to the i-th data in the first vector, the quantized data corresponding to the j-th data is obtained, that is, x ij ≈C / s+D / s 2 .
[0088] In some embodiments, step 303, obtaining the third vector corresponding to the first vector and the fourth vector corresponding to the second vector based on the high-bit information of each data and the low-bit information of each data, can be implemented by the following steps:
[0089] Step B1: Obtain a third vector based on the magnification, the high-bit information of each data in the first vector, and the low-bit information of each data in the first vector.
[0090] In some embodiments, the magnification factor, the high-bit information of each data in the first vector, and the low-bit information of each data in the first vector are combined to obtain quantized data corresponding to each data in the first vector; the quantized data corresponding to each data in the first vector are amplified to obtain amplified data corresponding to each data in the first vector; the amplified data corresponding to each data in the first vector are used to replace each data in the first vector to obtain a third vector.
[0091] It should be noted that based on the principle of integrated matrix multiplication and addition and the principle of analog-to-digital converter (DAC), the high-order information A and the low-order information B after the split of each data y in the first vector are amplified and combined to form the final quantized data (A*s2, A*s, B*s, B); where s is the amplification factor.
[0092] Here, each data y in the first vector is converted into (A / s 2 , A / s 3 , B / s 3 , B / s 4 ) indicates that because the DAC part of the storage and computing can only support integer input, (A / s 2 , A / s 3 , B / s 3 , B / s 4 ) 4 The result of the operation is amplified by a certain multiple, which does not affect the accuracy of the final operation. Therefore, all data can be amplified in equal proportion. Finally, each data y in the first vector is quantized into (A*s 2 , A*s, B*s, B), that is, each data y in the first vector is composed of four data (A*s 2 , A*s, B*s, B) represents; further, using (A*s 2 , A*s, B*s, B), replace each data in the first vector to obtain the third vector.
[0093] Step B2: based on the high-bit information of each data in the second vector and the low-bit information of each data in the second vector, obtain the quantized data corresponding to each data in the second vector.
[0094] In some embodiments, high-order information of each data in the second vector and low-order information of each data in the second vector are combined to obtain a fourth vector.
[0095] It should be noted that, based on the principle of integrated matrix multiplication and addition, the high-order information C and the low-order information D after the split of each data x in the second vector are allocated and combined; that is, each data x in the second vector is quantized into (C, D, C, D), that is, each data x in the second vector is represented by four data (C, D, C, D); further, (C, D, C, D) is used to replace each data x in the second vector to obtain a fourth vector.
[0096] It should be noted that the number of bits of the quantized data corresponding to each data matches the first parameter; wherein the first parameter includes the size of the storage and computing integrated chip array and the dimension of the vector to be quantized; the vector to be quantized includes the first vector and the second vector.
[0097] For example, when the storage-computing integrated chip array is large and the vector dimension is small, the input data and the data to be deployed can be represented by 4-bit integers, that is, (A*s 2 , A*s, B*s, B) and (C, D, C, D) are used to quantize the input data and the data to be deployed respectively. If the array size is small or the vector dimension is large, you can use the quantized (A*s 2 , A*s, B*s, B) and (C, D, C, D) respectively select several integers for quantization. For example, the input and data to be deployed are quantized into 3 integers respectively, that is, the input data is quantized into (A*s, A, B), and the data to be deployed is quantized into (C, D, C). For example, the input and data to be deployed are quantized into 2 integers respectively, that is, the input data is quantized into (A*s, A), and the data to be deployed is quantized into (C, D). Of course, as the number of integers selected after quantization decreases, the quantization accuracy will decrease slightly, but it is still higher than the traditional quantization method.
[0098] Figure 4 It is a schematic block diagram of a quantization system provided in an embodiment of the present application.
[0099] like Figure 4 As shown, the quantization system includes an input data input module, an input data quantization module for storage and computing integration, a data input module to be deployed, a data quantization module to be deployed for storage and computing integration, a data deployment module to be deployed, a storage and computing integration calculation module, a calculation result output module, and a communication module. In the input data quantization module, an input data quantization method is proposed based on the present application to quantize each data in the input data, that is, firstly, based on the precision n supported by the storage and computing integration, the high and low bits of the input data y are fixed-point split into high-bit information A and low-bit information B, and then, based on the principle of storage and computing integration matrix multiplication and addition and the principle of DAC, the split high-bit information A and low-bit information B are multiplied and combined to form the final quantized data.
[0100] In the data quantization module to be deployed, based on the data quantization method to be deployed proposed in the present application, each data in the data to be deployed is quantized, that is, first, based on the precision n supported by the integrated storage and computing, the high and low bits of the data x to be deployed are split into high-bit information C and low-bit information D at a fixed point, and then, based on the principle of integrated storage and computing matrix multiplication and addition, the split high-bit information C and low-bit information D are combined to form the final quantized data.
[0101] In the data deployment module to be deployed, the quantified data to be deployed is transmitted to the data deployment module to be deployed through the communication module, and the quantified data to be deployed is deployed to the storage and computing integrated array.
[0102] The storage-computing integrated computing module calculates based on the quantized input data and the quantized data to be deployed in the storage-computing integrated system.
[0103] The calculation result output module outputs the calculation results of the input data and the data to be deployed.
[0104] It should be noted that the input data and data to be deployed in this application can be a number, a vector or a matrix. Then the quantized data to be deployed is transmitted to the storage-computing integrated chip through the communication module, and the quantized data to be deployed is deployed on the storage-computing integrated chip. Finally, the quantized input data is transmitted to the storage-computing integrated chip through the communication module to realize the accurate multiplication and addition calculation of the quantized input data and the data to be deployed, reduce the noise caused by the quantization process, improve the calculation accuracy, and perform high-precision quantization of the input data and the data to be deployed in the data quantization module based on the storage-computing integrated characteristics.
[0105] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0106] Taking the video recall in the first video recommendation as an example, how the quantization method of this application is implemented is explained. In addition to being suitable for the recall of intelligent recommendation, this solution can also be used for any other matrix multiplication and addition related applications, such as AI model reasoning, etc. Video recall is to calculate the vector similarity between the user vector and the first video base vector, and select several videos that are most relevant to the user's interests and hobbies to recommend to the user. The similarity calculation process formula is, where X is the video base vector. Once the base vector X is trained, it remains unchanged for a period of time. Therefore, -0.5|X| 2 It can be calculated offline in advance as a constant. Therefore, the key calculation of video recall is dot(y, X), that is, the multiplication and addition operation of the user vector y and each video vector in the base library, which can be accelerated by integrating storage and computing. However, in this calculation process, the accuracy of data quantization directly affects the calculation accuracy of vector similarity, that is, it affects the accuracy of the video recommended to the user.
[0107] Figure 5 is a flow chart of a quantification method provided by this application; Figure 5 As shown:
[0108] Step 501, data normalization: First, the input data and the data to be deployed are normalized, and each number is normalized to (-1, 1).
[0109] Step 502, in the input data quantization module, the input data is split into high and low fixed points based on the precision supported by the storage and computing chip: that is, according to the calculation precision n supported by the storage and computing chip, each data in the input data is split into high and low bits, and the high-bit information is A and the low-bit information is B.
[0110] It should be noted that the specific process of high-low fixed-point splitting is as follows: First, according to the precision n supported by the storage and computing integration, the magnification s (s = 2 n-1 -1); according to the magnification s, obtain the high-order information A (A = roundInt (y i *s)); According to the magnification s and the high-bit information A, obtain the low-bit information B (B = roundInt ((y i -A / s)*s*s)); therefore, y i ≈A / s+B / s 2 .
[0111] Step 503: In the data quantization module to be deployed, the input data is split into high and low bits based on the precision supported by the storage and computing chip: according to the calculation precision n supported by the storage and computing chip, each data in the data to be deployed is split into high and low bits to obtain high-bit information C and low-bit information D.
[0112] It should be noted that the high-low fixed-point splitting process is as follows: according to the magnification s, obtain the high-bit information C (C = roundInt (x ij *s)); According to the magnification s and the high-bit information C, obtain the low-bit information D (D = roundInt ((x ij -C / s)*s*s)); therefore, x ij ≈C / s+D / s 2 .
[0113] Through step 1 to step 3, the input data and the data to be deployed are decomposed into high and low data, that is, y i ≈A / s+B / s 2 , x ij ≈C / s+D / s 2 . Due to the matrix multiplication and addition operation dot(y, X) = [[y1*x 1,1 +y2*x 1,2 +y3*x1,3 ……][y1*x 2,1 +y2*x 2,2 +y3*x 2,3 ……]], the matrix multiplication and addition operation after high and low bit decomposition is converted into yi*xij≈(A / s+B / s 2 )*(C / s+D / s 2 )=A / s*C / s+A / s*D / s 2 +B / s 2 *C / s+B / s 2 *D / s 2 =A*C / s 2 +A / s 3 *D+B / s 3 *C+B / s 4 *D. Therefore, in order to make the decomposed input data and the data to be deployed meet the requirements of storage-computation-integrated matrix multiplication and addition, it is necessary to integrate the high- and low-bit decomposed input data (A and B) and the data to be deployed (C and D), and the specific integration method is steps 504 to 505.
[0114] Step 504: In the input data quantization module, based on the principle of storage-computation-in-one matrix multiplication and addition and the principle of DAC, the A and B split in step 502 are multiplied and combined to form the final quantized data (A*s2, A*s, B*s, B): that is, each data in the input data is multiplied by (A / s 2 , A / s 3 , B / s 3 , B / s 4 ) indicates that because the DAC part of the storage and computing can only support integer input, (A / s 2 , A / s 3 , B / s 3 , B / s 4 ) 4 The result of the operation is magnified by a certain multiple, which does not affect the accuracy of the final operation. Therefore, all data can be magnified in equal proportion. Finally, the input data is quantized into (A*s 2 , A*s, B*s, B), that is, each input data consists of four data (A*s 2 , A*s,B*s,B) represents.
[0115] Step 505: In the data quantization module to be deployed, based on the principle of matrix multiplication and addition with storage and calculation integration, the high and low-order data C and D split in step 503 are allocated and combined: that is, each number of the data to be deployed is quantized into (C, D, C, D), that is, each data to be decomposed is represented by four data (C, D, C, D) with a precision of n.
[0116] Step 506: Perform data deployment in the data deployment module to be deployed; encode each number in the data to be deployed as a resistance value based on the data (C, D, C, D) quantized in step 505 and deploy it into the storage and computing integrated chip.
[0117] Step 507: In the storage-computing integrated computing module, the multiplication and addition operations of the quantized input data and the quantized data to be deployed are completed; that is, the input data (A*s2, A*s, B*s, B) is encoded as a voltage and input into the storage-computing integrated chip to be calculated with the deployed data.
[0118] It should be noted that, based on the data quantization method for the storage-computing integrated chip of the present application, accurate calculation of the similarity between user vectors and video vectors is achieved.
[0119] Step 508: Output the calculation results in the calculation result output module.
[0120] The following is an introduction to the first video recommended embodiment:
[0121] Assume that the vector of user y is y = [0.7707455, -0.58186924, ..., 0.22079656]
[0122] The two videos x1 and x2 in the first video base X have the corresponding video base vector: X = [x1, x2] = [[0.5943665, 0.49899095, ..., 0.52781063][0.6358768, 0.32733738, ..., -0.73765725]]
[0123] S1. Data normalization: First, the input data (user vector y) and the data to be deployed (video base library vector X) are normalized, and each number is normalized to (-1, 1).
[0124] S2. In the input data quantization module, the input data is split into high and low bits according to the fixed-point splitting method of the input data: that is, for each data y in the user vector y i Decompose the high and low bits, with the high bit part being A and the low bit part being B.
[0125] For example: y1 = 0.7707455, the maximum precision supported by the integrated storage and computing chip is 4 bits, according to the formula s = 2 n-1 -1, the calculated magnification is s = 7. After decomposing the high and low bits of y1, A = 5, B = 3, A / s + B / s 2 =0.7755102.
[0126] S3. In the data quantization module to be deployed, the data to be deployed is decomposed according to the fixed-point splitting method of the data to be deployed: that is, for each data x in the base library vector X,ij Perform high-low decomposition, decomposing the high-order part into C and the low-order part into D.
[0127] For example: 11 =0.5943665, the maximum precision supported by the integrated storage and computing chip is 4 bits, according to the formula s=2 n-1 -1, calculated s = 7, x 11 After high and low position decomposition, C=4, D=1, C / s+D / s 2 =0.5918367.
[0128] Through steps S1 to S3, the user vector (input data) and the video vector (data to be deployed) are decomposed into data, that is, y i ≈A / s+B / s 2 , x ij ≈C / s+D / s 2 .
[0129] S4. In the input data quantization module, based on the principle of matrix multiplication and addition and the principle of analog-to-digital converter (DAC), the A and B split in the second step are multiplied and combined to form the final quantized data (A*s2, A*s, B*s, B). That is, each number in the user vector (input data) is quantized to (A*s 2 , A*s, B*s, B).
[0130] Example: y1 is quantized to (245,45,21,3)
[0131] S5. In the data quantization module to be deployed, based on the principle of matrix multiplication and addition of storage and calculation, the high and low bit data C and D split in step 3 are allocated and combined: that is, each number in the video base vector (data to be deployed) is quantized into (C, D, C, D).
[0132] Example: x 11 Quantized to (4,1,4,1)
[0133] S6. Perform data deployment in the data deployment module to be deployed: encode each number in the base vector into a resistance value based on the data quantized in step 5 (C, D, C, D) and deploy it into the storage and computing integrated chip.
[0134] S7. In the storage-computing integrated computing module, the multiplication and addition operations of the quantized input data and the quantized data to be deployed are completed. That is, the input data, that is, the user data (A*s2, A*s, B*s, B) is encoded as a voltage and input into the storage-computing integrated chip to be calculated with the deployed video base vector.
[0135] y i *x ij =(A*s2 ,A*s,B*s,B)*(C,D,C,D)=A*s 2 *C+A*s*D+B*s*C+B*D.
[0136] Example: (245, 45, 21, 3)*(4, 1, 4, 1) / 7 4 =0.46 is very close to the result calculated from the original data 0.771*0.594=0.458, and the accuracy is greatly improved.
[0137] For example, Figure 6 As shown, the quantized input data: [A 11 *s*s,A 11 *s,B 11 *s,B 11 A 12 *s*s,A 12 *s,B 12 *s,B 12 ] and the quantified data to be deployed: Perform calculations and output the results.
[0138] To sum up, this method decomposes the original data into high and low bits, and quantizes the high and low bits respectively, which not only retains the high-bit information of the data, but also retains the low-bit detailed information of the data, improves the accuracy of data quantization, and thus improves the calculation accuracy based on the storage and computing integrated chip.
[0139] In addition, it should be noted that, based on the vector dimensions of the input data and the data to be deployed and the chip array size, the number of integers used to represent the quantized data can be adaptively selected, which can ensure quantization accuracy while making better use of the chip's computing resources.
[0140] When the chip array is large and the vector dimension is small, the input data and the data to be deployed can be represented by 4-bit integers, that is, (A*s 2 , A*s, B*s, B) and (C, D, C, D) are used to quantize the input data and the data to be deployed respectively. If the array size is small or the vector dimension is large, you can use the quantized (A*s 2 , A*s,, B*s, B) and (C, D, C, D) respectively select several integers for quantization. For example, the input and data to be deployed are quantized into 3 integers respectively, that is, the input data is quantized into (A*s, A, B), and the data to be deployed is quantized into (C, D, C). For example, the input and data to be deployed are quantized into 2 integers respectively, that is, the input data is quantized into (A*s, A), and the data to be deployed is quantized into (C, D). Of course, as the number of integers selected after quantization decreases, the quantization accuracy will decrease slightly, but it is higher than the traditional quantization method.
[0141] S8. In the calculation result output module, the similarity between the user vector and the video vector is output, and videos with high similarity are recommended to the user.
[0142] The embodiment of the present application provides a quantization system, which can be used to implement Figure 3 A quantification method provided by the corresponding embodiment, referring to Figure 7 As shown, the quantization system 700 includes:
[0143] Quantization module 701, used to obtain a first vector and a second vector input by a first object; wherein each data in the first vector and the second vector is normalized to a first range;
[0144] The quantization module 701 is also used to extract high-order information and low-order information of each data;
[0145] The quantization module 701 is further used to obtain a third vector corresponding to the first vector and a fourth vector corresponding to the second vector based on the high-bit information of each data and the low-bit information of each data;
[0146] A calculation module 702, configured to perform a multiplication and addition operation on the third vector and the fourth vector to obtain a first result;
[0147] The output module 703 is used to output the first result.
[0148] In other embodiments of the present application, the quantization module 701 is used to obtain the calculation accuracy supported by the storage and computing integrated chip;
[0149] The quantization module 701 is used to extract high-bit information and low-bit information of each data based on calculation accuracy.
[0150] In other embodiments of the present application, the quantization module 701 is used to calculate the magnification corresponding to the first range based on the calculation accuracy;
[0151] A quantization module 701 is used to obtain high-bit information of each data based on the magnification factor;
[0152] The quantization module 701 is used to obtain low-bit information of each data based on the magnification and high-bit information.
[0153] In other embodiments of the present application, the quantization module 701 is used to obtain a third vector based on the magnification, the high-bit information of each data in the first vector, and the low-bit information of each data in the first vector;
[0154] The quantization module 701 is used to obtain a fourth vector based on the high-bit information of each data in the second vector and the low-bit information of each data in the second vector.
[0155] In other embodiments of the present application, the quantization module 701 is used to combine the magnification, the high-bit information of each data in the first vector, and the low-bit information of each data in the first vector to obtain quantized data corresponding to each data in the first vector;
[0156] A quantization module 701 is used to amplify the quantized data corresponding to each data in the first vector to obtain amplified data corresponding to each data in the first vector;
[0157] The quantization module 701 is used to replace each data in the first vector with the amplified data corresponding to each data in the first vector to obtain a third vector.
[0158] In other embodiments of the present application, the quantization module 701 is used to combine the high-bit information of each data in the second vector and the low-bit information of each data in the second vector to obtain a fourth vector.
[0159] In other embodiments of the present application, the calculation module 702 is used to encode each data in the fourth vector as a resistance value; and encode each data in the third vector as a voltage value.
[0160] In other embodiments of the present application, the number of bits of the quantized data corresponding to each data matches the first parameter; wherein the first parameter includes the processing chip array size and the dimension of the vector to be quantized; the vector to be quantized includes a first vector and a second vector.
[0161] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0162] It should be noted that in the embodiment of the present application, if the above-mentioned quantization method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a terminal device to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0163] Figure 8 800 is a schematic structural diagram of a communication device 800 provided in an embodiment of the present application. The communication device can be a storage and computing integrated chip, or an electronic device. Figure 8 The communication device 800 shown includes a first processor 810, and the first processor 810 can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0164] Alternatively, if Figure 8 As shown, the communication device 800 may further include a first memory 820. The first processor 810 may call and run a computer program from the first memory 820 to implement the method in the embodiment of the present application.
[0165] The first memory 820 may be a separate device independent of the first processor 810 , or may be integrated into the first processor 810 .
[0166] Alternatively, if Figure 8 As shown, the communication device 800 may further include a transceiver 830, and the first processor 810 may control the transceiver 830 to communicate with other devices, specifically, may send information or data to other devices, or receive information or data sent by other devices.
[0167] The transceiver 830 may include a transmitter and a receiver. The transceiver 830 may further include an antenna, and the number of the antennas may be one or more.
[0168] Optionally, the communication device 800 may specifically be a storage-computing integrated chip of an embodiment of the present application, and the communication device 800 may implement the corresponding processes implemented by the storage-computing integrated chip in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity.
[0169] Optionally, the communication device 800 may specifically be an electronic device of an embodiment of the present application, and the communication device 800 may implement corresponding processes implemented by electronic devices in various methods of the embodiments of the present application, which will not be described in detail here for the sake of brevity.
[0170] Fig. 9 It is a schematic structural diagram of the chip of an embodiment of the present application. Fig. 9 The chip 900 shown includes a second processor 910, which can call and run a computer program from a memory to implement the method in the embodiment of the present application.
[0171] Alternatively, if Fig. 9 As shown, the chip 900 may further include a second memory 920. The second processor 910 may call and run a computer program from the second memory 920 to implement the method in the embodiment of the present application.
[0172] The second memory 920 may be a separate device independent of the second processor 910 , or may be integrated into the second processor 910 .
[0173] Optionally, the chip 900 may further include an input interface 930. The second processor 910 may control the input interface 930 to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.
[0174] Optionally, the chip 900 may further include an output interface 940. The second processor 910 may control the output interface 940 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.
[0175] Optionally, the chip can be applied to the storage-computing integrated chip in the embodiments of the present application, and the chip can implement the corresponding processes implemented by the storage-computing integrated chip in each method of the embodiments of the present application. For the sake of brevity, they will not be repeated here.
[0176] Optionally, the chip can be applied to the electronic device in the embodiments of the present application, and the chip can implement the corresponding processes implemented by the electronic device in each method of the embodiments of the present application, which will not be described in detail here for the sake of brevity.
[0177] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0178] It should be understood that the processor of the embodiment of the present application may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by the hardware integrated logic circuit or software instructions in the processor. The above processor can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor are combined and performed. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, and other mature storage media in the art. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0179] As an embodiment, the processor may include one or more general-purpose central processing units (CPUs). Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer execution instructions).
[0180] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a ROM, a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM) or a flash memory. The volatile memory can be a random access memory (Random Access Memory, RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0181] It should be understood that the above-mentioned memory is exemplary but not restrictive. For example, the memory in the embodiments of the present application may also be static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is to say, the memory in the embodiments of the present application is intended to include but not limited to these and any other suitable types of memory.
[0182] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.
[0183] The computer-readable storage medium can be applied to the electronic device in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the electronic device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0184] The computer-readable storage medium can be applied to the storage-computing integrated chip in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the storage-computing integrated chip in the various methods of the embodiments of the present application. For the sake of brevity, they will not be repeated here.
[0185] The embodiment of the present application further provides a computer program product, including a computer program, which can be executed by a processor of the communication device 800 to complete the steps of any of the aforementioned methods.
[0186] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0187] The computer program product includes one or more computer instructions. When loading and executing the computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server, a data center, etc. that includes one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state hard disk (SSD)), etc.
[0188] The quantization method, quantization system, integrated storage and computing chip, electronic device, computer-readable storage medium and computer program product provided in the embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
[0189] It should be understood that the "one embodiment" or "an embodiment" or "an embodiment of the present application" or "the aforementioned embodiment" or "some implementations" or "some embodiments" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" or "an embodiment of the present application" or "the aforementioned embodiment" or "some implementations" or "some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0190] Unless otherwise specified, the quantization system / electronic device / storage-computing integrated chip performs any step in the embodiments of the present application, and the processor of the quantization system / electronic device / storage-computing integrated chip may perform the step. Unless otherwise specified, the embodiments of the present application do not limit the order in which the quantization system / electronic device / storage-computing integrated chip performs the following steps. In addition, the methods used to process data in different embodiments may be the same method or different methods.
[0191] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0192] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0193] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0194] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0195] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0196] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0197] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, magnetic disks or optical disks.
[0198] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0199] As used in the embodiments of the present application and the appended claims, the singular forms "a," "an," "said," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0200] It should be noted that in each embodiment involved in the present application, all steps may be executed or part of the steps may be executed as long as a complete technical solution can be formed.
[0201] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A quantization method, characterized in that: The method comprises: Obtain a first vector and a second vector input by a first object; wherein each data in the first vector and the second vector is normalized to a first range; Extracting high-order information and low-order information of each data; Based on the high-bit information of each data and the low-bit information of each data, a third vector corresponding to the first vector and a fourth vector corresponding to the second vector are obtained; A multiplication and addition operation is performed on the third vector and the fourth vector to obtain and output a first result.
2. The method according to claim 1, characterized in that The extracting high-order information and low-order information of each data includes: Get the calculation accuracy supported by the storage and computing integrated chip; Based on the calculation accuracy, high-order information and low-order information of each data are extracted.
3. The method according to claim 2, characterized in that The extracting high-order information and low-order information of each data based on the calculation accuracy includes: Based on the calculation accuracy, calculating the magnification corresponding to the first range; Based on the magnification factor, obtaining high-bit information of each data; Based on the magnification and the high-bit information, low-bit information of each data is obtained.
4. The method according to claim 3, characterized in that The obtaining, based on the high-bit information of each data and the low-bit information of each data, a third vector corresponding to the first vector and a fourth vector corresponding to the second vector includes: Obtaining the third vector based on the magnification, high-bit information of each data in the first vector, and low-bit information of each data in the first vector; The fourth vector is obtained based on the high-bit information of each data in the second vector and the low-bit information of each data in the second vector.
5. The method according to claim 4, characterized in that The obtaining the third vector based on the magnification, the high-bit information of each data in the first vector, and the low-bit information of each data in the first vector comprises: Combining the magnification, high-bit information of each data in the first vector, and low-bit information of each data in the first vector to obtain quantized data corresponding to each data in the first vector; Amplifying the quantized data corresponding to each data in the first vector to obtain amplified data corresponding to each data in the first vector; The amplified data corresponding to each data in the first vector is used to replace each data in the first vector to obtain the third vector.
6. The method according to claim 4, characterized in that The obtaining the fourth vector based on the high-bit information of each data in the second vector and the low-bit information of each data in the second vector comprises: The high-order information of each data in the second vector and the low-order information of each data in the second vector are combined to obtain the fourth vector.
7. The method according to claim 1, characterized in that The method further comprises: Encoding each data in the fourth vector as a resistance value; Each data in the third vector is encoded as a voltage value.
8. The method according to any one of claims 5 or 6, characterized in that The number of bits of the quantized data corresponding to each data matches the first parameter; wherein the first parameter includes the size of the processing chip array and the dimension of the vector to be quantized; the vector to be quantized includes a first vector and a second vector.
9. A quantization system, characterized in that: The quantization system comprises: A quantization module, configured to obtain a first vector and a second vector input by a first object; wherein each data in the first vector and the second vector is normalized to a first range; The quantization module is further used to extract high-bit information and low-bit information of each data; The quantization module is further used to obtain a third vector corresponding to the first vector and a fourth vector corresponding to the second vector based on high-bit information of each data and low-bit information of each data; A calculation module, used for performing a multiplication and addition operation on the third vector and the fourth vector to obtain a first result; An output module is used to output the first result.
10. A storage and computing integrated chip, characterized in that: The integrated storage and computing chip is used to implement the quantization method described in any one of claims 1 to 8.
11. An electronic device, characterized in that: The electronic device comprises: a storage-computing integrated chip; the storage-computing integrated chip comprises: Memory for storing computer programs; A processor is used to call and run the computer program from the memory, so that an electronic device equipped with the integrated storage and computing chip executes the quantization method described in any one of claims 1 to 8.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the quantization method according to any one of claims 1 to 8.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the quantization method according to any one of claims 1 to 8.
