NEURAL NETWORK PROCESSING WITH QUANTIZATION
A method for neural network processing with quantization. The method includes (i) receiving input signals by a neural network that is configured to approximate a reference neural network, wherein the neural network includes multiple layers, and (ii) processing the input signals by the multiple layers to provide neural network output signals. The processing includes performing power of two quantization operations. Weights of the multiple layers are determined based in part on one or more scale factors. The one or more scale factors are determined based on metadata related to one or more weight scales, one or more input scales descriptor values, and one or more output scales of the reference neural network, wherein the reference neural network includes more computational resources than the neural network.
Latest MOBILEYE VISION TECHNOLOGIES LTD. Patents:
This application claims the benefit of priority of U.S. Provisional Patent Application No. 63/430,207, filed on Dec. 5, 2022, the contents of which are incorporated herein in their entirety.
BACKGROUNDThe popularity of neural networks has dramatically increased during the last decade. A typical neural network includes multiple layers such as an input layer, one or more hidden layers, and an output layer. Each layer of the multiple layers includes multiple neurons. Each layer may receive multiple layer input descriptors, each layer input descriptor includes content from one or more layer input channels that may be arranged in one or more layer input descriptor segments-one layer input descriptor segment per channel. Each layer may process the multiple layer input descriptors to provide multiple layer output descriptors, each layer output descriptor includes content from one or more layer output channels that may be arranged in one or more layer output descriptor segments—one layer output descriptor segment per channel.
A neuron of the neural network includes multiple input multipliers that are configured to receive multiple input values, multiply them by corresponding neuron weights to provide multiple products. The multiple products are added, by an accumulator, to provide a sum. A neural activation function is applied on the sum to provide a neuron output.
The implementation of such neurons, especially in large neural networks, consumes a lot of computational resources.
There is a growing need to reduce the amount of computational resources required to implement neural network operations, especially in vast neural networks.
SUMMARYThere may be provided a system, method, and computer readable medium for neural network processing with quantization.
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure.
However, it will be understood by those skilled in the art that the present embodiments of the disclosure may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the present embodiments of the disclosure.
The subject matter regarded as the embodiments of the disclosure is particularly pointed out and distinctly claimed in the concluding portion of the specification. The embodiments of the disclosure, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings.
It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.
Because the illustrated embodiments of the disclosure may for the most part be implemented using electronic components and circuits known to those skilled in the art, details will not be explained in any greater extent than that considered necessary as illustrated above, for the understanding and appreciation of the underlying concepts of the present embodiments of the disclosure and in order not to obfuscate or distract from the teachings of the present embodiments of the disclosure.
Any reference in the specification to a method should be applied mutatis mutandis to a system capable of executing the method and should be applied mutatis mutandis to a computer readable medium that is non-transitory and stores instructions for executing the method.
Any reference in the specification to a system should be applied mutatis mutandis to a method that may be executed by the system and should be applied mutatis mutandis to a computer readable medium that is non-transitory and stores instructions executable by the system.
Any reference in the specification to a computer readable medium that is non-transitory should be applied mutatis mutandis to a method that may be applied when executing instructions stored in the computer readable medium and should be applied mutatis mutandis to a system configured to execute the instructions stored in the computer readable medium.
The term “and/or” means additionally or alternatively.
Any reference to mimic should be applied mutatis mutandis to approximate. Both terms may mean that a neural network that approximates a reference neural network is expected to perform substantially the same neural network processing.
The phrase “substantially equal” may mean equal or differ up to an allowable deviation. The allowable deviation may be set to be a certain percentage of a value, for example, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30 percent, and the like. Alternatively, the allowable deviation from the exact value may be determined based on a desired accuracy of a process (for example, neural network processing) applied by a neural network or a layer of the neural network when applying values that are substantially equal to a desired value. The desired accuracy may be defined in any manner—for example in advance, by a user of the neural network processing, by a neural network architect or programmer, and the like. The desired accuracy may be, for example, an accuracy of 85, 90, 95, 98, or 99 percent. There may be an allowable tradeoff between computation resources required to execute the neural network processing and the accuracy of the neural network processing. The tradeoff may be defined in any manner, for example, in advance by a user of the neural network processing, by a neural network architect or programmer, and the like.
The following text may refer to different examples of number formats such as floating point and fixed point and to different examples of number lengths, for example, 32 bit, 16 bit, and 8 bit. These are merely non-limiting example of lengths and/or formats.
A quantization factor (or compression factor) is a relationship of a size (a number of bits) of a value before the quantization and the size of the value after the quantization.
An input scale (related to a layer) may be provided per layer input descriptor or per two or more layer input descriptor segments—one segment per channel.
An output scale (related to a layer) may be provided per layer output descriptor or per two or more layer output descriptor segments—one segment per channel.
A weight scale (related to a layer) may be provided per layer or per combination of layer and channel.
A scale factor (or a layer of or a combination of channel and layer) may be a function of one or more scales, such as a function of an input scale, an output scale, and the weight scale.
The following text may also refer to different examples of quantization factors, for example, from 32 bit to 8 bit. These are merely non-limiting examples of quantization factors.
There is provided a method, a system, and a non-transitory computer readable medium for performing neural network processing with quantization.
The suggested neural network performs quantization operations using a shifter to provide power of two quantization operations. For simplicity of explanation, a neural network that executes such a quantization is referred to as a shift based quantization (SQ) neural network.
A neuron may have many inputs that are multiplied by neuron weights to provide multiple products to be added to each other by an accumulator which outputs a relatively lengthy sum. The sum is quantized in order to save computational resources, for example, by limiting the size (and hence the reduce the computational resources) required to process the layer output descriptors.
Instead of using a long floating point multiplier (for example, a 32 bit floating point multiplier) to perform the quantization, the SQ neural network performs quantization using a simpler and smaller power-of-two quantization unit that is limited to perform only power of two mathematical operations using shift operations. A shift left operation increases a binary value by a power of two factor. A shift right operation decreases a binary value by a power of two factor.
Using the power-of-two quantization unit instead of using the floating point multiplier based quantization unit may decrease the accuracy of the SQ neural network processing. In order to improve the accuracy and compensate (at least in part) for possible reduction of accuracy, the SQ neural network has its weights amended based on scale factors so that the neurons output power of two values. The weights may be amended by approximation factors that are based on the scale factors.
The scale factors may be calculated per layer of the neural network. Alternatively, the scale factors are calculated per a combination of layer and channel. It should be noted that the scale factors may be applied per combination of a layer and some of the channels of the layer. For example, if a certain layer output descriptor has eight segments (for eight channels), then the scale factors may be calculated per the entire layer, per each channel of the eight channels, or per two or more sub-sets of channels. For example, per sub-sets of two channels, per sub-sets of four channels, and the like. The number of channels per different sub-sets of channels of a layer may differ from each other. For simplicity of explanation, any reference to a scale factor of an entire layer may be applied mutatis mutandis to a scale factor of each channel per layer and/or to a scale factor of each channel per sub-set of channels.
The scale factors are a function of weight scales, input scales, and output scales of two or more layers of a reference neural network. For example, one or more scale factors related to a certain layer of the SQ neural network may be a function of the weight scales, input scales, and output scales of a corresponding reference layer of the reference neural network.
For example, assuming that layer input scale is denoted Sx, the output scale is denoted Sy, and weight scale is denoted Sw. An example of a scale factor (SF) is
Other functions may be applied to determine the scale factor.
The suggested method does not force all of the input scales, the output scales, and the weight scales to be substantially equal to a power of two. This increases the accuracy of the SQ neural network.
It should be noted that a scale factor (and/or each scale of the weight scale, input scale, and output scale) may be a scalar or may have a higher dimension, for example, may be a vector. If the scale factor is not a scalar, then values of elements of the scale factor should be substantially equal to a power of two.
The weights of the SQ neural network are amended based (at least in part) on metadata gained from monitoring a reference neural network and especially based on the scale factors of the reference neural network. The SQ neural network may mimic the reference neural network, but the reference neural network has more computational resources. The reference neural network may, for example, perform neural network processing without quantizing or have a quantization unit that includes a floating point multiplier.
The metadata may be gained during a monitoring process of the reference neural network. There may be more than a single monitoring process, but for simplicity of explanation a single monitoring process is referred to herein.
The monitoring process may take place after the training process of the reference neural network. The monitoring process may take place during the training process of the reference neural network.
One part of the monitoring process may take place during at least a part of the training process of the reference neural network while another part of the monitoring process may take place after the training process.
Applying the monitoring during the training process may obtain more weights values as the weights (and the weight scales) may change during the training process. While after the end of the training process of the reference neural network, the weights (and the weight scales) are fixed.
The metadata may be gained during multiple iterations of the training process. In this case, after an iteration, the weights of the reference neural network may be updated based at least on the scale factor of the current iteration as it may also be based on the training process itself, for example, on a loss function.
For two or more layers of multiple layers of the reference neural network, the metadata may include extremum values (i.e., maximum or minimum values) of layer input descriptors, layer output descriptors, and layer weights. The extremum value may be represented by scales. The scales may be calculated based on the extremum values. The metadata may include the scales and/or the extremum values.
Alternatively, for two or more layers of multiple layers of the reference neural network and for each channel of two or more channels per layer, the metadata may include extremum values of layer input descriptors, layer output descriptors, and layer weights. Additionally or alternatively, the metadata may include extremum values.
As indicated above, the metadata can be learned per layer. Scales metadata related to a certain layer may include metadata about layer input values inputted to the layer, layer weights (weights of neurons of the layer), and about layer output values outputted from the layer.
As indicated above, the metadata can be learned per combination of layer and channel. For example, an input layer may receive triple-channel pixels having red, green, and blue channels and the metadata may be calculated per input layer red channel, per input layer green channel, and per input layer blue channel.
The metadata may be indicative of the distribution of the monitored values (Sx, SY, and Sw). The metadata may refer to the range of values, especially the extremum values—the minimum value and the maximum value. The minimum value of the FP32 range is mapped to the minimum value of the int8 range (−128 for signed integers) and the maximum value of the FP32 range is mapped to the maximum value of the int8 range (127).
The FP32 range is mapped to the int8 range such that the minimum value of a tensor in the FP32 domain is mapped to the minimum value of int8 domain (−128 for signed integers) and the same for the maximum value (which is mapped to 127).
The extremum values may take into account all the values obtained during the training (or during the training iteration) or may also take into account the frequency of occurrence of the values.
For example, the metadata may ignore values that may be deemed insignificant as they do not appear frequently enough (for example, have an occurrence frequency that is lower than an occurrence frequency threshold).
For example, a value may be deemed insignificant based on occurrence frequency and difference from the next or closest value. A value may be deemed insignificant using any other rule—for example, any rule that can be used for detecting an outlier. For example, the value may be deemed insignificant using clustering.
Step 110 of method 100 includes feeding a group of images to a reference neural network. The group of images may be any type of input images. Alternatively, the group of images may represent typical and/or expected images to be fed to the SQ neural network during the operation of the SQ neural network. For example, if the SQ neural network is used for driving purposes or for driving related tasks, then the group of images may be acquired by one or more vehicle image sensors during driving.
Step 110 may be followed by step 120 of processing the group of images by the reference neural network to provide reference neural network outputs.
If step 120 is executed during a training process of the reference neural network, then step 120 may also include amending (if necessary) one or more weights of the reference neural network.
Step 120 may be followed by step 130 of obtaining, for one or more layers (or for one or more channels of one or more layers) of the reference neural network, metadata regarding input scales (Sx), output scales (Sy), and weights scales (SW). The scales may be obtained per layer, per a combination of layer and channel, or per block. In this respect, a “block” may include a group of values under an ordering or memory layout of one of the tensors (e.g., input, weights, or output). For example, a block may be composed of 32 successive elements, where each tensor may include many such non-overlapping groups. The quantization may then be applied to each group independently. Sx, Sy, and SW may be vectors.
Step 130 may be followed by step 140 of calculating the scale factor per layer or per a combination of layer and channel.
The scale factor (SF) may equal
Other functions may be used to determine the scale factor.
The scale factor may be calculated for one, some, or all of the layers of the reference neural network.
Step 111 of method 101 includes starting a training iteration by feeding a sub-group of images to the reference neural network.
Step 111 may be followed by step 121 of processing the sub-group of images by the reference neural network to provide reference neural network outputs.
Step 121 also includes amending (if necessary) one or more weights of the reference neural network. This is a normal aspect of training the reference neural network.
Step 121 is followed by step 131 of obtaining, for one or more layers (or for one or more channels of one or more layers) of the reference neural network, metadata regarding one or more input scales (Sx), one or more output scales (Sy), and one or more weight scales (SW). Per layer or per a combination of layer and channel Sx, Sy, and SW may be vectors.
Step 131 may be followed by step 141 of calculating the scale factor per layer or per a combination of layer and channel.
The scale factor (SF) may equal
The scale factor may be calculated for one, some, or all of the layers of the reference neural network.
Step 141 may be followed by step 151 of adjusting the weights of the reference neural network based on the scale factors.
For example, assuming that the scale factor of a certain layer is denoted SFL, then weights of neurons of a certain layer are multiplied by an approximation factor (AFL) that equals SFL divided by 2 by a power of (log base 2 of SFL).
Step 151 may be followed by jumping to step 111 and performing another training iteration until reaching a stop condition and then ending method 101. The stop condition may include processing the entire group of images allocated to the training.
Initialization step 305 of method 300 may include obtaining one or more scale factors.
The obtaining may include receiving the one or more scale factors and/or generating the one or more scale factors.
Step 305 may include performing a monitoring process (for example, either one of method 100 or method 101) or receiving the outcome of the monitoring process.
Method 300 may also include step 310 of receiving input signals (for example, input images) by a neural network (referred to as an SQ neural network) that is configured to approximate a reference neural network. The SQ neural network includes multiple layers.
Step 310 may be followed by step 320 of processing the input signals by the multiple layers to provide SQ neural network output signals.
Step 320 may include performing power of two quantization operations.
Weights of the multiple layers of the SQ neural network are determined based in part on one or more scale factors.
The one or more scale factors are determined based on metadata related to one or more weight scales, one or more input scales, and one or more output scales of a reference neural network.
The reference neural network has more computational resources (for example, by a factor of at least 1.2, 1.3, 1.4, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, or more) than the SQ neural network.
The reference neural network and the SQ neural network may have the same number of layers and the same connectivity between the layers. The SQ neural network may be designed to output substantially the same outputs as the reference neural network and may be regarded as mimicking or approximating the reference neural network.
For example, the reference neural network may have a quantization unit that is a floating point multiplier that is fed by floating point values.
As another example, the reference neural network may apply less quantization operations than the neural network.
Less quantization may mean, for example, that the reference neural network does not apply quantization; that the reference neural network does not perform number format conversions, for example, does not convert floating point values to integers; or that the reference neural network uses lower compression ratios.
The one or more scale factors may be determined per layer of the multiple layers.
The one or more scale factors may be determined per a combination of layer and channel of the multiple layers.
The one or more scale factors may be determined per a combination of a layer and a sub-group of channels of the multiple layers.
The one or more scale factors of a layer may be determined based on an approximation ratio, which is a ratio between a scale factor of the layer and a power of two approximation of the scale factor of the layer.
The scale factor of the layer may be a ratio between (i) Sy and (ii) a product of Sx multiplied by Sw. The scale factor may be forced to be equal to a power of two value while Sy, Sx, and Sw are not forced to be equal to a power of two value. The one or more scale factors may be learned after a completion of a training of the reference neural network. The one or more scale factors may be learned during a training process of the reference neural network. The term “forced” refers to imposing a limitation of a value during the training process. The value may be forced in various manners, for example, by applying a loss function that causes the values to equal a power of two, or by any other method applicable to the training of a neural network.
The connectivity between adjacent layers is not shown for simplicity of explanation. The SQ neural network may be a fully connected neural network, a partially connected neural network, a convolution neural network, and the like.
Neuron 401 is configured to receive a first number (N1) of input values 411(1)-411(N1) and N1 neuron weights 412(1)-412(N1). The neuron has N1 8 bit multipliers 402(1)-402(N1), wherein the n1′th multiplier is configured to multiply the n1′th input value 411(n1) by the corresponding n1′th neuron weight 412(n1) to provide N1 products 413(1)-413(N1). Variable n1 ranges between 1 and N1.
The N1 products are summed by an accumulator 403 (for example, a floating point 32 bit accumulator) to provide an accumulator output 414 that is quantized by shift-based quantization unit 404 to provide a neuron output 415 that is quantized. The shift-based quantization unit includes a shift register 405 that is configured to receive the accumulator output 414 and quantize it by performing shift operations which amount to a power of two quantization operations. Shift right means shifting the accumulator output by a quantization scale value to provide the neuron output. A shift by G bits to the right provides a quantization of 2G.
In
The neuron may belong to a certain layer of the SQ neural network.
Assuming that the one or more scale factors are applied per layer, then the N1 neuron weights 412(1)-412(N1) were amended based on the scale factor of that layer.
Assuming that the one or more scale factors are applied per layer and per channel, then the N1 neuron weights 412(1)-412(N1) were amended based on the scale factor of that layer and per channel, as each input value includes content of multiple channels.
The neuron 401 may be implemented in hardware and may be a part of a neural network processor such as a neural network hardware accelerator.
Reference neural network 400′ includes M (positive integer) reference layers 400′(1)-400′(M-1). For simplicity of explanation,
The first reference layer includes J1 neurons 400′(1,1)-400′(1,J1). The second reference layer includes J1 neurons 400′(2,1)-400′(2,J2). The penultimate reference layer includes J(M-1) neurons 400′(M-1,1)-400′(M-1,J(M-1)). The last reference layer includes JM neurons 400′(M,1)-400′(M,JM). JM is the number of neurons of the J′th layer. J (M-1) is the number of neurons of the (M-1)′ th layer.
The first reference layer 400′(1) is fed by first reference layer input values X(1) and outputs first reference layer output values Y(1). The second reference layer 400′(2) is fed by second reference layer input values X(2) and outputs second reference layer output values Y(2). The penultimate reference layer 400′(1) is fed by penultimate reference layer input values X(M-1) and outputs penultimate reference layer output values Y(M-1). The last reference layer 400′(M) is fed by last reference layer input values X(M) and outputs last reference layer output values Y(M).
These values are used to determine the one or more scale factors that may be used for amending the weights of the SQ neural network 400.
SQ neural network 400 includes M (positive integer) SQ layers 400(1)-400(M-1). For simplicity of explanation,
The first SQ layer includes J1 neurons 400 (1,1)-400(1,J1). The second SQ layer includes J1 neurons 400 (2,1)-400(2,J2). The penultimate SQ layer includes J(M-1) neurons 400 (M-1,1)-400(M-1,J(M-1)). The last SQ layer includes JM neurons 400 (M,1)-400(M,JM).
Assuming that the one or more scale factors are applied per layer and per channel,
The number of layer input descriptors of a layer may differ from a number of layer output descriptors of the layer. The number of layer input channels of a layer input descriptor may differ from the number of layer output channels of a layer output descriptor. The number of layer input descriptors of one layer may differ from the number of layer input descriptors of another layer. The number of layer output descriptors of one layer may differ from the number of layer output descriptors of another layer.
The approximation factors are not shown in
The SQ neural network may be implemented by one or more processing circuits. A processing circuit may be implemented as a central processing unit (CPU), and/or one or more other integrated circuits such as application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), full-custom integrated circuits, etc., or a combination of such integrated circuits. The reference neural network may be implemented by more processing circuits, for example, the reference neural network may be implemented by a group of servers.
Systems 500 may include one or more sensors 507 or may be fed by information by one or more sensors. The information (for example input images or other input sensed information) may be processed by the one or more processing circuits. The reference neural network system 520 is configured to perform reference neural network processing operations. The reference neural network system 520 may execute the monitoring process and/or the training of the reference neural network. The reference neural network system 520 includes more computation resources than system 500.
The neural network processor 501 may include one or more processing circuits that are configured to implement a neural network that is configured to approximate a reference neural network by: receiving input signals and processing the input signals by multiple layers of the neural network to provide neural network output signals. The processing may include performing power of two quantization operations. The weights of the multiple layers are determined based in part on one or more scale factors. The one or more scale factors are determined based on metadata related to one or more weight scales, one or more input scales, and one or more output scales of the reference neural network. The reference neural network may include more computational resources than the neural network.
System 500 or neural network processor 501 may be configured to execute method 300.
Under the limitations of the “lean” (and therefore cheaper) hardware (i.e., using a shifter instead of using a floating-point multiplier), the systems and methods described herein may allow a neural network to be quantized in a more precise way, such that the predictions may be more accurate. The input domain may be not limited and can span images, audio, text, etc.
A numerical example follows to provide an example of the systems and methods in operation. For purposes of this example, assume that it is needed to force the hardware scale
of a specific layer, which consists of three different and independent values, to be a power of 2. For example, Sx is 3.5, Sy is 5.2, and Sw is 7.3. The product as defined above is 5.2/(3.5×7.3)=0.203, which is not a power of 2 number.
The closest power-of-2 value is searched for by calculating 2└log
The original weight scale factor Sw=7.3 is scaled by the correction factor (0.203)/0.25=0.812 to have a new weight scale of Sw=7.3×0.812=5.9276.
Applying the new scale factor into the hardware scale results in: 5.2/(3.5×5.9276)=0.25, which is a power of 2 as required.
Moreover, the terms “front,” “back,” “top,” “bottom,” “over,” “under,” and the like in the description and in the claims, if any, are used for descriptive purposes and not necessarily for describing permanent relative positions. It is understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are, for example, capable of operation in other orientations than those illustrated or otherwise described herein.
The connections as discussed herein may be any type of connection suitable to transfer signals from or to the respective nodes, units, or devices, for example via intermediate devices. Accordingly, unless implied or stated otherwise, the connections may for example be direct connections or indirect connections. The connections may be illustrated or described in reference to a single connection, a plurality of connections, unidirectional connections, or bidirectional connections. However, different embodiments may vary the implementation of the connections. For example, separate unidirectional connections may be used rather than bidirectional connections and vice versa. Also, a plurality of connections may be replaced with a single connection that transfers multiple signals serially or in a time multiplexed manner. Likewise, single connections carrying multiple signals may be separated out into various different connections carrying subsets of these signals. Therefore, many options exist for transferring signals.
Any arrangement of components to achieve the same functionality is effectively “associated” such that the desired functionality is achieved. Hence, any two components herein combined to achieve a particular functionality may be seen as “associated with” each other such that the desired functionality is achieved, irrespective of architectures or intermedial components. Likewise, any two components so associated can also be viewed as being “operably connected” or “operably coupled” to each other to achieve the desired functionality.
Furthermore, those skilled in the art will recognize that boundaries between the above-described operations are merely illustrative. The multiple operations may be combined into a single operation, a single operation may be distributed in additional operations, and operations may be executed at least partially overlapping in time. Moreover, alternative embodiments may include multiple instances of a particular operation, and the order of operations may be altered in various other embodiments.
Also, for example, in one embodiment, the illustrated examples may be implemented as circuitry located on a single integrated circuit or within a same device. Alternatively, the examples may be implemented as any number of separate integrated circuits or separate devices interconnected with each other in a suitable manner.
However, other modifications, variations, and alternatives are also possible. The specifications and drawings are, accordingly, to be regarded in an illustrative rather than in a restrictive sense.
In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word “comprising” does not exclude the presence of other elements or steps than those listed in a claim. Furthermore, the terms “a” or “an,” as used herein, are defined as one or more than one. Also, the use of introductory phrases such as “at least one” and “one or more” in the claims should not be construed to imply that the introduction of another claim element by the indefinite articles “a” or “an” limits any particular claim containing such introduced claim element to embodiments of the disclosure as containing only one such element, even when the same claim includes the introductory phrases “one or more” or “at least one” and indefinite articles such as “a” or “an.” The same holds true for the use of definite articles. Unless stated otherwise, terms such as “first” and “second” are used to arbitrarily distinguish between the elements such terms describe. Thus, these terms are not necessarily intended to indicate temporal or other prioritization of such elements. The mere fact that certain measures are recited in mutually different claims does not indicate that a combination of these measures cannot be used to advantage.
While certain features of the embodiments of the disclosure have been illustrated and described herein, many modifications, substitutions, changes, and equivalents will now occur to those of ordinary skill in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the scope of the embodiments of the disclosure.
Claims
1. A method for neural network processing with quantization, the method comprising:
- receiving input signals by a neural network that is configured to approximate a reference neural network, wherein the neural network comprises multiple layers;
- processing the input signals by the multiple layers to provide neural network output signals, wherein the processing comprises performing shift-based quantization operations; and
- wherein weights of the multiple layers are determined based in part on one or more scale factors, wherein the one or more scale factors are determined based on metadata related to (i) one or more weight scales, (ii) one or more input scales descriptor values, and (iii) one or more output scales of the reference neural network, wherein the reference neural network comprises more computational resources than the neural network.
2. The method according to claim 1, wherein the one or more scale factors are determined per layer of the multiple layers.
3. The method according to claim 1, wherein the one or more scale factors are determined per a combination of layer and channel of the multiple layers.
4. The method according to claim 1, wherein a scale factor of one or more scale factors of a layer is determined based on a ratio between a scale factor of the layer and a power of two approximation of the scale factor of the layer.
5. The method according to claim 4, wherein the scale factor of one or more scale factors of the layer is a ratio between one or more output scales related to the layer (Sy) and a product of one or more input scales related to the layer (Sx) multiplied by one or more weight scales of the layer (Sw).
6. The method according to claim 5, wherein the scale factor of one or more scale factors is forced to be equal to a power of two value, while Sy, Sx, and Sw are not forced to be equal to a power of two value.
7.-12. (canceled)
13. A non-transitory computer readable medium for neural network processing with quantization, the non-transitory computer readable medium storing instructions that once executed by one or more processing circuits causes the one or more processing circuits to:
- implement a neural network that is configured to approximate a reference neural network by:
- receiving input signals;
- processing the input signals by multiple layers of the neural network to provide neural network output signals, wherein the processing comprises performing shift-based quantization operations; and
- wherein weights of the multiple layers are determined based in part on one or more scale factors, wherein the one or more scale factors are determined based on metadata related to (i) one or more weight scales, (ii) one or more input scales descriptor values, and (iii) one or more output scales of the reference neural network, wherein the reference neural network comprises more computational resources than the neural network.
14. The non-transitory computer readable medium according to claim 13, wherein the one or more scale factors are determined per layer of the multiple layers.
15. (canceled)
16. The non-transitory computer readable medium according to claim 13, wherein a scale factor of one or more scale factors is determined based on a ratio between a scale factor of the layer and a power of two approximation of the scale factor of the layer.
17.-21. (canceled)
22. A neural network processor that comprises one or more processing circuits, wherein the one or more processing circuits are configured to implement a neural network that is configured to approximate a reference neural network by:
- receiving input signals;
- processing the input signals by multiple layers of the neural network to provide neural network output signals, wherein the processing comprises performing shift-based quantization operations; and
- wherein weights of the multiple layers are determined based in part on one or more scale factors, wherein the one or more scale factors are determined based on metadata related to (i) one or more weight scales, (ii) one or more input scales descriptor values, and (iii) one or more output scales of the reference neural network, wherein the reference neural network comprises more computational resources than the neural network.
23.-25. (canceled)
26. The neural network processor according to claim 22, wherein a scale factor of one or more scale factors of the layer is a ratio between one or more output scales related to the layer (Sy) and a product of one or more input scales related to the layer (Sx) multiplied by one or more weight scales of the layer (Sw).
27.-32. (canceled)
33. The method according to claim 1, wherein the quantization operations are power of two quantization operations.
34. The method according to claim 1, wherein the quantization operations are based on a quantization scale value.
35. (canceled)
36. The method according to claim 1, wherein the reference neural network does not apply quantization operations.
37. The method according to claim 1, wherein the reference neural network applies floating point operations without conversion to integers.
38. The method according to claim 1, wherein the reference neural network applies less quantization than the neural network.
39. (canceled)
40. (canceled)
41. The non-transitory computer readable medium according to claim 13, wherein the quantization operations are power of two quantization operations.
42.-44. (canceled)
45. The non-transitory computer readable medium according to claim 13, wherein the reference neural network applies floating point operations without conversion to integers.
46.-48. (canceled)
49. The neural network processor according to claim 22, wherein the quantization operations are power of two quantization operations.
50.-52. (canceled)
53. The neural network processor according to claim 22, wherein the reference neural network applies floating point operations without conversion to integers.
54. (canceled)
Type: Application
Filed: Dec 4, 2023
Publication Date: Nov 26, 2026
Applicant: MOBILEYE VISION TECHNOLOGIES LTD. (Jerusalem)
Inventors: Amit WEIZNER (Kiryat Motzkin), Mattan WINAVER (Ramat Ishay)
Application Number: 19/134,455