Implementation and method for processing neural network in semiconductor hardware

NN2.0 processors address the inefficiencies of MACs by using shifters to process neural networks, achieving faster and more power-efficient operations on edge devices.

JP2024119963AInactive Publication Date: 2024-09-03UNIQUIFY INC
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
JP2024095760
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-05-05
Filing Date
2024-06-13
Publication Date
2024-09-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The complexity of multiplication operations in MACs leads to high power consumption and large footprints, making them unsuitable for efficient neural network processing on edge devices, especially due to the large amount of input data and parameters involved.

Method used

Implementing second generation neural network processors (NN2.0) that utilize shifter functionality instead of multipliers and adders, replacing multiplication and addition operations with shift operations using log-quantized parameters, thereby reducing hardware footprint and power consumption.

Benefits of technology

NN2.0 processors achieve faster speeds with reduced power consumption and smaller physical footprint, enabling efficient neural network operations on edge devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024119963000001
    Figure 2024119963000001
Patent Text Reader

Abstract

To provide a system, method, computer instruction and artificial intelligence processing element (AIPE).SOLUTION: AIPE for executing convolution operations executes: capturing shiftable input derived from input data of neural network operation; capturing a shift instruction derived from a corresponding logarithmically quantized parameter or constant value of the neural network; and shifting the shiftable input to a left or right direction according to the shift instruction to form shifted output representing multiplication of the input data with the corresponding logarithmically quantized parameter of the neural network.SELECTED DRAWING: Figure 78
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002]

[0001] This application claims the benefit of and priority to U.S. Provisional Patent Application No. 63 / 184,576, filed May 5, 2021, and entitled "Systems and Methods Involving Artificial Intelligence and Cloud Technology for Edge and Server SOC," and U.S. Provisional Patent Application No. 63 / 184,630, filed May 5, 2021, and entitled "Systems and Methods Involving Artificial Intelligence and Cloud Technology for Edge and Server SOC," the disclosures of which are expressly incorporated by reference in their entireties into this specification.

[0003]

[0002] This disclosure is directed generally to artificial intelligence systems, and more particularly to neural networks and artificial intelligence (AI) processing in hardware and software. Related Technology

[0004]

[0003] A neural network is a network or circuit of artificial neurons represented by multiple neural network layers, each of which is instantiated by a set of parameters. A neural network layer is represented by two types of neural network parameters. One type of neural network parameter is a weight that is multiplied with data depending on the underlying neural network operation (e.g., in the case of convolution, batch normalization, etc.). The other type of neural network parameter is a bias, which is a value that can be added to the data or to the result of the multiplication of the weight with the data.

[0005]

[0004] The neural network layers of a neural network start with an input layer where data is fed, followed by a hidden layer, and then an output layer. The layers are made up of artificial neurons, also called kernels or filters in the case of convolutional layers. Examples of different types of layers that make up a neural network can include, but are not limited to, convolutional layers, fully connected layers, recurrent layers, activation layers, batch normalization layers, etc.

[0006]

[0005] Training or learning a neural network is a process of changing or improving the values ​​of parameters in a neural network according to a set of objectives, usually represented by labels of input data, and a set of input data known as test data. Training, learning, or optimization of a neural network involves optimizing the values ​​of parameters in a neural network for a particular set of objectives by mathematical or non-mathematical methods, such as gradient-based optimization. At each iteration (called an epoch) of training / learning / optimization, an optimizer (e.g., a software program, dedicated hardware, or a combination of these) finds the optimized values ​​of the parameters to produce the smallest error based on the set objectives or labels. In the case of neural network inference, after the neural network is trained, learned, or optimized using test data and labels, any data can be applied / fed to the trained neural network to obtain output values, which can then be interpreted according to the rules set for the neural network. Examples of neural network training, neural network inference, and corresponding hardware implementations in the related art are as follows:

[0007]

[0006] FIG. 1 shows an example of training a neural network according to the related art. In the related art, to facilitate training of the neural network, first, the neural network parameters are initialized to random floating-point or integer numbers. Then, an iterative process for training the neural network is started as follows: Test data is input to the neural network and propagated forward through all layers to obtain output values. Such test data can be in the form of floating-point or integer numbers. An error is calculated by comparing the output values ​​with the values ​​of the test labels. Then, as known in the prior art, a method is performed to determine how to change the parameters to reduce the error of the neural network, and the parameters are then changed according to the performed method. This iterative process is repeated until the neural network produces an acceptable error (e.g., within a threshold), and the resulting neural network is said to be trained, learned, or optimized.

[0008]

[0007] Figure 2 shows an example of neural network inference operation according to the related art. To facilitate neural network inference, first, inference data is input to the neural network and propagated forward through all layers to obtain output values. Then, the output values ​​of the neural network are interpreted according to the objectives set by the neural network.

[0009]

[0008] Figure 3 shows an example of a hardware implementation of a neural network according to the related art. To implement a neural network in hardware, first, the input data and the neural network parameters are obtained. Then, by using a hardware multiplier, the input data (multiplicand) is multiplied with the parameters (multiplier) to obtain the products. After that, by using a hardware adder, all these products are added to obtain a sum value. Finally, if applicable, a hardware adder is used to add a bias parameter to the sum value as needed.

[0010]

[0009] FIG. 4 shows an example of training a quantized neural network according to the related art. To facilitate training of a quantized neural network, first, the neural network parameters (e.g., weights, biases) of the neural network are initialized to random floating-point or integer numbers. Then, an iterative process is performed in which test data is input to the neural network and propagated forward through all layers of the neural network to obtain output values. An error is calculated by comparing the output values ​​with the values ​​of the test labels. As known in the prior art, a method is used to determine how to change the parameters to reduce the error of the neural network, and the parameters are changed accordingly. This iterative process is repeated until the neural network produces an acceptable error within a desired threshold. After such an error is produced, the parameters are quantized to reduce the size of the parameters (e.g., quantizing 32-bit floating-point numbers to 8-bit integers).

[0011]

[0010] Figure 5 shows an example of neural network inference for a quantized neural network in accordance with the related art. The inference process is the same as that of the standard neural network in Figure 2, except that the neural network parameters are quantized to integers.

[0012]

[0011] Figure 6 shows an example of a hardware implementation of a neural network in the case of a quantized neural network according to the related art. This hardware implementation is the same as the hardware implementation of the standard neural network shown in Figure 3. In this case, the hardware multipliers and adders used in the quantized neural network are usually in the form of integer multipliers and integer adders, as opposed to the floating-point adders / multipliers of Figure 3, due to the integer quantization of the parameters.

[0013]

[0012] To facilitate the calculations required for neural network operations, multiplier-accumulator circuits (MACs) or MAC equivalents (multipliers and adders) are typically used to perform the multiplication and addition operations of neural network operations. All AI processing hardware in the related art fundamentally relies on MACs or MAC equivalents to perform the calculations for most neural network operations. Summary of the Invention

[0014]

[0013] Due to the complexity of the multiplication operations, MACs consume large amounts of power, occupy a significant footprint, and take a long time to compute when used in arrays to process neural networks and other artificial intelligence operations. Because the amount of input data and neural network parameters can be enormous, large (e.g., tens of thousands) arrays of MACs may be utilized to process neural network operations. Because complex neural network operations may require large MAC arrays that need to process the neural network in a timely manner, such requirements may make it difficult to use algorithms based on neural networks in edge devices or personal devices.

[0015]

[0014] The exemplary implementation described herein is directed to second generation neural network processors (Neural Network 2.0 or NN2.0) as implemented in hardware, software, or a combination thereof. The proposed exemplary implementation can replace MAC hardware in all neural network layers / operations that use multiplication and addition, such as Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), Fully-connected Neural Networks (FNN), and Auto Encoders (AE), batch normalization, parametric rectified linear units, etc.

[0016]

[0015] In the exemplary implementation described herein, NN2.0 utilizes shifter functions in hardware, significantly reducing the area and power of neural network implementations by using shifters instead of multipliers and / or adders. This technique is based on the fact that neural network training is achieved by adjusting parameters by arbitrary coefficients of their calculated gradient values. In other words, neural network training involves incremental adjustment of each parameter by an arbitrary amount based on its gradient. Whenever NN2.0 is used to train a neural network (AI model), NN2.0 ensures that neural network parameters such as weights are logarithmically quantized (e.g., to values ​​that can be expressed as integer powers of 2) so that shifters such as binary shifters can be utilized in hardware or software for neural network operations that require multiplication and / or addition operations, such as convolution operations, batch normalization, or some activation functions such as parametric / leaky ReLU, thereby replacing multiplication and / or addition operations with shift operations. In some cases, the parameters or weights may be binary log quantized (quantizing the parameters to numbers that are integer powers of 2).The exemplary implementations described herein make it possible to perform computations of neural network operations in a manner that is much faster than can be achieved using MAC arrays, while consuming little power and having only a small physical footprint.

[0017]

[0016] The exemplary implementations described herein include novel circuitry in the form of artificial intelligence processing elements (AIPEs) to facilitate dedicated circuitry for processing neural network / artificial intelligence operations. However, the functionality described herein can be implemented in equivalent circuits by comparable field programmable gate arrays (FPGAs) or application specific integrated circuits (ASICs), or as instructions in memory that are loaded into a general purpose central processing unit (CPU) processor, depending on the desired implementation. Even when including an FPGA, ASIC, or CPU, the algorithmic implementation of the functionality described herein leads to reductions in hardware footprint, power, and execution time for processing neural network operations or other AI operations by replacing multiplications or additions with shifts, saving computation cycles or computational resources that would otherwise be consumed by normal multiplications on an FPGA, ASIC, or CPU.

[0018] Aspects of the present disclosure may include an artificial intelligence processing element (AIPE), which may comprise a shifter circuit configured to take a shiftable input derived from input data of a neural network operation, take a shift instruction derived from a corresponding log-quantized parameter of the neural network or a constant value, and shift the shiftable input leftward or rightward according to the shift instruction to form a shifted output representing a multiplication of the input data with the corresponding log-quantized parameter of the neural network.

[0019] Aspects of the present disclosure may include a system for processing a neural network operation comprising a shifter circuit configured to multiply input data with a corresponding log-quantized parameter associated with the neural network operation. To multiply the input data with the corresponding log-quantized parameter, the shifter circuit is configured to take a shiftable input derived from the input data and shift the shiftable input leftward or rightward according to a shift instruction derived from the corresponding log-quantized parameter to generate an output representing the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation.

[0020] Aspects of the present disclosure may include a method for processing a neural network operation that includes multiplying input data with a corresponding log-quantized parameter associated with the neural network operation, the multiplication including taking a shiftable input derived from the input data and shifting the shiftable input leftward or rightward according to a shift instruction derived from the corresponding log-quantized parameter to generate an output representing the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation.

[0021] Aspects of the present disclosure may include a computer program storing instructions for processing a neural network operation, including multiplying input data with a corresponding log-quantized parameter associated with the neural network operation. The instructions for multiplication may include taking a shiftable input derived from the input data and shifting the shiftable input leftward or rightward according to a shift instruction derived from the corresponding log-quantized parameter to generate an output representing the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation. The instructions may be stored on a medium, such as a non-transitory computer-readable medium, and executed by one or more processors.

[0022] Aspects of the present disclosure may include a system for processing a neural network operation including means for multiplying input data with a corresponding log-quantized parameter associated with the neural network operation. The means for multiplication may include means for taking a shiftable input derived from the input data and means for shifting the shiftable input leftward or rightward according to a shift instruction derived from the corresponding log-quantized parameter to generate an output representing the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation.

[0023]

[0022] Aspects of the present disclosure may further include a system including a memory configured to store a trained neural network represented by one or more log-quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed; one or more hardware elements configured to shift or add shiftable input data; and controller logic configured to control the one or more hardware elements to shift the shiftable input data left or right for each of the one or more neural network layers read from the memory based on the corresponding log-quantized parameter values ​​to form shifted data, wherein the formed shifted data can be added or shifted in accordance with the corresponding neural network operation to be performed.

[0024]

[0023] Aspects of the present disclosure may further include a method including managing in memory a trained neural network represented by one or more log-quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed, and controlling one or more hardware elements to shift shiftable input data to the left or right for each of the one or more neural network layers read from the memory based on the corresponding log-quantized parameter value to form shifted data, wherein the formed shifted data may be added or shifted in accordance with the corresponding neural network operation to be performed.

[0025]

[0024] Aspects of the present disclosure may further include a method that may include managing in a memory a trained neural network represented by one or more log-quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed; for each of the one or more neural network layers read from the memory, shifting shiftable input data to the left or right based on the corresponding log-quantized parameter value to form shifted data; and adding or shifting the formed shifted data in accordance with the corresponding neural network operation to be performed.

[0026]

[0025] Aspects of the present disclosure may further include a computer program including instructions for managing, in a memory, a trained neural network represented by one or more logarithmically quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed, and controlling one or more hardware elements to shift the shiftable input data left or right for each of the one or more neural network layers read from the memory based on the corresponding logarithmically quantized parameter value to form shifted data, which may add or shift the formed shifted data according to the corresponding neural network operation to be performed. The computer program and instructions may be stored in a non-transitory computer-readable medium for execution by hardware (e.g., a processor, an FPGA, a controller, etc.).

[0027]

[0026] Aspects of the present disclosure may further include a system that may include a memory means for storing a trained neural network represented by one or more log-quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed, a shifting means for each of the one or more neural network layers read from the memory means, shifting the shiftable input data left or right based on the corresponding log-quantized parameter value to form shifted data, and a means for adding or shifting the formed shifted data in accordance with the corresponding neural network operation to be performed.

[0028]

[0027] Aspects of the present disclosure may further include a method that may include managing in a memory a trained neural network represented by one or more log-quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed; for each of the one or more neural network layers read from the memory, shifting shiftable input data to the left or right based on the corresponding log-quantized parameter value to form shifted data; and adding or shifting the formed shifted data in accordance with the corresponding neural network operation to be performed.

[0029]

[0028] Aspects of the present disclosure may further include a computer program including instructions, which may include managing, in a memory, a trained neural network represented by one or more logarithmically quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed; shifting shiftable input data to the left or right for each of the one or more neural network layers read from the memory based on the corresponding logarithmically quantized parameter value to form shifted data; and adding or shifting the formed shifted data according to the corresponding neural network operation to be performed. The computer program and instructions may be stored in a non-transitory computer-readable medium to be executed by hardware (e.g., a processor, an FPGA, a controller, etc.).

[0030]

[0029] Aspects of the present disclosure may further include a system that may include a memory means for storing a trained neural network represented by one or more log-quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed, a shifting means for each of the one or more neural network layers read from the memory means, shifting the shiftable input data left or right based on the corresponding log-quantized parameter value to form shifted data, and a means for adding or shifting the formed shifted data in accordance with the corresponding neural network operation to be performed.

[0031] Aspects of the present disclosure may include a method that may include taking a shiftable input derived (e.g., scaled by a factor) from input data as described herein, and shifting the shiftable input leftward or rightward according to a shift instruction derived from a corresponding log-quantized parameter to generate an output representing a multiplication of the input data with a corresponding log-quantized parameter of a neural network operation. As described herein, the shift instruction associated with the corresponding log-quantized parameter may include a shift direction and a shift amount, where the shift amount is derived from a magnitude of an exponent of the corresponding log-quantized parameter and the shift direction is derived from a sign of the exponent of the corresponding log-quantized parameter, and shifting the shiftable input includes shifting the shiftable input leftward or rightward by an amount indicated by the shift amount according to the shift direction.

[0032]

[0031] Aspects of the present disclosure may include a method for processing an operation of a neural network, the method including taking shiftable input data derived from input data of the neural network operation; taking inputs associated with corresponding log-quantized weight parameters of the input data of the neural network operation, the inputs including a shift direction and a shift amount, the shift amount being derived from a magnitude of an exponent of the corresponding log-quantized weight parameter and the shift direction being derived from a sign of the exponent of the corresponding log-quantized weight parameter; and shifting the shiftable input data in accordance with the inputs associated with the corresponding log-quantized weight parameters to generate an output of the processing of the neural network operation.

[0033]

[0032] Aspects of the present disclosure may include a system for processing an operation of a neural network, the system including means for accepting shiftable input data derived from input data of the neural network operation, means for accepting inputs associated with corresponding log-quantized weight parameters of the input data of the neural network operation, the inputs including a shift direction and a shift amount, the shift amount being derived from the magnitude of the exponent of the corresponding log-quantized weight parameter and the shift direction being derived from the sign of the exponent of the corresponding log-quantized weight parameter, and means for shifting the shiftable input data in accordance with the inputs associated with the corresponding log-quantized weight parameters to generate an output of the processing of the neural network operation.

[0034]

[0033] Aspects of the present disclosure may include a computer program for processing an operation of a neural network, the computer program may include instructions including: taking shiftable input data derived from input data of the operation of the neural network; taking inputs associated with corresponding log-quantized weight parameters of the input data of the operation of the neural network, the inputs including a shift direction and a shift amount, the shift amount being derived from a magnitude of an exponent of the corresponding log-quantized weight parameter, and the shift direction being derived from a sign of the exponent of the corresponding log-quantized weight parameter; and shifting the shiftable input data according to the inputs associated with the corresponding log-quantized weight parameters to generate an output of the processing of the operation of the neural network. The computer program and instructions may be stored on a non-transitory computer readable medium and configured to be executed by one or more processors. [Brief description of the drawings]

[0035] [Figure 1]FIG. 1 is a diagram illustrating an example of a standard neural network training process in accordance with the related art. [Diagram 2] FIG. 2 is a diagram illustrating an example of a standard neural network inference process, in accordance with the related art. [Diagram 3]

[0036] FIG. 3 is a diagram illustrating an example of a hardware implementation of a standard neural network in accordance with the related art. [Figure 4]

[0037] FIG. 4 is a diagram illustrating an example of a training process for a quantized neural network in accordance with the related art. [Diagram 5]

[0038] FIG. 5 is a diagram illustrating an example of an inference process of a quantized neural network in accordance with the related art. [Figure 6]

[0039] FIG. 6 is a diagram illustrating an example of a hardware implementation of a quantized neural network in accordance with the related art. [Figure 7]

[0040] FIG. 7 illustrates an overall architecture of a log-quantized neural network according to an exemplary implementation. [Figure 8]

[0041] FIG. 8 illustrates an example of a training process for a log-quantized neural network, according to an exemplary implementation. [Figure 9A]

[0042] 9A and 9B are diagrams illustrating an example flow for training a log-quantized neural network, according to an example implementation. [Figure 9B] 9A and 9B are diagrams illustrating an example flow for training a log-quantized neural network, according to an example implementation. [Figure 10]

[0043] FIG. 10 illustrates an example of an inference process for a log-quantized neural network, according to an exemplary implementation. [Figure 11]

[0044] FIG. 11 is a diagram illustrating an example of a hardware implementation of a log-quantized neural network, in accordance with an exemplary implementation. [Figure 12]

[0045] FIG. 12 illustrates an example flow diagram of a hardware implementation of a log-quantized neural network, in accordance with an exemplary implementation. [Figure 13A]

[0046] 13A and 13B are diagrams illustrating a comparison between quantization and logarithmic quantization, respectively. [Figure 13B]

[0046] Figures 13A and 13B are diagrams illustrating a comparison between quantization and logarithmic quantization, respectively. [Diagram 14AB]

[0047] 14A-14C are diagrams illustrating a comparison between parameter updates. Fig. 14A is an example of a parameter update process for a normal neural network. Fig. 14B and Fig. 14C are examples of a parameter update process for a log-quantized neural network. [Figure 14C]

[0047] Figures 14A-14C are diagrams illustrating a comparison between parameter updates. Figure 14A is an example of a parameter update process for a normal neural network. Figures 14B and 14C are examples of a parameter update process for a log-quantized neural network. [Figure 15]

[0048] FIG. 15 illustrates an example of an optimizer for a log-quantized neural network, according to an exemplary implementation. [Fig. 16ABC]

[0049] 16A-16C are diagrams illustrating examples of convolution operations according to an exemplary implementation. [Figure 17A]

[0050] 17A, 17B, and 18 illustrate an example process for training a convolutional layer in a log-quantized neural network, according to an example implementation. [Figure 17B]

[0050] Figures 17A, 17B, and 18 illustrate an example process for training a convolutional layer in a log-quantized neural network, according to an example implementation. [Figure 18]

[0050] Figures 17A, 17B, and 18 illustrate an example process for training a convolutional layer in a log-quantized neural network, according to an example implementation. [Fig. 19AB]

[0051] 19A, 19B, and 20 illustrate an example process for training a dense layer in a log-quantized neural network, according to an example implementation. [Figure 20] 19A, 19B, and 20 illustrate an example process for training a dense layer in a log-quantized neural network, according to an example implementation. [Figure 21]

[0052] 21 and 22 are diagrams illustrating an example process of batch normalization within a log-quantized neural network, according to an example implementation. [Figure 22] 21 and 22 are diagrams illustrating an example process of batch normalization within a log-quantized neural network, according to an example implementation. [Figure 23]

[0053] 23 and 24 are diagrams illustrating an example of training a recurrent neural network (RNN) in a log-quantized neural network, according to an exemplary implementation. [Figure 24] 23 and 24 are diagrams illustrating an example of training a recurrent neural network (RNN) in a log-quantized neural network, according to an exemplary implementation. [Diagram 25]

[0054] 25 and 26 are diagrams illustrating an example of an RNN forward pass, according to an exemplary implementation. [Figure 26]25 and 26 are diagrams illustrating an example of an RNN forward pass, according to an exemplary implementation. [Figure 27]

[0055] 27 and 28 illustrate an example process for training an RNN in a log-quantized neural network, according to an example implementation. [Figure 28] 27 and 28 illustrate an example process for training an RNN in a log-quantized neural network, according to an example implementation. [Figure 29]

[0056] 29 and 30 are diagrams illustrating an example of training LeakyReLU in a log-quantized neural network, according to an exemplary implementation. [Diagram 30] 29 and 30 are diagrams illustrating an example of training LeakyReLU in a log-quantized neural network, according to an exemplary implementation. [Diagram 31]

[0057] 31 and 32 are diagrams illustrating an example of training a Parametric ReLU (PReLU) in a log-quantized neural network, according to an example implementation. [Diagram 32]

[0057] Figures 31 and 32 are diagrams illustrating an example of training a Parametric ReLU (PReLU) in a log-quantized neural network, according to an example implementation. [Diagram 33]

[0058] FIG. 33 is a diagram showing an example of the difference between normal neural net inference operations (NN1.0) and log-quantized neural network (NN2.0) inference operations. [Diagram 34]

[0059] FIG. 34 illustrates an example of rescaling input and bias data for log-quantized neural network inference, according to an example implementation. [Diagram 35]

[0060] 35 and 36 are diagrams illustrating an example of inference of a fully connected neural network within a regular neural network, according to an exemplary implementation. [Diagram 36]

[0060] Figures 35 and 36 are diagrams illustrating an example of inference of a fully connected neural network within a regular neural network, according to an exemplary implementation. [Figure 37]

[0061] 37 and 38 are diagrams illustrating an example of inference operations of a fully connected dense layer in a log-quantized neural network NN2.0, according to an exemplary implementation. [Figure 38]

[0061] Figures 37 and 38 are diagrams illustrating an example of inference operation of a fully connected dense layer in a log-quantized neural network NN2.0, according to an exemplary implementation. [Figure 39]

[0062] 39 and 40 are diagrams illustrating an example of the inference operation of a convolutional layer in a typical neural network, according to an exemplary implementation. [Diagram 40]

[0062] Figures 39 and 40 are diagrams illustrating an example of the inference operation of a convolutional layer in a typical neural network, according to an exemplary implementation. [Diagram 41]

[0063] 41 and 42 are diagrams illustrating an example of inference operations of a convolutional layer in a quantized neural network (NN2.0), according to an exemplary implementation. [Diagram 42]

[0063] Figures 41 and 42 are diagrams illustrating an example of inference operations of a convolutional layer in a quantized neural network (NN2.0), according to an exemplary implementation. [Fig. 43AB]

[0064] 43A, 43B, and 44 are diagrams illustrating an example of inference operation of batch normalization within a quantized neural network (NN2.0) in accordance with an exemplary implementation. [Diagram 44]

[0064] Figures 43A, 43B, and 44 are diagrams illustrating an example of inference operation of batch normalization within a quantized neural network (NN2.0), according to an exemplary implementation. [Diagram 45]

[0065] 45 and 46 are diagrams illustrating an example of inference operation of an RNN in a typical neural network, according to an exemplary implementation. [Figure 46]

[0065] Figures 45 and 46 are diagrams illustrating an example of inference operation of an RNN in a typical neural network, according to an exemplary implementation. [Figure 47]

[0066] 47 and 48 are diagrams illustrating an example of inference operation of an RNN in a log-quantized neural network (NN2.0) according to an exemplary implementation. [Figure 48]

[0066] Figures 47 and 48 are diagrams illustrating an example of inference operation of an RNN in a log-quantized neural network (NN2.0) according to an exemplary implementation. [Figure 49]

[0067] FIG. 49 illustrates example graphs of a ReLU function, a LeakyReLU function, and a PReLU function according to an example implementation. [Figure 50]

[0068] 50 and 51 are diagrams illustrating an example of converting an object detection model into a log-quantized NN2.0 object detection model according to an exemplary implementation. [Figure 51]

[0068] Figures 50 and 51 are diagrams illustrating an example of converting an object detection model into a log-quantized NN2.0 object detection model according to an exemplary implementation. [Fig. 52AB]

[0069] 52A and 52B are diagrams illustrating an example of converting a face detection model into a log-quantized NN2.0 face detection model according to an example implementation. [Fig. 53AB]

[0070] 53A and 53B are diagrams illustrating an example of converting a face recognition model into a log-quantized NN2.0 face recognition model according to an exemplary implementation. [Fig. 54AB]

[0071] 54A and 54B are diagrams illustrating an example of converting an autoencoder model to a log-quantized NN2.0 autoencoder model according to an exemplary implementation. [Fig. 55AB]

[0072] 55A and 55B are diagrams illustrating an example of converting a dense neural network model to a log-quantized NN2.0 dense neural network model according to an example implementation. [Figure 56]

[0073] FIG. 56 is a diagram illustrating an example of a standard binary multiplication that occurs in hardware according to an exemplary implementation. [Figure 57]

[0074] 57 and 58 are diagrams illustrating examples of shift operations in NN2.0 to replace multiplication operations, according to an exemplary implementation. [Figure 58]

[0074] Figures 57 and 58 are diagrams illustrating examples of shift operations in NN2.0 to replace multiplication operations, according to an exemplary implementation. [Figure 59]

[0075] FIG. 59 is a diagram illustrating an example of a shift operation in NN2.0 to replace a multiplication operation, according to an exemplary implementation. [Figure 60]

[0076] 60 and 61 are diagrams illustrating an example of a shift operation in NN2.0 using two's complement data to replace a multiplication operation, according to an exemplary implementation. [Figure 61]

[0076] Figures 60 and 61 are diagrams illustrating examples of shift operations in NN2.0 using two's complement data to replace multiplication operations, according to an exemplary implementation. [Figure 62]

[0077] FIG. 62 is a diagram illustrating an example of a shift operation in NN2.0 using two's complement data to replace a multiplication operation, according to an exemplary implementation. [Figure 63]

[0078] 63 and 64 are diagrams illustrating examples of shift operations in NN2.0 to replace accumulate / add operations, according to an exemplary implementation. [Figure 64]

[0078] Figures 63 and 64 are diagrams illustrating examples of shift operations in NN2.0 to replace accumulate / add operations, according to an exemplary implementation. [Figure 65]

[0079] 65 and 66 are diagrams illustrating an example of overflow handling of an addition operation in NN2.0 using shift operations, according to an exemplary implementation. [Figure 66]

[0079] Figures 65 and 66 are diagrams illustrating an example of overflow handling of an addition operation in NN2.0 using shift operations, according to an exemplary implementation. [Figure 67]

[0080] 67-69 are diagrams illustrating an example of a segment assembly operation of NN2.0 according to an exemplary implementation. [Figure 68] 67-69 are diagrams illustrating an example of a segment assembly operation of NN2.0, according to an exemplary implementation. [Figure 69] 67-69 are diagrams illustrating an example of a segment assembly operation of NN2.0, according to an exemplary implementation. [Figure 70]

[0081] 70 and 71 are diagrams illustrating examples of shift operations in NN2.0 to replace accumulate / add operations, according to an exemplary implementation. [Figure 71]

[0081] Figures 70 and 71 are diagrams illustrating examples of shift operations in NN2.0 to replace accumulate / add operations, according to an exemplary implementation. [Figure 72]

[0082] FIG. 72 is a diagram illustrating an example of a general architecture of an AI Processing Element (AIPE), according to an exemplary implementation. [Figure 73]

[0083] FIG. 73 is a diagram illustrating an example of an AIPE including an arithmetic shift architecture, according to an example implementation. [Figure 74]

[0084] FIG. 74 is a diagram illustrating an example of an AIPE shift operation to replace a multiplication operation, according to an example implementation. [Figure 75]

[0085] FIG. 75 is a diagram illustrating an example of an AIPE shift operation to replace a multiplication operation, according to an example implementation. [Figure 76]

[0086] 76-78 are diagrams illustrating examples of AIPEs that perform convolution operations according to an exemplary implementation. [Figure 77] 76-78 are diagrams illustrating examples of AIPEs that perform convolution operations, according to an exemplary implementation. [Figure 78] 76-78 are diagrams illustrating examples of AIPEs that perform convolution operations, according to an exemplary implementation. [Figure 79]

[0087] 79 and 80 are diagrams illustrating an example of an AIPE performing a batch normalization operation, in accordance with an example implementation. [Figure 80]

[0087] Figures 79 and 80 are diagrams illustrating an example of an AIPE performing a batch normalization operation, according to an example implementation. [Figure 81]

[0088] 81 and 82 are diagrams illustrating an example of an AIPE that performs a parametric ReLU operation, according to an exemplary implementation. [Figure 82]

[0088] Figures 81 and 82 are diagrams illustrating an example of an AIPE that performs a parametric ReLU operation, according to an exemplary implementation. [Figure 83]

[0089] 83 and 84 are diagrams illustrating an example of an AIPE that performs an addition operation, according to an exemplary implementation. [Figure 84]

[0089] Figures 83 and 84 are diagrams illustrating an example of an AIPE that performs an addition operation, according to an exemplary implementation. [Figure 85]

[0090] FIG. 85 is a diagram illustrating an example of a NN2.0 array, according to an exemplary implementation. [Fig. 86ABCD]

[0091] 86A-86D are diagrams illustrating examples of AIPE structures dedicated to each neural network operation, according to an exemplary implementation. [Figure 87]

[0092] FIG. 87 is a diagram illustrating an example of an NN2.0 array using the AIPE structure of FIGS. 86A-86D, according to an exemplary implementation. [Figure 88]

[0093] FIG. 88 illustrates an example computing environment in which some example implementations may be applied. [Figure 89]

[0094] FIG. 89 illustrates an example system for AIPE control, according to an example implementation. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0036]

[0095] The following detailed description provides diagrams and exemplary implementation details of the present application. Reference numbers and descriptions of redundant elements between figures are omitted for clarity. The terms used throughout the description are provided as examples and are not intended to be limiting. For example, the use of the term "automatically" may include fully automatic implementations or semi-automatic implementations with user or administrator control over certain aspects of the implementation, depending on the desired implementation of those skilled in the art practicing the implementation of the present application. Selections may be performed by a user through a user interface or other input means, or may be performed by a desired algorithm. The exemplary implementations described herein may be utilized alone or in combination, and the functionality of the exemplary implementations may be implemented by any means according to the desired implementation.

[0037]

[0096] 7 shows the overall architecture of a log-quantized neural network according to an exemplary implementation. The NN2.0 architecture is a log-quantized neural network platform that includes a training and inference platform. In the following, the training and inference process of the NN2.0 architecture is described.

[0038]

[0097] Training data 701 and an untrained neural network 702 are input to a training platform 703. The training platform 703 includes an optimizer 704 and a logarithmic quantizer 705. The optimizer 704 optimizes the parameters of the model according to any optimization algorithm known in the art. The logarithmic quantizer 705 logarithmically quantizes the optimized parameters. The optimizer 704 and the logarithmic quantizer 705 are run iteratively until the error falls below a desired threshold and the neural network is trained, or another termination condition is met, according to a desired implementation. The resulting output is a trained neural network 706 represented by the logarithmically quantized parameters.

[0039]

[0098] The trained neural network 706 and inference data 707 are input to an inference platform 708, which may include: A data and bias scaler 709 scales the estimated data 707 and bias parameters of the trained neural network 706 as described herein to form data and parameters that can be shifted left or right. An inference engine 710 infers the scaled inference data 707 using the trained neural network 706 by hardware or some combination of hardware and software as described herein. A data scaler 711 scales the output of the inference engine 710 to an appropriate output range depending on the desired implementation. The inference platform 708 may generate an output 712 based on the results of the data and bias scaler 709, the inference engine 710, and / or the data scaler 711. The elements of the architecture shown in FIG. 7 can be implemented in any combination of hardware and software. Although the exemplary implementations described herein include a novel artificial intelligence processing unit (AIPE) implemented in hardware to facilitate the multiplications and / or additions required in inference by shifting, as described herein, such exemplary implementations may also be implemented in other ways or by conventional hardware (e.g., by field programmable gate arrays (FPGAs), hardware processors, etc.) and instead save processing cycles, power consumption, and area on such conventional hardware due to the change of multiply / add operations to simpler shift operations.

[0040]

[0099] 8 shows an example of training a log-quantized neural network according to an exemplary implementation. Depending on the desired implementation, any mathematical operation that turns an operand into an integer, such as "floor(operand)" or "ceiling(operand)" or "truncate(operand)" may be used instead of utilizing the "round(operand)" operation described in FIG. 4, and the present disclosure is not specifically limited thereto.

[0041]

[0100] 9A and 9B show an example flow for training a log-quantized neural network according to an example implementation.

[0042]

[0101] At 901, the flow first initializes the neural network parameters (e.g., weights, biases), which can be in the form of random floating point numbers or integers, according to the desired implementation. At 902, test data is input to the neural network and propagated forward through all of the neural network layers to obtain output values ​​processed by the neural network. At 903, an error in the output values ​​is calculated by comparing the output values ​​with the values ​​of the test labels. At 904, an optimization method is used to determine how to change the parameters to reduce the error of the neural network, and the parameters are changed accordingly. At 905, a determination is made as to whether the parameters are acceptable, i.e., whether the neural network produces an error within a threshold, or other termination conditions are met. If so (yes), the flow proceeds to 906; if not (no), the flow proceeds to 902. In response, the flow from 902 to 905 is repeated until a desired error is met or a termination condition is met (e.g., manually terminated, a number of iterations is met, etc.).

[0043]

[0102] At 906, the resulting parameters are then logarithmically quantized to reduce the size of the parameters, thereby preparing the parameters for hardware implementation of the shifter. In one example, 32-bit floating-point numbers are logarithmically quantized to 7-bit data, but the disclosure is not limited to this example and other implementations can be utilized according to the desired implementation. For example, 64-bit floating-point numbers can be logarithmically quantized to 8-bit data. Furthermore, the flow at 906 does not need to be executed last to logarithmically quantize the parameters. In an exemplary implementation, the logarithmic quantization of the parameters can be part of an iterative process between 902 and 905 (e.g., executed before 905), such that the logarithmic quantization can be used as part of an iterative training process of the parameters, as shown at 916 in FIG. 9B. Such an exemplary implementation can be utilized according to the desired implementation, such that the optimization and logarithmic quantization occur together to generate the parameters (e.g., parameters of 7-bit data). The resulting log-quantized neural network can thereby take in any input (e.g., float, integer) and provide output data (e.g., proprietary data formats, integers, floats) accordingly.

[0044]

[0103] FIG. 10 shows an example of an inference process of a logarithmically quantized neural network according to an exemplary implementation. To facilitate neural network inference, first, inference data is input to the neural network and propagated forward through all layers to obtain output values. Then, the output values ​​of the neural network are interpreted according to the objective set by the neural network. However, in this example, the parameters are logarithmically quantized. Therefore, the inference process can be implemented via a shifter circuit or AIPE, or can be implemented in software using a hardware processor and shifting operations, as described herein, depending on the desired implementation.

[0045]

[0104] FIG. 11 illustrates an example of a hardware implementation of a log-quantized neural network according to an exemplary implementation. To implement a log-quantized neural network in hardware, first, input data and neural network parameters are obtained. Then, by using a hardware or software data scaler, the input data and bias are scaled by a factor in preparation for a shift operation by a hardware shifter. By using a hardware shifter, the input data is shifted based on the log-quantized parameter values. Then, by using a hardware adder, all of the shifted values ​​are added together. Finally, a hardware adder is used to add the bias to the sum value. In the exemplary implementation of FIG. 11, the log-quantized parameters (e.g., 7-bit log-quantized parameters) and scaled (e.g., 2-bit log-quantized parameters) are scaled by a factor. 10 A 32-bit shifter is utilized to facilitate multiplication of input data values ​​(resized by ) and for addition operations. However, other variations may be utilized depending on the desired implementation, and this disclosure is not limited thereto. The input data values ​​may be resized by any factor, the log-quantized parameters may similarly be any type of log-quantized coefficient (e.g., 8-bit, 9-bit), and the shifter is sized appropriately (e.g., 16-bit, 32-bit, 64-bit, etc.) to facilitate the desired implementation.

[0046]

[0105] FIG. 12 shows an example of a flow diagram of log-quantized neural network inference in a hardware implementation, according to an exemplary implementation. At 1201, the flow obtains input data and log-quantized neural network parameters. At 1202, the flow rescales the input data and bias by an appropriate coefficient and converts the input data and bias into a shiftable form for a shift operation. At 1203, the shiftable input data is shifted by a shift instruction derived from the log-quantized parameters. This shifting can be performed by a hardware shifter as described herein, or by a hardware processor or field programmable gate array (FPGA), depending on the desired implementation. Details of this shifting are further described below.

[0047]

[0106] All of the shifted values ​​are added at 1204. The addition operation can be performed by a hardware adder or by a hardware processor or FPGA, as described herein, depending on the desired implementation. Similarly, at 1205, the scaled bias is added to the sum resulting from the addition operation at 1204 by a hardware adder, hardware processor, or FPGA.

[0048]

[0107] Figures 13A and 13B show a comparison between quantization and logarithmic quantization, respectively. Figure 13A shows an example of quantizing integers from 0 to 104 with qv=10, where Quantization(n)=round(n / qv)*qv. Figure 13B shows an example of logarithmic quantization of integers from 2 to 180, where Log Quantization(+-n)=+-2 round(log2(n)) As shown in a comparison of Figures 13A and 13B, logarithmic quantization results in a range of 2 as opposed to the same range, regardless of the parameter value. n This allows for greater accuracy for smaller parameters.

[0049]

[0108] 14A-14C show a comparison between parameter updates for training a normal neural network and training a log-quantized neural network, respectively. Although the exemplary implementation described herein includes performing log quantization of the weight parameters by appropriately adjusting the gradient, log quantization of the updated weight parameters after adjusting the gradient can also be performed according to the exemplary implementation described herein. In such an exemplary implementation, the flow and 916 of FIG. 9B can be modified by determining an appropriate learning rate to multiply with the gradient so that the resulting parameter values ​​are log quantized values.

[0050]

[0109] In the exemplary implementation described herein, the input data is resized according to the preferred implementation to correspond to the shift operation. Most parameters in the model result in a "shift right" operation that corresponds to values ​​less than 1.0, such as 0.5, 0.25, 0.125, etc. Thus, the input data is shifted left, which adds 2 to the input. N where N is a positive integer.

[0051]

[0110] As an example, if the raw input value is x old = 0.85. This input is 2 20 It is resized by 0.85x2 20 The resulting input value x = 0.85x1,048,576 = 891,289.6 is then rounded to the nearest integer, such that round(891,289.6) = 891,290, resulting in the new input value x new =891,290 is used.

[0052]

[0111] Bias is defined as a parameter that is added (rather than multiplied) in neural network operations. In standard neural network operations such as the following, the bias term is an additive term: a=x*w+b

[0053]

[0112] where a is the axon (output), x is the input, w is the weight, and b is the bias. In the exemplary implementation described herein, the input and bias are scaled by the same amount. For example, 2 20 If the input is resized by 2 20 The magnitude of the bias is changed by

[0054]

[0113] FIG. 15 shows an example of an optimizer according to an exemplary implementation. In the exemplary implementation described herein, the optimization can be built on top of any other gradient-based optimizer. The optimization can be performed in multiple stages, with the number of stages set by the user, as well as the number of times the step is performed (in a training step), the layers affected by the step in each stage, and / or whether to quantize variables within a threshold set by the user ("quantize" - quantize values ​​below a quantization threshold) or force quantization of all variables in the selected layer ("force" - quantize all parameters regardless of threshold). Each stage is defined by the number of steps in the stage (e.g., number of optimizations per stage), the step interval (e.g., number of operations per stage), and the operation (e.g., type of operation (quantize / force) and layer to quantize).

[0055]

[0114] Depending on the desired implementation, the user may set the following parameters:

[0056]

[0115] quant_method: "truncate" or "nearest". The rounding method to use when quantizing.

[0057]

[0116] freeze_threshold: Threshold for determining the percentage of weights that must be quantized before forcing the quantize+freeze behavior on the remaining weights.

[0058]

[0117] mask_threshold: A threshold for determining how close a weight must be to its log-quantized form in order for it to be quantized+freezed.

[0059]

[0118] In an example implementation, the quantization method for the model can be as follows:

[0060]

[0119] Closest: For a value x, quantize to the closest log2 value.

[0061]

[0120] Down: For a value x, quantize to the nearest log2 floor.

[0062]

[0121] Stochastic: For a value x, find the log2 round up and round down. The probability that round up is chosen is (x-round down) / (round up-round down).

[0063]

[0122] In an exemplary implementation, the method for freezing a model is as follows:

[0064]

[0123] Threshold: During the freezing operation, freeze all layers that have a percentage of frozen weights equal to or greater than fz_threshold. At the end of training, all remaining layers are also frozen.

[0065]

[0124] Ranked: During the freezing operation, the layers are ranked in terms of the percentage of weight that is frozen. The highest ranked layers are then frozen and managed so that the same number of layers are frozen each time the freezing operation is performed.

[0066]

[0125] Ordered: Layers are frozen and managed with respect to input->output order, such that the same number of layers are frozen during the freezing operation.

[0067]

[0126] In an exemplary implementation, the training phase options can be as follows: Default is assumed to be standard (NN1.0) neural network operation.

[0068]

[0127] Fz_all: If this is an NN2.0 operation, quantize and freeze the layer and apply a mask to the layer.

[0069]

[0128] Fz_bn: If this is an NN2.0 operation, quantize and freeze the batch normalization layer and apply a mask to the batch normalization layer.

[0070]

[0129] Fz_conv: If this is NN2.0 operation, quantize and freeze the convolutional layers and apply a mask to the convolutional layers.

[0071]

[0130] Quant_all: If this is a NN2.0 operation, quantize all layers and apply a mask to all layers.

[0072]

[0131] Quant_bn: If this is an NN2.0 operation, quantizes the batch normalization layer and applies a mask to the batch normalization layer.

[0073]

[0132] Quant_conv: If this is an NN2.0 operation, quantizes the convolutional layer and applies a mask to the convolutional layer.

[0074]

[0133] The breakdown of training for an exemplary implementation may be as follows:

[0075]

[0134] Input: A tuple from the training phase.

[0076]

[0135] Example A: ((4,1,Fz_all),)

[0077]

[0136] The first entry determines the number of epochs that the stage will run (in this case fz_all of 4 epochs).

[0078]

[0137] The second entry determines how many times the NN2.0 operation is performed. In other words, this tuple indicates that an fz_all operation is performed every epoch.

[0079]

[0138] The third entry indicates what stage of NN2.0 operation is being performed.

[0080]

[0139] Example B:((2,1,Default),(4,1,Fz_conv),(4,2,fz_bn))

[0081]

[0140] In this example, training is run for a total of 10 epochs. The first two epochs are trained using NN1.0. The next four epochs run NN2.0 operations at the end of every epoch. By the end of the four epochs, all convolutional layers are frozen. The final four epochs run NN2.0 every other epoch. By the end of the four epochs, all batch normalization layers are frozen.

[0082]

[0141] Figures 16A, 16B, and 16C show examples of convolution operations according to an exemplary implementation. Specifically, Figure 16A shows an example of convolution, Figure 16B shows an example of depthwise convolution, and Figure 16C shows an example of separable convolution. In the exemplary convolution of Figure 16A, a two-dimensional (2D) convolution is applied to an input signal as follows: Conv(x)=Σ(weight*x)+bias

[0083]

[0142] In the depthwise convolution example of Figure 16B, a 2D convolution is applied separately to each channel and the outputs are concatenated. In the separable convolution example of Figure 16C, a 2D convolution is applied separately to each channel and the outputs are concatenated to perform the convolution depthwise.

[0084]

[0143] FIG. 17A, FIG. 17B, and FIG. 18 show an example process for training a convolutional layer according to an example implementation. Specifically, FIG. 17A shows an example of a forward pass of convolution, FIG. 17B shows an example of updating and logarithmic quantization of convolutional weights, and FIG. 18 shows an example flow of training a convolutional layer with reference to FIG. 17A and FIG. 17B. In the flow of FIG. 18, at 1801, the flow convolves each kernel (3x3x3 in FIG. 17A) by multiplying each value against the input data and then accumulating the products. One output matrix (3x3 in FIG. 17A) is generated for each kernel. At 1802, the flow calculates the weight gradient after calculating the error between the output and ground truth data. At 1803, the flow updates the weights using the weight gradient according to a predefined update algorithm as shown in FIG. 17B. At 1804, the flow logarithmically quantizes the weight values ​​that have a low logarithmic quantization cost. Weights with high quantization losses can remain unquantized until a future iteration or can be quantized immediately, depending on the desired implementation. In the example of FIG. 17B, the value "2.99" is left unquantized because its logarithmic quantization cost is 2.99-2.00=0.99, which is higher than the maximum logarithmic quantization loss of 0.5. At 1805, the process of 1801-1804 is repeated until the training of the convolution is completed.

[0085]

[0144] FIG. 19A, FIG. 19B, and FIG. 20 show an example process for training a dense layer according to an example implementation. Specifically, FIG. 19A shows an example of a forward pass of a dense layer, FIG. 19B shows an example of updating and logarithmic quantization of weights of the dense layer, and FIG. 20 shows an example flow of training a dense layer with reference to FIG. 19A and FIG. 19B. In the flow of FIG. 20, in 2001, the flow multiplies each input row data (input (1x3) in FIG. 19A) with each column of a weight matrix (weight (3x4) in FIG. 19A), and then accumulates the products, resulting in an output (1x4) as shown in FIG. 19A. In 2002, the flow calculates the weight gradient after calculating the error between the output and the ground truth data. In 2003, the flow uses the weight gradient to update the weights according to a predefined update algorithm as shown in FIG. 19B. At 2004, the flow log-quantizes weight values ​​that have a low log-quantization cost. Weights with a high quantization loss can remain unquantized until a future iteration or can be quantized immediately, depending on the desired implementation. At 2005, the process of 2001-2004 is repeated until training of the dense layer is completed.

[0086]

[0145] For batch normalization training, we take a d-dimensional input x=(x (1) ...x (d) ), each dimension is normalized.

[0087]

[0146] The dimensions may represent the channel based on the following formula:

number

[0088]

[0147] Activation x (k) For each parameter γ (k) , β (k) The pair of parameters, , may be shifted by rescaling the normalized values.,The parameter pairs are learned along with the original model parameters.

number

[0089]

[0148] For batch normalized data, the following equation expresses batch normalization (BN):

number

[0090]

[0149] The mean and variance of the data are calculated.

[0091]

[0150] The value of epsilon (ε) is typically a small number to avoid division by zero. Next, BN is converted to the form W.x+B.

number

number

number

[0092]

[0151] FIG. 21 and FIG. 22 show an example of training of batch normalization according to an exemplary implementation. Specifically, FIG. 22 shows a flow of training of batch normalization used in the example of FIG. 21. At 2201, the flow performs element-wise multiplication of input with batch normalization weights. At 2202, the flow adds a bias of batch normalization. At 2203, the flow calculates gradients by comparing the output of axons with the labels. At 2204, the flow updates the variables of batch normalization. At 2205, the flow log-quantizes the batch normalization weights that are close to the log-quantized value (e.g., within a threshold). At 2206, the flow repeats 2205 until the batch normalization weights are completely log-quantized.

[0093]

[0152] FIG. 23 and FIG. 24 show an example of a recurrent neural network (RNN) forward pass according to an exemplary implementation. Specifically, FIG. 23 and FIG. 24 show an example of an RNN forward pass. At 2401, the flow multiplies the first data and weights (2x2) in FIG. 23. At 2402, the flow accumulates all of the products of the first data and weights. At 2403, during the first iteration, the flow multiplies a zero array having the same shape as the data with a hidden layer (2x2). At 2404, the flow accumulates all of the products of the zero array and the hidden layer. At 2405, the flow saves the sum value of the outputs from 2402 and 2404, and this sum value is used in the next or subsequent iteration. At 2406, the flow multiplies the second data of FIG. 23 with weights (2x2). At 2407, the flow accumulates all of the products of the second data and weights. At 2408, the flow multiplies the output from 2407 by a hidden layer (2x2). At 2409, the flow accumulates all products of the saved outputs and hidden layers. At 2410, the flow repeats until the data is completely processed.

[0094]

[0153] FIG. 25 and FIG. 26 show another example of an RNN forward pass according to an exemplary implementation. Specifically, FIG. 25 and FIG. 26 show an example of an RNN forward pass. At 2601, the flow multiplies the first data of FIG. 25 by a weight (2x2). At 2602, the flow accumulates all of the products of the first data and the weight. At 2603, during the first iteration, the flow multiplies a zero array (init_state) that has the same shape as the data (1x2) by the hidden layer (2x2). At 2604, the flow accumulates all of the products of the zero array and the hidden layer (2x2). At 2605, the flow saves the sum value of the outputs from 2602 and 2604, and this sum value is used in the next or subsequent iteration. At 2606, the flow multiplies the second data of FIG. 25 by a weight (2x2). At 2607, the flow accumulates all products of the second data and the weights (2x2). At 2608, the flow multiplies the output from 2607 by the hidden layer (2x2). At 2609, the flow accumulates all products of the saved output and the hidden layer (2x2). At 2610, the flow repeats until the data is completely processed.

[0095]

[0154] FIG. 27 and FIG. 28 show examples of RNN weight update and logarithmic quantization according to an exemplary implementation. Specifically, FIG. 27 shows examples of RNN weight update and quantization, and FIG. 28 shows an exemplary flow of RNN weight update and quantization. At 2801, the flow calculates weight gradients by calculating the error between the output and ground truth data. In some cases, the weight (2x2) and hidden layer (2x2) are both dense layers. At 2802, the flow updates weights using weight gradients based on a predefined or preconfigured update algorithm. At 2803, the flow logarithmically quantizes weight values ​​with low (e.g., within a threshold) logarithmic quantization cost. Weights with high (e.g., above a threshold) quantization loss are not quantized and are left for future or subsequent iterations.

[0096]

[0155] 29 and 30 show an example of training LeakyReLU according to an exemplary implementation. Specifically, FIG. 29 shows an example of training LeakyReLU, and FIG. 30 shows an exemplary flow of training LeakyReLU. LeakyReLU may apply an element-wise function corresponding to LeakyReLU(x)=max(0,x)+negative_slope*min(0,x), where if x≧0, then LeakyReLU(x)=x, otherwise, LeakyReLU(x)=negative_slope*x. At 3001, a flow determines whether y is greater than or equal to zero (0). At 3002, in response to a determination by the flow that y is greater than or equal to zero (0), y is set to the value of x, and the training process is completed. At 3003, in response to a determination by the flow that y is less than zero (0), x is multiplied by a negative slope. In standard neural network operation, negative slopes are set to 0.3 by default. In NN2.0, the negative slope is set to 0.25 or 2 by logarithmically quantizing the value of 0.3. -2 In 3004, the flow trains the NN using the updated gradient values. The NN is trained using the updated gradient values ​​because the values ​​of axons in other layers may change during training.

[0097]

[0156] FIG. 31 and FIG. 32 show an example of training a parametric ReLU (PReLU) according to an exemplary implementation. Specifically, FIG. 31 shows an example of training a PReLU, and FIG. 32 shows an exemplary flow of training a PReLU. Training a PReLU may apply an element-wise function corresponding to PReLU(x)=max(0,x)+α*min(0,x), where PReLU(x)=x if x≧0, and PReLU(x)=α*x otherwise. In such a case, α is a trainable parameter. At 3201, the flow determines whether y is greater than or equal to zero (0). At 3202, in response to the flow determining that y is greater than or equal to zero (0), y is set to the value of x, and the PReLU training process is completed. At 3203, in response to the flow determining that y is less than zero (0), x is multiplied by α to calculate gradients and update layer weights. In 3204, if α is close (e.g., within a threshold) to the log-quantized weight, the flow changes α to a log-quantized value. In 3205, if α is not log-quantized in 3204, the processes of 3203 and 3204 repeat until alpha is log-quantized.

[0098]

[0157] FIG. 33 shows an example of the difference between normal neural net operation (NN1.0) and NN2.0 operation. After the neural network is trained, learned, or optimized, inference data (any data) may be applied to the trained neural network to obtain output values. The output values ​​are interpreted based on the rules set for the neural network. For example, in NN1.0, data may be multiplied with weights to generate outputs. In NN2.0, data may be shifted based on the logarithmically quantized weights of NN2.0 to generate the resulting outputs of the neural network operation.

[0099]

[0158] A potential problem with using shift operations in NN2.0 is that information (digits in the axons of the layer) can be lost in right-shift operations. For example, if the input to a dense layer is 4 (0100 in binary) and the weight is 2 -5 Assume that , it means that the input (4=0100) is shifted right by 5 to produce a result of 0, instead of the usual 0.125 due to the multiplication. This can lead to a loss of information due to right shifts in NN2.0. This issue can be taken into account by expanding (shifting left) all input data by a factor, leaving enough space to fully apply all right shift operations. The exact coefficient values ​​may vary depending on the particular neural network and / or the dataset used with the neural network. For example, a factor of 2 24 However, the present disclosure contemplates a factor of 2 so that other coefficient values ​​may be used. 24 The biases of each layer should be scaled (left shifted) by the same coefficients used for the input data to maintain consistency with the scaled input, for example as shown in FIG.

[0100]

[0159] FIG. 35 and FIG. 36 show an example of inference of a fully connected neural network including a dense layer in a normal neural network according to an exemplary implementation. Specifically, FIG. 35 shows an example of a fully connected neural network (e.g., NN1.0) including a dense layer, and FIG. 36 shows an exemplary flow of a fully connected neural network including a dense layer. The neural network of FIG. 35 includes an input layer, a hidden layer, and an output layer. The input layer may include multiple inputs that are fed to the hidden layer. At 3601, the flow obtains input data. The input data that is fed to the hidden layer includes floating-point numbers. At 3602, the flow multiplies the input data with optimized weights. At 3603, the flow calculates the sum of the input data and bias multiplied by the corresponding optimized weights and generates an output.

[0101]

[0160] 37 and 38 show an example of inference of a fully connected dense layer in a log-quantized neural network NN2.0 according to an example implementation. Specifically, FIG. 37 shows an example of a fully connected NN2.0 including a dense layer, and FIG. 38 shows an example flow of a fully connected NN2.0 including a dense layer. The NN2.0 of FIG. 37 includes an input layer, a hidden layer, and an output layer. The input layer may include multiple inputs that are fed to the hidden layer. At 3801, the flow resizes the input data. The input data includes floating point numbers resized by a coefficient. For example, the floating point numbers are 2 24 The input data may be scaled by a factor of 1. This disclosure is not intended to be limited to the example scale factors disclosed herein, as different values ​​of the scale factors may be used. At 3802, the flow shifts the input data based on a shift instruction derived from the corresponding log-quantized weights. The weights may include 7-bit data derived from log-quantizing the parameters. At 3803, the flow adds a bias. The bias may be scaled by the same factor used to scale the input data.

[0102]

[0161] FIG. 39 and FIG. 40 show an example of a convolution inference operation in a typical neural network according to an exemplary implementation. Specifically, FIG. 39 shows an example of a convolution inference operation of a convolution layer, and FIG. 40 shows an exemplary flow of a convolution inference operation of a convolution layer. In 4001, the flow convolves each kernel (3x3x3 as shown in FIG. 39) over all the input data. In 4002, the flow multiplies each value and accumulates or adds the products. In the example of FIG. 39, one output matrix (3x3) may be generated for each kernel. In 4003, the flow adds a corresponding bias to each output matrix. Each kernel may have a different bias that is broadcasted over the entire output matrix (3x3 in FIG. 39) of the kernel.

[0103]

[0162] 41 and 42 show an example of a convolution inference operation of NN2.0 according to an exemplary implementation. Specifically, FIG. 41 shows an example of a convolution inference operation of a convolution layer of NN2.0, and FIG. 42 shows an exemplary flow of convolution inference of a convolution layer of NN2.0. At 4201, the flow modifies the magnitude of each of the input data by a coefficient and modifies the magnitude of each bias value by the same coefficient. If the layer is an input layer to NN2.0, the flow modifies the coefficients (e.g., 2 24 ) to scale each of the input data. If the layer is not an input layer, the input data values ​​are assumed to have already been scaled, and the kernel weights are assumed to have been trained to log-quantized values ​​for use in shifting. At 4202, the flow convolves each kernel (2x2x3 in FIG. 41) over all of the input data. An element-wise shift may be used on each value, and the results are accumulated. In some aspects, one output matrix (3x3 in FIG. 41) is generated per kernel. The weight values ​​in the kernel may have the form (+ / - to determine the sign of the weight) (+ / - for left / right shift, followed by the amount to shift). For example, +(-5) indicates that the sign of the weight is negative, followed by a shift to the right by 5. This convolves the input values ​​by 2 -5 At 4203, the flow adds a corresponding bias to each output matrix. Each kernel may have a respective bias that may be broadcast across the entire output matrix of the kernel (3x3 in FIG. 41).

[0104]

[0163] Regarding the inference of batch normalization, batch normalization may correspond to the following equation:

number

[0105]

[0164] Here, γ and β may be trainable parameters, while mean and variance may be constants and may be set during training. Epsilon (ε) is also a constant used for numerical stability and has a small value, such as, but not limited to, 1E-3. Mean, variance, and epsilon are all broadcasted. Mean and variance have one value per channel (broadcasted across the height / width of each channel), while epsilon is one value broadcast across all dimensions. In some cases, an element-wise operation following a batch normalization equation may be used to calculate the axons using the input data (x).

[0106]

[0165] FIG. 43A, FIG. 43B, and FIG. 44 show an example of batch normalization inference according to an exemplary implementation. Specifically, FIG. 43A shows the batch normalization equation transformed for NN2.0, FIG. 43B shows the batch normalization inference of NN2.0, and FIG. 44 shows an exemplary flow of the batch normalization inference of NN2.0. The batch normalization equation of NN2.0 is transformed as shown in FIG. 43A. The final form of the batch normalization of NN2.0 is shown as Equation 3 of FIG. 43A. In some cases, it may be assumed that during training, W in Equation 4 of FIG. 43A and B in Equation 4 of Equation 43A are optimized, W is logarithmically quantized, and W and B are set and ready for inference.

[0107]

[0166] In 4401, the flow shifts the input data element-wise based on the log-quantized weight (w) values, as shown in FIG. 43B. In 4402, the flow adds a bias element-wise. Because this layer is a batch normalization layer, it is unlikely to be an input layer where the input data is assumed to be scaled. The bias may be scaled by the same factor as the input data. In 4403, the flow computes the axons.

[0108]

[0167] FIG. 45 and FIG. 46 show an example of inference of RNN in a normal neural network according to an exemplary implementation. Specifically, FIG. 45 shows an example of inference of RNN, and FIG. 46 shows an exemplary flow of inference of RNN. In 4601, the flow multiplies the first data of FIG. 45 by a weight (2x2). In 4602, the flow accumulates all products of the first data and the weight. In 4603, during the first iteration, the flow multiplies a zero array (init_state) having the same shape as the data (1x2) by a hidden layer (2x2). In 4604, the flow accumulates all products of the zero array. In 4605, the flow saves the sum value of the output from 4602 and 4604, and this sum value is used in the next or subsequent iteration. In 4606, the flow multiplies the second data of FIG. 45 by a weight (2x2). At 4607, the flow accumulates all products of the second data and weights. At 4608, the flow multiplies the output from 4605 by a hidden layer (2x2). At 4609, the flow accumulates all products of the saved outputs. At 4610, if the data is not completely processed at 4609, the process of 4605-4609 repeats until the data is completely processed.

[0109]

[0168] FIG. 47 and FIG. 48 show an example of inference of an NN2.0 RNN according to an exemplary implementation. Specifically, FIG. 47 shows an example of inference of an NN2.0 RNN, and FIG. 48 shows an exemplary flow of inference of an NN2.0 RNN. In 4801, the flow multiplies the zero array (init_state) by the hidden layer (2x2) using a shift and accumulates the values. As shown in FIG. 47, the resulting vector is saved (output 1 A). In 4802, the flow multiplies the first data (data A) by the weight (2x2) using a shift and accumulates the values. The weight (2x2) and the hidden layer (2x2) are both dense layers. As shown in FIG. 47, the resulting vector is saved (output 2 A). In 4803, the flow adds the vector output from 4801 and 4802 together. The resulting vector is stored (output 3 A) as shown in FIG. 47. At 4804, the flow multiplies the vector output from 4803 by the hidden layer (2x2) using a shift and accumulates the values. The resulting vector is stored (output 1 B) as shown in FIG. 47. At 4805, the flow multiplies the second data (data B) by the weights (2x2) using a shift and accumulates the values. The resulting vector is stored (output 2 B) as shown in FIG. 47. At 4806, if the data is not completely processed at 4805, the process of 4802-4805 repeats until the data is completely processed.

[0110]

[0169] In some cases, three types of rectified linear unit (relu) activation functions are commonly used, which may include ReLU, LeakyReLU, or Parametric ReLU (PReLU). ReLU may correspond to the following equation:

[0111]

[0170] ReLU(x) = (x) + =max(0,x)

[0112]

[0171] LeakyReLU may correspond to the following equation:

[0113]

[0172] LeakyReLU(x)=max(0,x)+negative_slope*min(0,x), where

number

[0114]

[0173] PReLU may correspond to the following equation:

[0115]

[0174] PReLU(x)=max(0,x)+α*min(0,x), where

number

[0116]

[0175] These three functions are configured to take in an input (usually a tensor of axons computed through layers of a neural network) and apply a function to compute an output. Each input value in the axon tensor acts independently based on their value. For example, when the input value is greater than zero, all three functions behave the same, such that output = input. However, when the input value is less than zero, the functions behave differently.

[0117]

[0176] For ReLU, if the input value<0, the output=0. For LeakyReLU, the output=negative_slope*input, where negative_slope is set at the beginning of training (usually to 0.3) and is fixed throughout training. For PReLU, the output=α*input, where α is trainable and optimized during training. α has one value per PReLU layer and is broadcast across all dimensions. In some cases, such as when there are two or more PReLUs in the network, each PReLU contains a corresponding trained, optimized α.

[0118]

[0177] FIG. 49 shows an example graph of all three functions according to an example implementation. All three activation functions infer the same as standard inference, such that when the input value is greater than 0, output=input. When the input value is less than zero (0), the inference of NN2.0 ReLU may have output=0, as shown as the short dashed line in FIG. 49. When the input value is less than zero (0), the inference of NN2.0 ReLU may be the same as standard ReLU. NN2.0 LeakyReLU inference for negative input values ​​is modified such that negative_slope is logarithmically quantized (0.25=2, shown as the long dashed line in FIG. 49). -2 , which has a default of 0.01. To compute the output using shifts (instead of multiplications), logarithmic quantization is performed. The value of negative_slope is set before training begins, and the trainable parameters in other layers are trained and optimized accordingly. The inference of NN2.0's PReLU in the case of negative input values ​​is optimized by the trainable parameters (α=0.5=2, shown as dotted lines in Figure 49). -1 ) are log-quantized during training, allowing the shift to be used to calculate the output values.

[0119]

[0178] 50 and 51 show an example of how to convert an object detection model such as YOLO to a log-quantized NN2.0 model according to an exemplary implementation. A standard YOLO architecture may include backbone 5001, neck 5002, and head 5003. The backbone may include CSPDarknet53 Tiny, while the neck and head include convolutional blocks. The input layer is shifted by a factor of 2 for the purpose of shifting. n (For example, 2 24 ) The biases for convolutional and batch normalization layers are scaled by the same factor 2 used to scale the input layer. n (For example, 2 24) The output may be scaled by the same factor 2 used to scale the biases for the input layer, and the convolutional and batch normalization layers. 24 may be reduced by

[0120]

[0179] Figure 51 shows an example of which operations / layers in YOLO are log-quantized to convert the model into an NN2.0 model. The input to backbone5101 is a shift of 2 n For example, the factor is 2 24 However, the present disclosure provides a method for determining the coefficients such that the coefficients can be different values. 24 The examples are not intended to be limited to those of the backbone 5101, neck 5102, and / or head 5103. The backbone 5101, neck 5102, and / or head 5103 may include multiple layers (e.g., neural network layers) that process data. For example, some of the layers may include convolution layers, batch normalization layers, or LeakyReLU layers. Operations / layers that utilize multiplication and / or addition, such as convolution layers, batch normalization layers, and LeakyReLU layers, are logarithmically quantized to make the model an NN2.0 model. Other layers in the backbone, neck, and / or head are not logarithmically quantized because such other layers do not utilize multiplication and / or addition operations. For example, some of the other layers may include concatenation layers, upsample layers, or zero padding layers, which do not include multiplication to perform their respective operations, and therefore the concatenation layers, upsample layers, or zero padding layers are not logarithmically quantized. However, in some cases, other layers that do not use multiplication and / or addition operations may be logarithmically quantized. Layers that utilize multiplication and / or addition operations, such as but not limited to convolutional layers, dense layers, RNN, batch normalization, or LeakyReLU, are typically log-quantized to make the model an NN2.0 model. The output of the head may be scaled by the same factor used to scale the input to produce the same output value as the regular model. For example, the output of the head is scaled by 2 24 may be scaled down by a factor of .

[0121]

[0180] FIG. 52A and FIG. 52B show an example of how to convert a face detection model such as MTCNN to a log-quantized NN2.0 model according to an exemplary implementation. Specifically, FIG. 52A shows a standard architecture of an MTCNN model, while FIG. 52B shows layers of the MTCNN model that are log-quantized to convert the model to an NN2.0 model. FIG. 52A includes exemplary architectures of PNet, RNet, and ONet, and identifies layers within each architecture that can be log-quantized. For example, the convolutional layer and PReLU layer of PNet in FIG. 52A can be log-quantized, while the convolutional layer, PReLU layer, and dense layer of RNet and ONet in FIG. 52A can be log-quantized. Referring to FIG. 52B, the architectures of PNet, RNet, and ONet according to NN2.0 include log-quantized layers to convert the model of FIG. 52A to an NN2.0 model, in addition to resizing layers for input and output.

[0122]

[0181] FIG. 53A and FIG. 53B show an example of how to convert a face recognition model such as VGGFace to a log-quantized NN2.0 model according to an exemplary implementation. Specifically, FIG. 53A shows a VGGFace model of a standard architecture, while FIG. 53B shows layers of the VGGFace model that are log-quantized to convert the model to an NN2.0 model. FIG. 53A includes exemplary architectures of ResNet50 and ResBlock, and identifies layers within each architecture that can be log-quantized. For example, stack layers including the convolution layer, batch normalization layer, and ResBlock layer and ResBlock convolution layer of FIG. 53A can be log-quantized. Referring to FIG. 53B, the architectures of ResNet50 and ResBlock according to NN2.0 include log-quantized layers to convert the model of FIG. 53A to an NN2.0 model, in addition to resizing layers for input and output.

[0123]

[0182] Figure 54A and Figure 54B show an example of how to turn an autoencoder model into a logarithmically quantized NN2.0 model according to an exemplary implementation. Specifically, Figure 54A shows a standard architecture of an autoencoder model, while Figure 54B shows a layer of the autoencoder model that is logarithmically quantized to convert the model into an NN2.0 model. Figure 54A includes an example of the structure of an autoencoder layer and identifies layers that can be logarithmically quantized. For example, the dense layers in the encoder and decoder of Figure 54A can be logarithmically quantized. With reference to Figure 54B, the autoencoder layer according to NN2.0 includes a logarithmically quantized layer to convert the model of Figure 54A into an NN2.0 model in addition to the resizing layers for input and output.

[0124]

[0183] FIG. 55A and FIG. 55B show an example of how to convert a dense neural network model into a logarithmically quantized NN2.0 model according to an exemplary implementation. Specifically, FIG. 55A shows a standard architecture of a dense neural network model, while FIG. 55B shows layers of the dense neural network model that are logarithmically quantized to convert the model into an NN2.0 model. FIG. 55A includes an example of the structure of a dense neural network model layer, and identifies layers that can be logarithmically quantized. For example, the dense layer in the architecture of the model of FIG. 55A can be logarithmically quantized. Referring to FIG. 55B, the model layer according to NN2.0 includes a logarithmically quantized layer to convert the model of FIG. 55A into an NN2.0 model, in addition to the resizing layers for input and output.

[0125]

[0184] FIG. 56 illustrates an example of a standard binary multiplication occurring in hardware according to an exemplary implementation. The exemplary multiplication occurring in hardware may use binary numbers. For example, as shown in FIG. 56, data 5601 may have a value of 6 and parameter 5602 may have a value of 3. Data 5601 and parameter 5602 are 16-bit data such that 16-bit parameter data is input and multiplied by a 16x16 multiplier using multiplier 5603, which generates a 32-bit number 5604. The 32-bit number may be truncated using truncation operation 5605 to generate a 16-bit number 5606 if desired. The 16-bit number 5606 has a value of 18.

[0126]

[0185] 57 and 58 show an example of a shift operation of NN2.0 according to an exemplary implementation. Specifically, FIG. 57 shows an example of a shift operation of NN2.0, and FIG. 58 shows an exemplary flow of the shift operation of NN2.0.

[0127]

[0186] In 5801, the flow resizes the data by a data scaling factor. In the example of Figure 57, the input data 5701 may have a value of 6, and the input data is scaled by a scaling factor of 2. 10 The input data 5701 is scaled by a data scaling factor of 2. The data scaling factor may generate the scaled data. Other data scaling factors may be used and the disclosure is not intended to be limited to the examples provided herein. The input data 5701 is scaled by a data scaling factor of 2. 10 resulting in resized data having a value of 6,144. The 16-bit binary representation of the resized data is 0001100000000000.

[0128]

[0187] At 5802, the flow shifts the resized data based on shift instructions derived from the log-quantized parameters. In the example of FIG. 57, parameter 5702 has a value of 3, and to generate shift instructions to shift the resized data, parameter 5702 is log-quantized. Parameter 5702 is log-quantized, and the way to log-quantize a value of +3 is log-quantize(+3)=>+2. round(log 2 (3)) =+2 round(+1.5649) +2 (+2) =+4.

[0129]

[0188] The shifting in 5802 is performed according to a shift instruction provided to the shifter 5709. The shift instruction may include one or more of a sign bit 5704, a shift direction 5705, and a shift amount 5706. The shift instruction 5703 derived from the logarithmically quantized parameter is presented as 6 bits of data, where the sign bit 5704 is the most significant bit of the shift instruction 5703, the shift direction 5705 is the second most significant bit, and the shift amount 5706 is the remaining 4 bits of the shift instruction 5703. The sign bit 5704 having a value of 0 or 1 is based on the sign of the logarithmically quantized parameter. For example, a sign bit 5704 having a value of 0 indicates a positive sign of the logarithmically quantized parameter. A sign bit 5704 having a value of 1 indicates a negative sign of the logarithmically quantized parameter. In the example of FIG. 57, the parameter +3 has a positive sign such that the sign bit 5704 has a value of 0. The shift direction 5705 having a value of 0 or 1 is based on the sign of the exponent of the logarithmically quantized parameter. For example, the shift direction 5705 having a value of 0 is based on the exponent having a positive sign corresponding to a left shift direction. The shift direction 5705 having a value of 1 is based on the exponent having a negative sign corresponding to a right shift direction. In the example of FIG. 57, the exponent of the logarithmically quantized parameter (+2) has a positive sign such that the shift bit 5705 has a value of 0 corresponding to a left shift direction. The shift amount 5706 is based on the magnitude of the exponent of the logarithmically quantized parameter. In the example of FIG. 57, the exponent has a magnitude of 2 such that the shift amount 5706 is 2. The shift amount 5706 consists of the last 4 bits of the shift instruction 5703 such that a shift amount 5706 of 2 corresponds to 0010. With the shift direction 5705 and shift amount 5706 determined, a shift may be applied to the resized data. The resized data, the shift direction, and the shift amount are provided to a shifter 5709. Since the resized data is represented as 16-bit data, shifter 5709 may be a 16-bit shifter as shown in this example.Shifter 5709 applies a shift operation based on shift direction 5705 (leftward) and shift amount 5706 (2) to generate a shifted value 5710 of 01100000000000000, which corresponds to 24,576. A mathematically equivalent operation to the illustrated shift operation, utilizing multiplication, is as follows: the resized data has a value of 6,144, the logarithmic quantized value of parameter +3 is +4, and the product of 6,144 x 4 = 24,576. NN2.0's shift operation obtains the same result by shifting, without the use of a multiplication operation.

[0130]

[0189] At 5803, the flow performs an XOR operation on the sign bit of the data and the sign bit from the shift instruction to determine the sign bit of the shifted value. In the example of Figure 57, the sign bit 5707 of the data has a value of 0 and the sign bit 5704 from the shift instruction has a value of 0. Both values ​​are input into XOR 5708 such that the sign bit 5711 of the shifted value 5710 has a value of 0, resulting in a 0 XOR 0.

[0131]

[0190] At 5804, the flow sets the sign bit of the shifted value. Sign bit 5711 of shifted value 5710 is based on the result of XOR 5708. In the example of Figure 57, the result of XORing sign bit 5704 and sign bit 5707 is 0, such that sign bit 5711 is set to 0.

[0132]

[0191] FIG. 59 shows an example of a shift operation of NN2.0 according to an exemplary implementation. The flow of the shift operation of NN2.0 in FIG. 59 is consistent with the flow in FIG. 58. The example in FIG. 59 includes parameter values ​​that are different from the parameter values ​​in the example in FIG. 57. For example, parameter 5902 in FIG. 59 has a value of −0.122, which is log-quantize(−0.122)=−2 round(log 2 (0.122)) =-2 round(-3.035) =-2 (-3)=-0.125. As a result, due to the sign of the logarithmically quantized parameter, the sign bit 5904 has a value of 1, and due to the sign of the exponent of the logarithmically quantized parameter, the shift direction 5905 has a value of 1. Due to the exponent having a magnitude of 3, the shift amount is 3. The shift amount 5906 is in binary form within the last 4 bits of the logarithmically quantized parameter 5903. The shift direction 5905, the shift amount 5906, and the scaled data 5901 are input to a shifter 5909 to apply the shift amount and shift direction to the scaled data to generate a shifted value 5910 of -768. The shifted value 5910 has a negative sign due to the XOR of the sign bit 5904 and the sign bit 5907 resulting in a value of 1 for the sign bit 5911. A sign bit 5911 with a value of 1 results in a shifted value 5910 with a negative sign, such that the shifted value 5910 has a value of -768. 10 = 6,144, and the logarithmically quantized value of the parameter is -2 (-3) =-0.125. The product of the rescaled data and the logarithmically quantized parameters is 6,144x-0.125=-768. The shifted value 5910 has a value of -768 obtained using a shifter, not by using a multiplication. The shift operation in NN2.0 obtains the same result by shifting, without using a multiplication operation.

[0133]

[0192] 60 and 61 show an example of a shift operation of NN2.0 using two's complement data according to an exemplary implementation. Specifically, FIG. 60 shows an example of a shift operation of NN2.0 using two's complement data, and FIG. 61 shows an exemplary flow of a shift operation of NN2.0 using two's complement data.

[0134]

[0193] At 6101, the flow resizes the data by a data scaling factor. In the example of FIG. 60, the input data 6001 may have a value of 6, and the input data is scaled by a scaling factor of 2. 10The data scaling factor may generate data that is represented as 16-bit data. Other data scaling factors may be used, and the disclosure is not intended to be limited to the examples provided herein. The input data 6001 is scaled by a data scaling factor of 2 10 , resulting in resized data with a value of 6,144. The 16-bit resized data represented as a binary number is 00011000000000000.

[0135]

[0194] At 6102, the flow performs an arithmetic shift of the resized data based on the shift instruction. In the example of FIG. 60, the parameter 6002 has a value of 3, and in order to generate a shift instruction to shift the resized data, the parameter 6002 is log-quantized. The parameter 6002 is log-quantized, and the way to log-quantize a value of +3 is log-quantize(+3)=>+2 round(log 2 (3)) =+2 (+2)=+4. The shift instruction 6003 derived from the logarithmically quantized parameter is presented as 6 bits of data, where the sign bit 6004 is the most significant bit of the shift instruction 6003, the shift direction 6005 is the second most significant bit, and the shift amount 6006 is the remaining 4 bits of the logarithmically quantized parameter. The sign bit 6004 having a value of 0 or 1 is based on the sign of the logarithmically quantized parameter. For example, the sign bit 6004 having a value of 0 indicates a positive sign of the logarithmically quantized parameter. The sign bit 6004 having a value of 1 indicates a negative sign of the logarithmically quantized parameter. In the example of FIG. 60, the parameter +3 has a positive sign, such that the sign bit 6004 has a value of 0. The shift direction 6005 having a value of 0 or 1 is based on the sign of the exponent of the logarithmically quantized parameter. For example, the shift direction 6005 having a value of 0 is based on the exponent having a positive sign corresponding to a left shift direction. The shift direction 6005, which has a value of 1, is based on the exponent, which has a negative sign corresponding to a right shift direction. In the example of FIG. 60, the exponent (2) of the logarithmically quantized parameter has a positive sign, such that the shift bit 6005 has a value of 0 corresponding to a left shift direction. The shift amount 6006 is based on the magnitude of the exponent of the logarithmically quantized parameter. In the example of FIG. 60, the exponent has a magnitude of 2, such that the shift amount 6006 is 2. The shift amount 6006 consists of the last 4 bits of the shift instruction data 6003, such that a shift amount 6006 of 2 corresponds to 0010. With the shift direction 6005 and shift amount 6006 determined, a shift may be applied to the resized data. The resized data, the shift direction, and the shift amount are provided to an arithmetic shifter 6009. Because the resized data is represented as 16-bit data, the arithmetic shifter 6009 may be a 16-bit arithmetic shifter as shown in this example. The arithmetic shifter 6009 applies a shift operation based on the shift direction 6005 (leftward) and the shift amount 6006 (2) to generate a shifted value 6010 of 0110000000000000.

[0136]

[0195] At 6103, the flow performs an XOR operation on the shifted data with the sign bit from the shift instruction. In the example of FIG. 60, the sign bit 6004 has a value of 0 which is fed to an XOR 6011 with the shifted value 6010 (the output of the arithmetic shifter 6009). The result of the XOR operation of the sign bit 6004 and the shifted value 6010 results in a shifted value 6012. In the example of FIG. 60, because the sign bit 6004 has a value of 0, the shifted value 6012 is unchanged from the shifted value 6010 as a result of the XOR operation of the sign bit 6004 and the shifted value 6010.

[0137]

[0196] At 6104, the flow increments the value of the XOR result by 1 if the sign bit from the shift instruction is 1. In the example of Figure 60, the shifted value 6012 is input to an incrementer (e.g., +1 or 0), which is supplied with the sign bit 6004. The sign bit 6004 of the shift instruction is 0 so that the flow does not increment the XOR result shifted value 6012, resulting in a shifted value 6013.

[0138]

[0197] FIG. 62 illustrates an example of a shift operation of NN2.0 using two's complement data, according to an exemplary implementation. The flow of the shift operation of NN2.0 in FIG. 62 is consistent with the flow in FIG. 61. The example in FIG. 62 includes a different shift instruction than the shift instruction in the example in FIG. 60. For example, parameter 6202 in FIG. 62 has a value of −0.122, and this value is log-quantized to generate a shift instruction to shift the resized data. Parameter 6202 is log-quantized, and the way to log-quantize a value of −0.122 is log-quantize(−0.122)=>−2 round(log 2 (0.122)) =2 round(-3.035) =-2 (-3)=0.125. The shift instruction derived from the logarithmically quantized parameters 6203 is presented as 6 bits of data, where the sign bit 6204 is the most significant bit of the shift instruction 6203, the shift direction 6205 is the second most significant bit, and the shift amount 6206 is the remaining 4 bits of the logarithmically quantized parameters 6203. Due to the negative sign of the logarithmically quantized parameters, the sign bit 6204 has a value of 1, and due to the sign of the exponent of the logarithmically quantized parameters, the shift direction 6205 has a value of 1. Due to the exponent having a magnitude of 3, the shift amount is 3. The shift amount 6206 is based on the magnitude of the exponent of the logarithmically quantized parameters. In the example of FIG. 62, the exponent has a magnitude of 3, such that the shift amount 6206 is 3. The shift amount 6206 is in binary form in the last 4 bits of the shift instruction 6203, such that a shift amount 6206 of 3 corresponds to 0011. The shift direction, shift amount, and scaled data are input to a 16-bit arithmetic shifter 6209 to apply the shift amount and shift direction to the scaled data 6201 to generate a shifted value 6210 of 0000001100000000. The shifted value 6210 and the sign bit 6204 from the shift instruction are input to an XOR 6211. The result of the XOR operation of the sign bit 6204 and the shifted value 6210 results in a shifted value 6212. The output of the XOR result (e.g., shifted value 6212) and the sign bit are input to an incrementer (e.g., +1 or 0). If the sign bit of the shift instruction is 1, the incrementer may increment the shifted value 6212 by 1. In the example of FIG. 62, the sign bit 6204 of the shift instruction is 1 such that the shifted value 6212 is incremented by 1 due to the sign bit of the shift instruction having a value of 1. As a result, the shifted value 6212 is incremented to generate a shifted value 6213 of 0000001100000000. The shifted value 6213 has a value of -768. The resized data is 6x2 10 = 6,144, and the logarithmically quantized parameter is -2 (-3)=-0.125. The product of the rescaled data and the logarithmically quantized parameters is 6,144x-0.125=-768. The shifted value 6212 has a value of -768 obtained using a shifter, not by using a multiplication. The shift operation in NN2.0 obtains the same result by shifting, without using a multiplication operation.

[0139]

[0198] Figures 63 and 64 show an example of an accumulation / addition operation of NN2.0, in which an addition operation can be replaced with a shift operation according to an exemplary implementation. Specifically, Figure 63 shows an example of an accumulation / addition operation of NN2.0, and Figure 64 shows an exemplary flow of an accumulation / addition operation of NN2.0. The accumulation operation of NN2.0 may utilize a shift operation to perform accumulation or addition of N signed magnitude data using two separate sets of shifters: a positive accumulation shifter for positive numbers and a negative accumulation shifter for negative numbers.

[0140]

[0199] At 6401, the flow divides the size portion of the data into multiple segments. In the example of FIG. 63, the size portion of the data 6301 is divided into six 5-bit segments designated as seg1 through seg6. However, in some cases, the size portion of the data can be divided into multiple segments, and this disclosure is not intended to be limited to six segments. The 30th bit may be reserved for future use, the 31st bit is a sign bit 6304, while the remaining bits include the six 5-bit segments and the reserved 30th bit.

[0141]

[0200] At 6402, the flow inputs each segment into both the positive and negative accumulation shifters. In the example of FIG. 63, the first segment (seg1) of the first data string (first data) is input into the positive accumulation shifter 6302 and the negative accumulation shifter 6303. The other segments (seg2-seg6) have the same positive and negative accumulation shifter structures as segment 1. Alternatively, there can be an architecture where all six segments share the same positive and negative accumulation shifters, along with appropriate buffers to store intermediate results of the shift operations of all segments.

[0142]

[0201] In 6403, the flow determines to perform a shift operation based on the sign bit. In the example of FIG. 63, the sign bit 6304 is utilized by the shifters 6302 and 6303 to determine the shift operation. For example, if the sign bit 6304 has a value of 0 corresponding to a positive number, a positive accumulate shift operation is performed. If the sign bit 6304 has a value of 1 corresponding to a negative number, a negative accumulate shift operation is performed. Each data (data #1, data #2, ... data #N) has a corresponding sign bit 6304.

[0143]

[0202] At 6404, the flow shifts the data by the shift amount represented by the segment value. At the start of an operation, the shifter receives a constant 1 as an input to the shifter. The shifter then receives the output of the shifter as the input to the shifter for all subsequent operations.

[0144]

[0203] At 6405, the flow continues the process of 6401-6404 for each segment and data column until all data has been processed.

[0145]

[0204] Figures 65 and 66 show an example of overflow processing of an addition operation of NN2.0 using a shift operation according to an exemplary implementation. Specifically, Figure 65 shows an example of overflow processing of an addition operation of NN2.0 using a shifter, and Figure 66 shows an exemplary flow of overflow processing of an addition operation of NN2.0 using a shifter.

[0146]

[0205] 65. In the example of FIG. 65, the overflow signal from the shifter 6501 is input to the overflow counter 6502.

[0147]

[0206] In 6602, if the seg1 overflow counter reaches its maximum value, the flow inputs the output of the seg1 overflow counter as a shift amount to the seg2 shifter to shift the data of seg2 based on the overflow counter value from the seg1 overflow counter. In the example of Figure 65, the data from the overflow counter 6502 is input to the seg1 overflow 6503, and if the seg1 overflow 6503 reaches its maximum value, the output of the seg1 overflow 6503 is received as an input by the shifter 6504. The shifter 6504 uses the input from the seg1 overflow 6503 as a shift amount to shift the data of seg2 by an amount corresponding to the overflow counter value provided by the seg1 overflow 6503.

[0148]

[0207] In 6603, if the seg2 overflow counter reaches its maximum value, the flow inputs the output of the seg2 overflow counter as a shift amount to the seg3 shifter to shift the data of seg3 based on the overflow counter value from the seg2 overflow counter. In the example of FIG. 65, data from the overflow counter 6505 is input to the seg2 overflow 6506, and if the seg2 overflow 6506 reaches its maximum value, the output of the seg2 overflow 6506 is received as an input by a third shifter (not shown). The third shifter uses the input from the seg2 overflow 6506 as a shift amount to shift the data of seg3 by an amount corresponding to the overflow counter value provided by the seg2 overflow 6506.

[0149]

[0208] At 6604, the flow determines whether all segments of data have been processed. If not, the process of 6601-6603 repeats until all segments of data have been processed.

[0150]

[0209] FIG. 67 and FIG. 68 show an example of a segment assembly operation of NN2.0 according to an example implementation. Specifically, FIG. 67 shows an example of a segment assembly operation of NN2.0, and FIG. 68 shows an example flow of a segment assembly operation of NN2.0. The segment assembly operation may assemble the output of an accumulation operation of six segments. At 6801, after the shift of the accumulation is performed, the flow converts the output data, which is a one-hot binary number, into an encoded binary number. For example, the output data 6701-1 may include 32-bit one-hot data, which is converted into a 5-bit encoded binary number 6702-1. The output one-hot data of each of the six segments is converted into a 5-bit encoded binary number. In the example of FIG. 67, the conversion of the first, second, fifth, and sixth segments is shown, but the conversion of the third and fourth segments is not shown. At 6802, the flow concatenates the segments into 30-bit data 6703. The six segments are concatenated to form 30-bit data, and the placement of the segments within the 30-bit data is ordered based on the segment number. For example, the first 5-bit binary number 6702-1 is placed in the 0-4 bit number positions, followed by the second 5-bit binary number 6702-2, then the third, then the fourth, then the fifth 6702-5, and ending with the sixth 5-bit binary number 6702-6 at the end of the 30-bit data. At 6803, the flow concatenates the sign bit 6704 and the 30th bit 6705 to the 30-bit data 6703. The combination of the sign bit 6704, the 30th bit 6705, and the six segments forming the 30-bit data 6703 forms the 32-bit data 6706. The example in FIG. 67 illustrates the formation of the 32-bit data 6706 for the "Assemble of Accumulation of +". A similar procedure occurs for "Assembling Accumulations of -," but is not shown here to reduce redundant description. At 6804, the flow performs segment assembly.As shown in FIG. 69, after the segment assembly procedures for “accumulation of +” and “accumulation of-” are performed, the data from “accumulation of +” and “accumulation of-” (6901, 6902) are input to adder 6903 and added together to form the final data.

[0151]

[0210] 70 and 71 show an example of an NN2.0 accumulate / add operation, in which an add operation can be replaced with a shift operation, according to an exemplary implementation. Specifically, FIG. 70 shows an example of an NN2.0 accumulate / add operation, and FIG. 71 shows an exemplary flow of an NN2.0 accumulate / add operation. The NN2.0 accumulate operation may utilize a shift operation to perform accumulation or addition of N signed magnitude data using one set of shifters that can shift both right and left for both positive and negative data.

[0152]

[0211] At 7101, a flow divides a size portion of data into multiple segments. In the example of FIG. 70, the size portion of data 7001 is divided into six 5-bit segments designated as seg1 through seg6. However, in some cases, a size portion of data can be divided into multiple segments, and this disclosure is not intended to be limited to six segments. The 30th bit may be reserved for future use, the 31st bit is a sign bit 7003, while the remaining bits include the six 5-bit segments and the reserved 30th bit.

[0153]

[0212] At 7102, the flow inputs each segment into a shifter. In the example of Figure 70, a segment of data 7001 is input into shifter 7002. The other segments (seg2-seg6) have the same shifter structure as segment 1. Alternatively, there can be an architecture where all six segments share the same shifter, along with appropriate buffers to store intermediate results of the shift operations of all segments.

[0154]

[0213] At 7103, the flow determines to perform a shift operation based on the sign bit. In the example of Figure 70, the sign bit 7003 is used by the shifter 7002 to determine the shift direction. For example, if the sign bit 7003 has a value of 0, the data is shifted to the left. If the sign bit 7003 has a value of 1, the data is shifted to the right.

[0155]

[0214] At 7104, the flow shifts the data by the shift amount represented by the segment value. At the start of an operation, the shifter receives a constant 1 as an input to the shifter. The shifter then receives the output of the shifter as the input to the shifter for all subsequent operations.

[0156]

[0215] At 7105, the flow continues with processes 7101 through 7104 until all input data has been processed.

[0157]

[0216] FIG. 72 illustrates an example of a general architecture of an AI processing element (AIPE) according to an exemplary implementation. The AIPE is configured to process multiple neural network operations such as, but not limited to, convolution, dense layer, ReLU, leaky ReLU, max pooling, addition, and / or multiplication. The AIPE may include various components, such as a shifter circuit 7201 that receives data 7202 and parameters 7203 as input. The AIPE may include an adder or shifter circuit 7204 that receives the output of the shifter circuit 7201 as input. The AIPE may include a register circuit, such as a flip-flop 7205 that receives the output of the adder or shifter circuit 7204 as input. The output of the register circuit, such as the flip-flop 7205, along with the data 7202 and parameters 7203, are fed back and multiplexed into the AIPE.

[0158]

[0217] As shown in FIG. 72, the AIPE may include at least a shifter circuit 7201 configured to take a shiftable input 7206 derived from input data (M1, M2) of a neural network operation, take a shift instruction 7207 derived from a corresponding logarithmically quantized parameter 7203 of the neural network or a constant value such as a constant 0 as shown in FIG. 72, and shift the shiftable input leftward or rightward according to the shift instruction 7207 (e.g., as shown in FIGS. 57-63) to form a shifted output 7208 (Mout) representing a multiplication of the input data with the corresponding logarithmically quantized parameter of the neural network. Such a shifter circuit 7201 may be any shifter circuit known in the prior art, such as, but not limited to, a logarithmic shifter circuit or a barrel shifter circuit. As described herein, the input data may be resized to form the shiftable input 7206 according to the flows shown in FIG. 37 and FIG. 38. Such flows may be performed by a dedicated circuit, by a computing device, or by any other desired implementation.

[0159]

[0218] In an example implementation shown in Figures 57-62 based on the architecture of Figure 72, a shift instruction may include a shift direction (e.g., 5705, 5905, 6005, 6205) and a shift amount (e.g., 5706, 5906, 6006, 6206), where the shift amount is derived from the magnitude of the exponent of the corresponding log quantized parameter (e.g., 5702, 5902, 6002, 6202) and the shift direction is derived from the sign of the exponent of the corresponding log quantized parameter, and a shifter circuit shifts the shiftable input leftward or rightward according to the shift direction and shifts the shiftable input in the shift direction by an amount indicated by the shift amount shown in, for example, 5710, 5910, 6010, and 6210.

[0160]

[0219] Although an exemplary implementation utilizes shift instructions derived from logarithmically quantized parameters as described herein, the disclosure is not so limited and other implementations are possible. For example, if necessary, a shift instruction for shifting a scaled parameter (e.g., scaled from a floating-point parameter, an integer parameter, or otherwise) may be derived from data as input. In such an exemplary implementation, if a logarithmically quantized data value is available, a shift instruction can be derived from the logarithmically quantized data value as well. For example, to generate a shift instruction to shift a scaled parameter value, a shift amount can be derived from the magnitude of the exponent of the corresponding logarithmically quantized data value, and a shift direction can be derived from the sign of the exponent of the corresponding logarithmically quantized value. Such an implementation is possible because the operation of shifting a value by a shift instruction derived from a logarithmically quantized value is equivalent to multiplying the data and the parameter.

[0161]

[0220] In an exemplary implementation based on the architecture of FIG. 72 and the exemplary implementations of FIGS. 57-62, the AIPE may further include a circuit such as an XOR circuit (e.g., 5708, 5908) or any equivalent configured to take the first sign bit (5707, 5907) of the shiftable input and the second sign bit (e.g., 5704, 5904) of the corresponding logarithmically quantized parameter and form the third sign bit (e.g., 5711, 5911) of the shifted output.

[0162]

[0221] In an exemplary implementation based on the architecture of FIG. 72 as expanded in the examples of FIG. 73 and FIG. 74, and in the exemplary implementations of FIG. 57-FIG. 64, the AIPE may further comprise a first circuit, such as an XOR circuit (e.g., 6011, 6211, 7311) or equivalent, configured to take the shifted output (e.g., 6010, 6210, 7310) and a corresponding sign bit of one of the logarithmically quantized parameters (e.g., 6004, 6204, 7306) to form one's complement data (e.g., 7405, 7406), and a second circuit, such as an incrementer / adder circuit (7204, 7302) configured to increment the one's complement data by the sign bit of the corresponding logarithmically quantized parameter and change the one's complement data to two's complement data (e.g., 7405, 7406) representing the multiplication of the input data with the corresponding logarithmically quantized parameter.

[0163]

[0222] In an exemplary implementation based on the architecture of Figure 72 and expanded in the examples of Figures 73-82, an AIPE can include a circuit such as a multiplexer 7210 or any equivalent configured to take an output of a neural network operation and provide shiftable inputs from the output of the neural network operation (e.g., M2) or from resized input data (e.g., 7202, M1) generated from the input data of the neural network operation according to a signal input (s1) to a shifter circuit 7201. Such a circuit (e.g., multiplexer 7210) can take a control signal (s1) to control which of the inputs to the circuit are provided to the shifter circuit 7201.

[0164]

[0223] In an exemplary implementation based on the architecture of FIG. 72 and expanded in the examples of FIGS. 73-82, the AIPE may include circuitry such as a multiplexer 7211 configured to provide a shift instruction derived from a corresponding logarithmically quantized parameter (e.g., K) of the neural network or a constant value (e.g., the constant 0) according to a signal input (s2).

[0165]

[0224] In an exemplary implementation based on the architecture of Figure 72 and expanded in the examples of Figures 73-82, an AIPE may comprise an adder circuit 7204, 7302 coupled to a shifter circuit, where the adder circuit 7204, 7302, 7608 is configured to sum based on the shifted outputs to form the output (e.g., Out, aout) of the neural network operation. Such adder circuit 7204, 7302, 7608 may take the form of one or more shifters, integer adder circuits, floating point adder circuits, or any equivalent circuitry, according to a desired implementation.

[0166]

[0225] In an exemplary implementation based on the architecture of FIG. 72 and expanded in the examples of FIGS. 73-82, the adder circuits 7204, 7302, 7608 are configured to add the shifted output to a corresponding one of multiple bias parameters 7305 of the trained neural network to form an output (aout) of the neural network operation.

[0167]

[0226] In an exemplary implementation based on the architecture of FIG. 72 and expanded in the exemplary implementations of FIGS. 62-72, the AIPE may comprise another shifter circuit 7204 and a register circuit, such as an output flip-flop 7205 and / or a multiplexer 7209 or equivalent, coupled to the another shifter circuit 7204 that latches an output (Out) from the another shifter circuit 7204. For example, as shown in FIG. 70, the another shifter circuit 7204 is configured to take a sign bit S associated with the shifted output and each segment of the shifted output, and shift the another shifter circuit input left or right based on the sign bit to form an output from the another shifter circuit.

[0168]

[0227] In an exemplary implementation based on the architecture of FIG. 72 and expanded in the exemplary implementations of FIG. 62-FIG. 72, the AIPE may include a counter such as an overflow counter (e.g., 6502, 6505) configured to capture an overflow or underflow (e.g., 6503, 6506) from another shifter circuit resulting from the shifting of another shifter circuit input by the shifter circuit, and another shifter circuit configured to capture the overflow or underflow from each segment and shift the subsequent segment left or right depending on the amount of overflow or underflow, as shown in FIG. 65 and FIG. 70. Such a counter may be implemented according to a desired implementation using any circuit as known in the prior art.

[0169]

[0228] In an example implementation based on the architecture of Figure 72, the AIPE may include a one-hot-to-binary encoding circuit, such as circuit 6710 providing the functionality of Figures 67 and 70, or any equivalent. The one-hot-to-binary encoding circuit is configured to take the latched outputs to generate an encoded output, and to concatenate the encoded outputs from all segments and sign bits from the results of the overflow or underflow operations to form the output of the neural network operations (6701-6706).

[0170]

[0229] In an exemplary implementation based on the architecture of FIG. 72 , the AIPE includes a positive accumulation shifter circuit 6302 including a second shifter circuit configured to take each segment of the shifted output and shift the positive accumulation shifter circuit input left when a sign bit associated with the shift instruction indicates a positive sign, the second shifter circuit coupled to a first register circuit configured to latch the shifted positive accumulation shifter circuit input from the second shifter circuit as a first latched output, the first register circuit configured to provide the first latched output as the positive accumulation shifter circuit input upon receipt of a signal indicating that the neural network operation is not complete; and a negative accumulation shifter circuit 6302 including a second shifter circuit configured to take each segment of the shifted output and shift the positive accumulation shifter circuit input left when a sign bit associated with the shift instruction indicates a positive sign, the second shifter circuit coupled to a first register circuit configured to latch the shifted positive accumulation shifter circuit input from the second shifter circuit as a first latched output, the first register circuit configured to provide the first latched output as the positive accumulation shifter circuit input upon receipt of a signal indicating that the neural network operation is not complete. The negative accumulation shifter circuit 6303 may include a third shifter circuit configured to shift the circuit input to the left, the third shifter circuit coupled to a second register circuit configured to latch the shifted negative accumulation shifter circuit input from the third shifter circuit as a second latched output, the second register circuit configured to provide the second latched output as the negative accumulation shifter circuit input upon receipt of a signal indicating that the neural network operation is not complete; and an adder circuit 6903 configured to add based on the first latched output 6901 from the positive accumulation shifter circuit and the second latched output 6902 from the negative accumulation shifter circuit to form an output of the neural network operation upon receipt of a signal indicating that the neural network operation is complete.

[0171]

[0230] In an exemplary implementation based on the architecture of FIG. 72 and expanded in the example of FIG. 81, when the neural network operation is a parametric ReLU operation, the shifter circuit 8107 is configured to provide the shiftable input as a shifted output without performing a shift if the sign bit of the shiftable input is positive.

[0172]

[0231] FIG. 73 illustrates an example of an AIPE including an arithmetic shift architecture, according to an exemplary implementation. The AIPE of FIG. 73 utilizes an arithmetic shifter 7301 and an adder 7302 to process neural network operations such as, but not limited to, convolution, dense layer, ReLU, parametric ReLU, batch normalization, max pooling, addition, and / or multiplication. The arithmetic shifter 7301 receives as input data 7303 and a shift instruction 7304 derived from logarithmic quantization of parameters. The data 7303 may include 32-bit data based on two's complement, while the shift instruction 7304 may include 7-bit data. The arithmetic shifter 7301 may include a 32-bit arithmetic shifter. The arithmetic shifter 7301 shifts the data 7303 based on the shift instruction 7304. The output of the arithmetic shifter 7301 passes through a circuit that makes the output two's complement data and is then added to a bias 7305. Bias 7305 may include a 32-bit bias. Adder 7302 receives three inputs: the output of multiplexer (mux) M3, and the output of XOR 7311, and one carry-in input (Ci) from the sign bit 7306 of the shift instruction 7304. The adder adds the two inputs and the carry-in input together to form an output aout that goes into mux M4. The output of mux M4 is latched by flip-flop 7307. The output of flip-flop 7307 can then be fed back to mux M1 for another neural network operation, and the sign bit of ffout from flip-flop 7307 can be used to OR circuit 7312 to control mux M2 to select between the shift instruction 7304 or a constant 1.

[0173]

[0232] FIG. 74 illustrates an example of the operation of AIPE using shifters and adders according to an exemplary implementation. AIPE replaces multiplications using shift operations. For example, if data 7401 has a value of 12 and a shift instruction 7402 derived from a logarithmically quantized parameter has a value of +2, the multiplication of this data and shift instruction is 12x(+2), and this multiplication is 12x(+2+1 ), and (+2 +1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is positive (+), which means that the shift direction is left, and the magnitude of the exponent is 1, which means that the shift amount is 1. Therefore, data 12 is shifted to the left by 1. Shifting data 12 to the left by 1 results in 24, as shown in 7403 in FIG. 74. In another example, data 7401 has a value of 12, and shift instruction 7402 has a value of +0.5. The multiplication of this data and shift instruction is 12x(+0.5), and this multiplication is 12x(+2 -1 ), and (+2 -1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is negative (-), which means that the shift direction is right, and the magnitude of the exponent is 1, which means that the shift amount is 1. Therefore, data 12 is shifted to the right by 1. Shifting data 12 to the right by 1 gives 6, as shown in 7404 in FIG. 74. In another example, data 7401 has a value of 12, shift instruction 7402 has a value of -2, and the multiplication of this data and shift instruction is 12x(-2), which multiplication is 12x(-2 +1 ), and (-2 +1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is positive (+), which means the shift direction is left, and the magnitude of the exponent is 1, which means the shift amount is 1. Therefore, the data 12 is shifted to the left by 1. However, since the base of this parameter has a negative value, a two's complement procedure occurs on the shifted value, resulting in -24, as shown in 7405 of Figure 74. In another example, data 7401 has a value of 12 and shift instruction 7402 has a value of -0.5. The multiplication of this data and shift instruction is 12x(-0.5), and this multiplication is 12x(-0.5). -1 ), and may be written as (-0.5 -1) is the logarithmically quantized parameter. The sign of the exponent of this parameter is negative (-), which means that the shift direction is right, and the magnitude of the exponent is 1, which means that the shift amount is 1. Therefore, the data 12 is shifted to the right by 1. However, because the base of this parameter has a negative value, a two's complement procedure occurs on the shifted value, and -6 is obtained, as shown in 7406 of FIG.

[0174]

[0233] FIG. 75 illustrates an example of the operation of AIPE using shifters and adders according to an exemplary implementation. AIPE replaces multiplications with shift operations. For example, if data 7501 has a value of −12 and a shift instruction 7502 derived from a logarithmically quantized parameter has a value of +2, the multiplication of this data and shift instruction is −12x(+2), and this multiplication is −12x(+2 +1 ), and (+2 +1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is positive (+), which means that the shift direction is left, and the magnitude of the exponent is 1, which means that the shift amount is 1. Therefore, the data -12 is shifted to the left by 1. Shifting the data -12 to the left by 1 results in -24, as shown in 7503 of FIG. 75. In another example, data 7501 has a value of -12, and shift instruction 7502 has a value of +0.5. The multiplication of this data and shift instruction is -12x(+0.5), and this multiplication is -12x(+2 -1 ), and (+2 -1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is negative (-), which means that the shift direction is right, and the magnitude of the exponent is 1, which means that the shift amount is 1. Therefore, the data -12 is shifted to the right by 1. Shifting the data -12 to the right by 1 gives -6, as shown in 7504 of FIG. 75. In another example, data 7501 has a value of -12, and shift instruction 7502 has a value of -2, and the multiplication of this data and shift instruction is -12x(-2), and this multiplication is -12x(-2 +1), and (-2 +1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is positive (+), which means the shift direction is left, and the magnitude of the exponent is 1, which means the shift amount is 1. Therefore, the data -12 is shifted to the left by 1. However, because the base of this parameter has a negative value, a two's complement procedure occurs on the shifted value, resulting in +24, as shown in 7505 of FIG. 75. In another example, data 7501 has a value of -12 and shift instruction 7502 has a value of -0.5. The multiplication of this data and shift instruction is -12x(-0.5), and this multiplication is -12x(-0.5 -1 ), and may be written as (-0.5 -1 ) is the logarithmically quantized parameter. The sign of the exponent of this parameter is negative (-), which means that the shift direction is right, and the magnitude of the exponent is 1, which means that the shift amount is 1. Therefore, the data -12 is shifted to the right by 1. However, because the base of this parameter has a negative value, a two's complement procedure occurs on the shifted value, and +6 is obtained, as shown at 7506 in FIG. 75.

[0175]

[0234] Figures 76, 77, and 78 show examples of AIPEs performing convolution operations according to example implementations. Specifically, Figure 76 shows an example of an AIPE architecture configured to perform convolution operations, Figure 77 shows an example flow for an initial cycle of the convolution operation, and Figure 78 shows an example flow for subsequent cycles of the convolution operation. The AIPE may perform the convolution operation using an arithmetic shifter.

[0176]

[0235] At 7701, during an initial cycle of a convolution operation, the flow reads data 7601 and a shift instruction 7602 derived from logarithmic quantization of the corresponding parameters. Data 7601 may include, by way of example, a number of data values ​​(X1, X2, ... X9). Shift instruction SH 7602 may be derived from parameter values ​​(K1, K2, ... K9) to form shift instructions (SH1, SH2, ... SH9) corresponding to each parameter value. In the example of FIG. 76, data 7601 and shift instruction 7602 have a value of 9, but the disclosure is not intended to be limited to the examples disclosed herein. Data 7601 and shift instruction 7602 may have one or more values. In an initial cycle of a convolution operation, the flow reads X1 into data 7601 and SH1 into shift instruction 7602.

[0177]

[0236] At 7702, the flow sets the control bit of data mux M1 and the control bit of parameter mux M2. The control bit 7603 of data 7601 may be set to 0. The control bit 7604 of the parameter may be set to 1.

[0178]

[0237] At 7703, the flow shifts the data by the shift instruction. The data 7601 and the shift instruction 7602 derived from the logarithmic quantized parameters are provided to an arithmetic shifter 7605, which shifts the data 7601 by a shift amount based on the shift instruction 7602. The output of the arithmetic shifter 7605 is then converted to two's complement data. The output of the arithmetic shifter 7605 is provided to an adder 7608. At this point, the output of the arithmetic shifter 7605 contains the value of the first cycle of the convolution process (X1*K1). However, the value of the first cycle of the convolution process is obtained using the arithmetic shifter 7605, not by using a multiplication operation. The convolution process is a sum of products of each data and parameter (X1*K1+X2*K2+...+X9*K9).

[0179]

[0238] At 7704, the flow reads a bias with a bias value and sets the control bit of bias mux M2. A bias 7606 with a bias value is read and a bias control bit 7607 is set to 1. The read bias 7606 with a bias value is provided to an adder 7608.

[0180]

[0239] At 7705, the flow processes the shifted data and the bias by an adder. The output of the arithmetic shifter 7605 or the shifted data is added to the bias 7606 by an adder 7608. In the first cycle of the convolution process, the bias is added.

[0181]

[0240] The flow captures the output of the adder at 7706. The output of the adder 7608 is sent to a flip-flop 7610 where it is captured.

[0182]

[0241] During subsequent cycles of the convolution operation, at 7801, the flow reads data and a shift instruction derived from logarithmically quantizing the parameters. For example, after the initial cycle, the flow reads data 7601 including X2 and a shift instruction 7602 including SH2 during the second cycle. During subsequent cycles, the output of the previous cycle is fed back to bias mux M3. For example, in the second cycle, the captured output of the adder of the first cycle is sent by flip-flop 7610 to bias mux M3 for input to adder 7608.

[0183]

[0242] At 7802, the flow sets the control bits of the data mux and the control bits of the parameter mux. The control bits 7603 of the data 7601 may be set to 0. The control bits 7604 of the parameter may be set to 1.

[0184]

[0243] At 7803, the flow shifts the data by the shift instruction. The data 7601 and the shift instruction 7602 derived from the logarithmic quantized parameters of the subsequent cycle are provided to an arithmetic shifter 7605, which shifts the data 7601 by a shift amount based on the shift instruction 7602. The output of the arithmetic shifter 7605 is then converted to two's complement. The output of the arithmetic shifter 7605 is provided to an adder 7608. At this point, the output of the arithmetic shifter 7605 contains the value of the second cycle of the convolution process (X2*K2). However, the values ​​of the second and subsequent cycles of the convolution process are obtained using the arithmetic shifter 7605, not by using a multiplication operation.

[0185]

[0244] At 7804, the flow sets the control bit of the bias mux. In the second cycle (and in subsequent cycles), the bias control bit 7607 is set to 0 so that the bias mux M3 selects the output of the previous operation fed back.

[0186]

[0245] At 7805, the flow processes the shifted data and the output of the bias mux by the adder. The output of the arithmetic shifter 7605 or the shifted data is added to the output of the bias mux by the adder 7608. However, in the second and subsequent cycles of the convolution process, the bias control bit 7609, which is set to 0, allows the feedback from flip-flop 7610 (the output of the adder from the previous cycle) to pass through multiplexer M4. So, at this point in the second cycle, the output of the adder from the first cycle is added to the output of the arithmetic shifter 7605 for the second cycle to comprise the sum of the products of the data and shift instructions from the first and second cycles of the convolution process (b+X1*SH1+X2*SH2).

[0187]

[0246] The flow captures the output of the adder at 7806. The output of the adder 7608 is sent to a flip-flop 7610 where it is captured.

[0188]

[0247] At 7807, the flow continues the process of 7801 through 7806 for each data and shift instruction until all of the data and shift instructions have been processed.

[0189]

[0248] 79 and 80 show an example of an AIPE performing a batch normalization operation according to an example implementation. Specifically, FIG. 79 shows an example of an AIPE architecture configured to perform a batch normalization operation, and FIG. 80 shows an example flow of an AIPE performing a batch normalization operation. The AIPE may perform the batch normalization operation using an arithmetic shifter. In the example of FIG. 79, data=X, parameters=γ, β, and batch normalization may correspond to the following equation:

[0190]

[0249]

number

[0191]

[0250]

number

[0192]

[0251]

number

number

number

[0193]

[0252] At 8001, a flow reads data and log-quantized parameters. Data 7901 and shift instructions 7902 derived from the log-quantized parameters are read, while the output of a previous neural network operation is also available and multiplexed along with the input data 7901. The flow may also read biases. In the example of FIG.

number

number

[0194]

[0253] At 8002, a flow sets the control bits of the data mux and the control bits of the parameter mux. The control bit 7905 of the data mux 7901 may be set to 0 if the loaded data 7901 is used, and may be set to 1 if the output of the previous neural net operation is used. The control bit 7906 of the parameter may be set to 1.

[0195]

[0254] At 8003, a flow shifts the data by a shift instruction. The multiplexed data 7901 with feedback from flip-flop 7903 and a shift instruction 7902 derived from the logarithmic quantized parameter are provided to an arithmetic shifter 7907. The arithmetic shifter 7907 shifts the data by a shift instruction based on the logarithmic quantized parameter. The output of the arithmetic shifter 7907 is then converted to two's complement. The output of the arithmetic shifter 7907 is provided to an adder 7908.

[0196]

[0255] At 8004, the flow sets the control bits of the bias mux. The bias control bit 7909 may be set to 1. Setting the bias sign bit 7909 to 1 allows the bias value read in D3 to be provided to adder 7908.

[0197]

[0256] At 8005, the flow processes the shifted data and bias by the adder. To complete the batch normalization operation, the output of the arithmetic shifter 7907 or the shifted data is added to the bias 7904 by the adder 7908. The output of the adder 7908 is sent to the flip-flop 7903.

[0198]

[0257] At 8006, the flow sets an output control bit. The output control bit 7910 may be set to 1. The output control bit 7910 being set to 1 allows the output of the adder 7908 sent to the flip-flop to be captured.

[0199]

[0258] The flow captures the output of the adder at 8007. The output of adder 7908 is captured by flip-flop 7903 based in part on output control bit 7910 being set to one.

[0200]

[0259] FIG. 81 and FIG. 82 show an example of an AIPE that performs a parametric ReLU operation according to an example implementation. Specifically, FIG. 81 shows an example of an AIPE architecture configured to perform a parametric ReLU operation, and FIG. 82 shows an example flow of an AIPE that performs a parametric ReLU operation. The AIPE may perform the parametric ReLU operation using an arithmetic shifter. In the example of FIG. 81, data=X, logarithmic quantized parameter=a. The function of the parametric ReLU is Y=X if X≧0, or Y=a*X if X<0.

[0201]

[0260] At 8201, a flow reads data and log-quantized parameters; feedback from a previous neural network operation is also available as D2 and input to data mux M1. Data 8101 and shift instructions 8102 derived from the log-quantized parameters are read, while the output of the previous neural network operation in flip-flops 8103 along with data 8101 are fed back to the AIPE and multiplexed. A flow may also read a bias; in this example, bias 8104 with a constant 0 may be read at D3.

[0202]

[0261] At 8202, a flow sets the control bits of the data mux and the control bits of the parameter mux. The control bit 8105 of data 8101 may be set to 1. The control bit 8106 of shift instruction 8102 may be set to 1. The control bit 8105 being set to 1 allows the feedback from flip-flop 8103 to be selected as the input to the shifter. The control bit 8106 being set to 1 allows the shift instruction 8102 to be selected as the input to the arithmetic shifter 8107.

[0203]

[0262] In 8204, the flow shifts the data by a shift instruction. An arithmetic shifter 8107 shifts the data 8101 by a shift instruction 8102 based on the logarithmic quantized parameters. The output of the arithmetic shifter 8107 is then converted to two's complement. The output of the arithmetic shifter 8107 is provided to an adder 8108.

[0204]

[0263] At 8205, the flow sets the bias control bit. The bias control bit 8109 may be set to 1. Setting the bias control bit 8109 to 1 allows the bias value loaded at D3 to be provided to the adder 8108.

[0205]

[0264] In 8206, the flow processes the shifted data and bias by the adder. To complete the parametric ReLU operation, the output of the arithmetic shifter 8107 or the shifted data is added to the bias 8104 by the adder 8108. The output of the adder 8108 is sent to the flip-flop 8103.

[0206]

[0265] At 8207, the flow sets the adder mux control bit. The adder mux control bit 8110 may be set to 1. Setting the adder mux control bit 8110 to 1 allows the output of the adder 8108 to pass through the multiplexer associated with the adder 8108 and be provided to the flip-flop 8103.

[0207]

[0266] At 8208, the flow captures the output of the adder. The output of adder 8108 passes through the multiplexer because the adder mux control bit is set to 1 so that flip-flop 8103 is permitted to receive and capture the output of adder 8108. The sign bit 8111 of flip-flop 8103 may be provided to an OR circuit for comparison with control bit 8106.

[0208]

[0267] FIG. 83 and FIG. 84 show an example of an AIPE performing an addition operation according to an example implementation. Specifically, FIG. 83 shows an example of an AIPE architecture configured to perform an addition operation, and FIG. 84 shows an example flow of an AIPE performing an addition operation. In the example of FIG. 83, data may include a first input including X1-X9 and a second input including Y1-Y9. The addition operation may add the first and second inputs such that the addition operation=X1+Y1, X2+Y2,...X9+Y9.

[0209]

[0268] At 8401, a flow reads data and biases. At D1, data 8301 including X1 may be read, while at D3, bias 8306 including Y1 may be read.

[0210]

[0269] At 8402, a flow sets control bits for the data mux and the parameter mux. The control bit 8303 for data 8301 may be set to 0. The control bit 8304 for parameter 8302 may be set to 0. The control bit 8303 being set to 0 allows the data 8301 (D1) to be provided to the arithmetic shifter 8305. The control bit 8304 being set to 0 allows the constant 0 to be provided to the arithmetic shifter 8305.

[0211]

[0270] At 8403, a flow shifts data with a shift instruction. Data 8301 and parameters 8302 are provided to an arithmetic shifter 8305. The arithmetic shifter 8305 shifts the data by a shift amount based on parameters 8302, which is a constant 0. Thus, the output of the shifter is the same as the input data 8301, since the shifter shifted the data by an amount 0, which is the same as no shift. The output of the arithmetic shifter 8305 is provided to an adder 8308.

[0212]

[0271] At 8404, the flow sets a bias mux control bit. The bias mux control bit 8307 may be set to 1. The bias mux control bit 8307 being set to 1 may allow the bias 8306 at D3 to be provided to the adder 8308.

[0213]

[0272] At 8405, the flow processes the shifted data and the bias by the adder. To perform an addition operation, the output of the arithmetic shifter 8305 or the shifted data is added to the bias 8306 by the adder 8308. The output of the adder 8308 is sent to the flip-flop 8310.

[0214]

[0273] At 8406, the flow sets an adder mux control bit. The adder mux control bit 8309 may be set to 1. The adder mux control bit 8309 being set to 1 allows the output of the adder 8308 to be provided to the flip-flop 8310.

[0215]

[0274] At 8407, the flow captures the output of the adder 8308. The output of the adder 8308 is provided to a flip-flop 8310, due in part to the adder mux control bit 8309 being set to 1. At 8408, the flip-flop 8310 captures the output of the adder 8308.

[0216]

[0275] At 8409, the flow continues with the process of 8401 through 8408 for the remaining data until all of the data has been processed.

[0217]

[0276] FIG. 85 illustrates an example of a neural network array according to an exemplary implementation. In the example of FIG. 85, the neural network array includes multiple AI processing elements (AIPEs), where data and logarithmically quantized parameters (kernels) are input to the AIPEs to perform various operations disclosed herein. The AIPE architecture is configured to utilize shifters and logic gates. The examples disclosed herein include 32 bits of data with 7-bit logarithmically quantized parameters, where the data can be 1-N bits, and the logarithmically quantized parameters can be 1-M bits parameters, where N and M are any positive integers. While some examples include one 32-bit shifter, the number of shifters can be two or more and can vary from one shifter to O shifters, where O is a positive integer. In some cases, the architecture includes 128 bits of data, 9 bits of logarithmically quantized parameters, and seven shifters connected in series (one after the other). Also, the logic gates illustrated herein are a standard set of logic gates that can vary depending on the particular architecture.

[0218]

[0277] In some cases, the AIPE architecture may utilize shifters, adders, and / or logic gates. Examples disclosed herein include 32 bits of data with a 7-bit logarithmic quantized parameter, where the data can be 1-N bits and the logarithmic quantized parameter can be a 1-M bit parameter, where N and M are any positive integers. Some examples include one 32-bit shifter and one 32-bit two-input adder, but the number of shifters and adders may be two or more and may vary from one shifter to O shifters and one adder to P adders, where O and P are positive integers. In some cases, the architecture includes 128 bits of data, 9 bits of parameter, and two shifters connected in series (one after the other) and two adders connected in series (one after the other).

[0219]

[0278] FIG. 86A, FIG. 86B, FIG. 86C, and FIG. 86D show examples of AIPE structures dedicated to each particular neural network operation according to an exemplary implementation. Specifically, FIG. 86A shows an example of an AIPE structure configured to perform a convolution operation, FIG. 86B shows an example of an AIPE structure configured to perform a batch normalization operation, FIG. 86C shows an example of an AIPE structure configured to perform a pooling operation, and FIG. 86D shows an example of an AIPE structure configured to perform a parametric ReLU operation. The AIPE structure comprises four different circuits, each circuit dedicated to performing a convolution operation, a batch normalization operation, a pooling operation, and a parametric ReLU operation. In some cases, the AIPE structure may comprise more or less than four different circuits and is not intended to be limited to the examples disclosed herein. For example, the AIPE structure may comprise multiple circuits, each circuit dedicated to performing each neural network operation.

[0220]

[0279] The circuit of FIG. 86A inputs data to perform a convolution operation and registers the data in a register. The circuit also receives a kernel, which is a shift instruction derived from the logarithmically quantized parameters, which is also registered. The shifter then performs an initial shift operation based on the shift instruction, and the output from the shifter is registered. After the data is shifted, the output is added to the feedback of the output of the register, which receives the output from the shifter of the previous operation. In the initial cycle, the feedback contains zero, but in subsequent cycles, the output of the previous cycle is added to the output of the next cycle. This combined output is then multiplexed and provided to the register as the shifted output.

[0221]

[0280] The circuit of FIG. 86B inputs data to perform the batch normalization operation and registers the data in a register. The circuit also receives a kernel, which is a shift instruction derived from the logarithmically quantized parameters, and is also registered. A shifter then performs an initial shift operation based on the shift instruction, and the output from the shifter is registered. After the data is shifted, the data is added by an adder that receives a bias. The output of the added shifted data and the bias is provided to the register as output data.

[0222]

[0281] The circuit of FIG. 86C inputs data to perform the pooling operation and registers the data in a register. The data is provided to a comparator, which compares the input data and the output data. If the result of the comparison indicates that the output data is greater than the input data, the output data is selected. If the result of the comparison indicates that the input data is greater than the output data, the input data is selected. The input data is provided to a multiplexer, which receives a signal bit from the comparator indicating the result of the comparison. The multiplexer provides data to a second register, and the output of the second register is fed back to the multiplexer, such that the signal bit from the comparator indicates which data from the multiplexer is provided to the second register. The output of the second register is fed back to the comparator, enabling the comparator to perform the comparison. The output of the second register is the data output.

[0223]

[0282] The circuit of FIG. 86D inputs data to perform a parametric ReLU operation and registers the data in a register. The data is provided to a shifter, a comparator, and a multiplexer. The circuit also receives a shift instruction derived from the logarithmic quantized ReLU parameters provided to the shifter. The shifter performs a shift operation based on the shift instruction, and the output from the shifter is provided to the multiplexer. The comparator compares the original input data and the output (shifted data) of the shifter. If the result of the comparison indicates that the shifted data is greater than the original input data, the shifted data is selected. If the result of the comparison indicates that the original input data is greater than the shifted data, the original input data is selected. The comparator provides an instruction to the multiplexer as to which data to select, the original input data or the shifted data. The multiplexer then provides the original input data or the shifted data to the register based on the instruction from the comparator. The output of the register is the output of the ReLU operation.

[0224]

[0283] FIG. 87 illustrates an example of an array using an AIPE structure according to an example implementation. The array structure may include a plurality of AIPE structures, and the array structure is configured to perform neural network operations. The array structure includes an array of AIPE structures performing convolution operations. The array of AIPE structures performing convolution may include, as an example, 16x16x16 AIPEs. The array structure includes an array of AIPE structures performing batch normalization operations. The array of AIPE structures performing batch normalization may include, as an example, 16x1x16 AIPEs. The array structure includes an array of AIPE structures performing parametric ReLU operations. The array of AIPE structures performing parametric ReLU operations may include, as an example, 16x1x16 AIPEs. The array structure includes an array of AIPE structures performing pooling operations. The array of AIPE structures performing pooling operations may include, as an example, 16x1x16 AIPEs. Each output of the array is provided to a multiplexer, and the output of the multiplexer is provided to an output buffer. The array receives input from an input buffer and shift instructions derived from the logarithmically quantized parameters from a kernel buffer. The input buffer and kernel buffer may receive input from an AXI 1-input 2-output demultiplexer. The demultiplexer receives an AXI read input.

[0225]

[0284] Thus, as shown in Figures 86A-87, variations of the exemplary implementations described herein can be modified to provide dedicated circuits for targeting specific neural network operations. The system can consist of dedicated circuits such as a first circuit for facilitating convolution by a shifter circuit as shown in Figure 86A, a second circuit for facilitating convolution by a shifter circuit as shown in Figure 86B, a third circuit for facilitating max pooling by a comparator as shown in Figure 86C, and a fourth circuit for facilitating parametric ReLU as shown in Figure 86D. Such circuits can be used in any combination or as standalone functions, as described herein, to facilitate a desired implementation, and can also be used with AIPE circuits.

[0226]

[0285] FIG. 88 illustrates an exemplary computing environment including an exemplary computing device suitable for use in some exemplary implementations, such as an apparatus for generating and / or logarithmically quantizing parameters, training an AI / NN network, or executing the exemplary implementations described herein in the form of an algorithm. The computing device 8805 in the computing environment 8800 can include one or more processing units, cores, or processors 8810, memory 8815 (e.g., RAM, ROM, and / or the like), internal storage 8820 (e.g., magnetic, optical, semiconductor storage, and / or organic), and / or I / O interface 8825, any of which can be coupled over a communication mechanism or bus 8830 to communicate information or incorporated into the computing device 8805. The I / O interface 8825 is also configured to receive images from a camera or provide images to a projector or display, depending on the desired implementation.

[0227]

[0286] The computing device 8805 can be communicatively coupled to an input / user interface 8835 and an output device / interface 8840. Any one or both of the input / user interface 8835 and the output device / interface 8840 can be a wired or wireless interface and can be removable. The input / user interface 8835 can include any device, component, sensor, or interface, physical or virtual, that can be used to provide input (e.g., buttons, touch screen interface, keyboard, pointing / cursor control, microphone, camera, Braille, motion sensor, optical reader, and / or the like). The output device / interface 8840 can include a display, television, monitor, printer, speaker, Braille, etc. In some example implementations, the input / user interface 8835 and the output device / interface 8840 can be incorporated into or physically coupled to the computing device 8805. In other example implementations, other computing devices may function as or provide the functionality of the input / user interface 8835 and the output device / interface 8840 of the computing device 8805.

[0228]

[0287] Examples of computing devices 8805 include, but are not limited to, highly mobile devices (e.g., smart phones, devices in vehicles and other machines, devices carried by humans and animals, etc.), mobile devices (e.g., tablets, notebooks, laptops, personal computers, portable televisions, radios, etc.), and devices not designed for portability (e.g., desktop computers, other computers, information centers, televisions, radios with one or more processors embedded and / or coupled thereto, etc.).

[0229]

[0288] The computing device 8805 can be communicatively coupled (e.g., via I / O interface 8825) to external storage 8845 and a network 8850 for communicating with any number of networked components, devices, and systems, including one or more computing devices of the same or different configurations. The computing device 8805 or any connected computing device can function, provide services, or be considered as a server, a client, a thin server, a general machine, a special purpose machine, or another label.

[0230]

[0289] The I / O interface 8825 can include, but is not limited to, wired and / or wireless interfaces using any communication or I / O protocol or standard (e.g., Ethernet, 802.11x, Universal System Bus, WiMax, modem, cellular network protocols, etc.) to communicate information to and from at least all connected components, devices, and networks in the computing environment 8800. The network 8850 can be any network or combination of networks (e.g., the Internet, a local area network, a wide area network, a telephone network, a cellular network, a satellite network, etc.).

[0231]

[0290] The computing device 8805 can use and / or communicate using computer usable or computer readable media, including transitory and non-transitory media. Transitory media include transmission media (e.g., metallic cables, optical fibers), signals, carrier waves, and the like. Non-transitory media include magnetic media (e.g., disks and tapes), optical media (e.g., CD ROM, digital video disks, Blu-ray disks), semiconductor media (e.g., RAM, ROM, flash memory, solid-state storage), and other non-volatile storage or memory.

[0232]

[0291] The computing device 8805 can be used to implement techniques, methods, applications, processes, or computer-executable instructions in some exemplary computing environments. The computer-executable instructions can be retrieved from a transitory medium, stored in a non-transitory medium, and retrieved from a non-transitory medium. The executable instructions can result from one or more of any programming, scripting, and machine language (e.g., C, C++, C#, Java, Visual Basic, Python, Perl, JavaScript, etc.).

[0233]

[0292] The processor 8810 can run under any operating system (OS) (not shown) in a native or virtual environment. One or more applications can be deployed, including a logic unit 8860, an application programming interface (API) unit 8865, an input unit 8870, an output unit 8875, and an inter-unit communication mechanism 8895 for different units to communicate with each other, with the OS, and with other applications (not shown). The described units and elements can vary in design, function, configuration, or implementation and are not limited to the provided description. The processor 8810 can be in the form of a hardware processor, such as a central processing unit (CPU), or a combination of hardware and software units.

[0234]

[0293] In some example implementations, when information or instructions to execute are received by the API unit 8865, the information or instructions to execute may be communicated to one or more other units (e.g., logic unit 8860, input unit 8870, output unit 8875). In some cases, in some example implementations described above, logic unit 8860 may be configured to control the flow of information between units and direct the services provided by API unit 8865, input unit 8870, output unit 8875. For example, logic unit 8860 alone or together with API unit 8865 may control the flow of one or more processes or implementations. Input unit 8870 may be configured to obtain inputs for the calculations described in the example implementations, and output unit 8875 may be configured to provide outputs based on the calculations described in the example implementations.

[0235]

[0294] Depending on the desired implementation, the processor 8810 can be configured to convert data values ​​or parameters of the AI / neural network model to log-quantized data values ​​or log-quantized values ​​provided to the memory of the system, as shown in FIG. 89. The log-quantized data values ​​or log-quantized parameters can then be used by the controller of the system of FIG. 89 to convert to shift instructions to shift the corresponding parameters or data values ​​to facilitate neural network or AI operations. In such an exemplary implementation, the processor 8810 can be configured to perform a process such as that shown in FIGS. 9A and 9B to perform training of the machine learning algorithm, resulting in log-quantized parameters, which can be stored in the memory for use by the controller. In other exemplary implementations, the processor 8810 can also be configured to perform a method or process to convert input data to log-quantized data for providing to the AIPE.

[0236]

[0295] FIG. 89 illustrates an exemplary system for AIPE control, according to an exemplary implementation. In an exemplary implementation, a controller 8900 can control one or more AIPEs 8901 via control signals (e.g., s1, s2, s3, s4 shown in FIGS. 72-85) as described herein to perform a desired neural network operation. The controller 8900 is configured using controller logic, which can be implemented as any logic circuit or any type of hardware controller as known in the art, such as a memory controller, a central processing unit, etc., according to a desired implementation. In an exemplary implementation, the controller 8900 can retrieve logarithmically quantized parameters from a memory 8902 and convert those parameters into shift instructions, including a sign bit, a shift direction, and a shift instruction derived from the logarithmically quantized parameters. Such shift instructions and control signals can be provided from the controller 8900 to the AIPE 8901. Depending on the desired implementation, input data can be provided directly to the AIPE 8901 by any input interface 8903 according to the desired implementation (e.g., 2 x The input interface 8903 may be provided by the controller 8900 as a data stream (such as processed by a conversion circuit, input processing circuit, FPGA, hardware processor, etc. configured to scale the data stream by a factor of 1000), or as retrieved from the memory 8902. The output of the AIPE 8901 may be processed by an output interface 8904, which may present the output of the neural network operation to any desired device or hardware, according to a desired implementation. The output interface 8904 may be implemented as any hardware (e.g., FPGA, hardware, dedicated circuitry), according to a desired implementation. Additionally, any or all of the controller 8900, the AIPE 8901, the memory 8902, the input interface 8903, and / or the output interface 8904 may be implemented as one or more hardware processors or FPGAs, according to a desired implementation.

[0237]

[0296] The memory 8902 can be any form of physical memory, such as, but not limited to, double data rate synchronous dynamic random-access memory (DDR SDRAM), magnetic random access memory (MRAM), etc., according to a desired implementation. In an exemplary implementation, if the data is logarithmically quantized and stored in the memory 8902, the data can be used to derive shift instructions for shifting neural network parameters when retrieved from the memory 8902, instead of deriving the shift instructions utilizing the logarithmically quantized neural network parameters. The derivation of the shift instructions from the logarithmically quantized data can be performed in a manner similar to the derivation from the logarithmically quantized parameters.

[0238]

[0297] In an exemplary implementation, there may be a system as shown in FIG. 89, in which a memory 8902 may be configured to store a trained neural network represented by one or more logarithmically quantized parameter values ​​associated with one or more neural network layers, each of the one or more neural network layers representing a corresponding neural network operation to be performed. Such a system may include one or more hardware elements (e.g., AIPE 8901, hardware processor, FPGA, etc., as described herein) configured to shift or add shiftable input data, and controller logic (e.g., as implemented as controller 8900, hardware processor, logic circuit, etc.) configured to control the one or more hardware elements (e.g., via control signals s1, s2, s3, s4, etc.) to shift the shiftable input data left or right based on a shift instruction derived from the corresponding logarithmically quantized parameter value for each of the one or more neural network layers read from the memory to form shifted data, and may add or shift the formed shifted data (e.g., via an adder circuit or a shifter circuit, as described herein) according to the corresponding neural network operation to be performed.

[0239]

[0298] Depending on the desired implementation, the system may further include a data scaler configured to resize the input data to form the shiftable input data. Such a data scaler may be implemented in hardware (e.g., via dedicated circuit logic, a hardware processor, etc.) or in software, according to the desired implementation. Such a data scaler may resize bias parameters from one or more neural network layers read from memory 8902 for addition to the shifted data via adder or shifter circuits, or may resize bias parameters from one or more neural network layers read from memory 8902 (e.g., 2x, where x is an integer, to form the shiftable input data). xThe input data may be configured to be scaled (by a factor of ).

[0240]

[0299] As shown in the example implementations described herein, the AIPE8901 or equivalent hardware element may include one or more shifter circuits (e.g., barrel shifter circuits, logarithmic shifter circuits, arithmetic shifter circuits, etc.) configured to perform shifts. The AIPE8901 or equivalent hardware element may further include one or more adder circuits (e.g., arithmetic adder circuits, integer adder circuits, etc.) configured to perform addition as described herein. If desired, an addition operation may include one or more shift circuits configured to perform addition as described herein (e.g., via segments, positive / negative accumulators, etc.).

[0241]

[0300] The controller 8900 can be configured to generate shift instructions that are provided to the AIPE 8901 or equivalent hardware element. Such shift instructions can include a shift direction and a shift amount to control / instruct the AIPE or equivalent hardware element to shift the shiftable input data to the left or right. As described herein (e.g., as shown in Figures 59-62), the shift amount can be derived from the magnitude of the exponent of the corresponding logarithmic quantized weight parameter (e.g., 2 2 has a magnitude of 2, thereby making the shift amount 2), and the shift direction can be derived from the sign of the exponent of the corresponding log-quantized weight parameter (e.g., 2 2 has a plus sign, thereby indicating a shift to the left).

[0242]

[0301] Depending on the desired implementation, the AIPE8901 or equivalent hardware element can be configured to provide a sign bit of the shifted data formed based on the sign bit of the corresponding log-quantized weight parameter and the sign bit of the input data as shown in Figure 60 or Figure 62. The shift instruction can include the sign bit of the corresponding log-quantized weight parameter for use in an XOR circuit or for two's complement purposes, depending on the desired implementation.

[0243]

[0302] As described herein in various exemplary implementations, the computing environment of FIG. 88 and / or the system of FIG. 89 can be configured to execute methods or computer instructions for processing a neural network operation that can include multiplying input data with a corresponding log-quantized parameter associated with the neural network operation (e.g., to facilitate convolution, batch normalization, etc.). Such methods and computer instructions for multiplication can include taking a shiftable input derived (e.g., scaled by a coefficient) from the input data as described herein, and shifting the shiftable input leftward or rightward according to a shift instruction derived from the corresponding log-quantized parameter to generate an output representing the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation. As described herein, the shift instruction associated with the corresponding log-quantized parameter can include a shift direction and a shift amount, where the shift amount is derived from the magnitude of the exponent of the corresponding log-quantized parameter and the shift direction is derived from the sign of the exponent of the corresponding log-quantized parameter, and shifting the shiftable input includes shifting the shiftable input leftward or rightward by an amount indicated by the shift amount according to the shift direction. Although the following is described with respect to the systems shown in Figures 88 and 89, other implementations for facilitating the methods or computer instructions are possible and the disclosure is not limited thereto. For example, the methods can be performed by a field programmable gate array (FPGA), by an integrated circuit (e.g., ASIC), or by one or more hardware processors.

[0244]

[0303] As described herein, in the computer environment of FIG. 88 and / or in a system such as that illustrated in FIG. 89, there may be a method or computer instructions for processing a neural network operation, the method or computer instructions including taking shiftable input data derived from input data of the neural network operation, taking inputs associated with corresponding log-quantized weight parameters of the input data of the neural network operation, the inputs including a shift direction and a shift amount, the shift amount being derived from a magnitude of an exponent of the corresponding log-quantized weight parameter and the shift direction being derived from a sign of the exponent of the corresponding log-quantized weight parameter, and shifting the shiftable input data according to the inputs associated with the corresponding log-quantized weight parameters to generate an output of the processing of the neural network operation.

[0245]

[0304] As shown in the example implementations described herein, the methods and computer instructions may include determining (e.g., via an XOR circuit or equivalent functionality in software or circuitry) a sign bit of an output of a multiplication of the input data with a corresponding log-quantized parameter of a neural network operation based on a sign bit of the corresponding log-quantized parameter and a sign bit of the input data.

[0246]

[0305] As shown in the example implementations described herein, the method and computer instructions for multiplication may include converting an output of the multiplication of the input data with a corresponding log-quantized parameter of a neural network operation to one's complement data when a sign bit of the corresponding log-quantized parameter is negative, and incrementing the one's complement data to form two's complement data as the output of the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation.

[0247]

[0306] As illustrated in the exemplary implementations described herein, the methods and computer instructions may include adding a value associated with the neural network operation to a generated output of a multiplication of input data with a corresponding logarithmically quantized parameter to form an output of the processing of the neural network operation. Such addition may be performed by an adder circuit (e.g., an integer adder circuit or a floating point adder circuit) or by one or more shifter circuits (e.g., a barrel shifter circuit, a logarithmic shifter circuit, etc.) depending on the desired implementation. Such one or more shifter circuits may be the same as or separate from the one or more shifter circuits that manage the shifting depending on the desired implementation. The value associated with the neural network operation may be, but is not limited to, a bias parameter.

[0248]

[0307] As described in an example implementation herein, the method and computer instructions may include, when the neural network is a convolution operation, the input data includes a plurality of input elements of the convolution operation; the shiftable input includes a plurality of shiftable input elements, each of the shiftable input elements corresponding to one of the plurality of input elements multiplied by a corresponding log-quantized parameter from the plurality of log-quantized parameters; and an output of the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation includes a plurality of shiftable outputs, each of the plurality of shiftable outputs corresponding to a shift of each of the shiftable input elements according to an input associated with the corresponding log-quantized parameter from the plurality of log-quantized parameters, and the plurality of shiftable outputs are summed by an add operation or a shift operation.

[0249]

[0308] As described in the example implementations herein, the method and computer instructions may include, when the neural network operation is a parametric ReLU operation, shifting the shiftable input according to the shift instruction to generate an output of the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation is performed only for when a sign bit of the input data is negative, and for when the sign bit of the input data is positive, the shiftable input is provided as the output of the multiplication of the input data with the corresponding log-quantized parameter of the neural network operation without shifting.

[0250]

[0309] Some portions of the detailed description are presented in terms of algorithms and symbolic representations of operations within a computer. These algorithmic descriptions and symbolic representations are the means used by those skilled in the data processing arts to convey the substance of their innovations to others skilled in the art. An algorithm is a sequence of defined steps leading to a desired end state or result. In exemplary implementations, the steps performed require physical manipulations of tangible quantities to achieve a tangible result.

[0251]

[0310] As will be apparent from the description, unless specifically stated otherwise, throughout the description, descriptions utilizing terms such as "processing," "calculating," "computing," "determining," "displaying," and the like, are understood to include operations and processes of a computer system or other information processing device that manipulates and converts data represented as physical (electronic) quantities in the registers and memory of a computer system into other data similarly represented as physical quantities in the memory or registers of a computer system or other information storage, transmission, or display device.

[0252]

[0311] An exemplary implementation may relate to an apparatus for performing the operations herein. The apparatus may be specially constructed for the required purposes or may include one or more general-purpose computers selectively activated or reconfigured by one or more computer programs. Such computer programs may be stored on a computer-readable medium, such as a computer-readable storage medium or a computer-readable signal medium. The computer-readable storage medium may include tangible media, such as, but not limited to, optical disks, magnetic disks, read-only memories, random access memories, semiconductor devices and drives, or any other type of tangible or non-transitory medium suitable for storing electronic information. The computer-readable signal medium may include media such as carrier waves. The algorithms and displays presented herein are not inherently related to any particular computer or other apparatus. The computer program may include a pure software implementation that includes instructions for performing the operations of a desired implementation.

[0253]

[0312] Various general-purpose systems may be used with the programs and modules in accordance with the examples herein, or it may prove convenient to construct more specialized apparatus to perform the desired method steps. Additionally, the exemplary implementations are not described with reference to any particular programming language. It will be understood that a variety of programming languages ​​may be used to implement the techniques of the exemplary implementations described herein. Instructions in the programming language may be executed by one or more processing devices (e.g., a central processing unit (CPU), processor, or controller).

[0254]

[0313] As known in the art, the operations described above may be performed by hardware, software, or some combination of software and hardware. Various aspects of the exemplary implementations may be implemented using circuits and logic devices (hardware), while other aspects may be implemented using instructions stored on a machine-readable medium (software), which, when executed by a processor, cause the processor to perform a method for performing the implementation of the present application. Furthermore, some exemplary implementations of the present application may be performed exclusively in hardware, while other exemplary implementations may be performed exclusively in software. Furthermore, the various functions described may be performed in a single unit or distributed across multiple components in any number of ways. When performed by software, the method may be executed by a processor, such as a general-purpose computer, based on instructions stored on a computer-readable medium. If necessary, the instructions may be stored on the medium in compressed and / or encrypted form.

[0255]

[0314] Moreover, other implementations of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the techniques of the present application. Various aspects and / or components of the described exemplary implementations may be used alone or in any combination. It is intended that the specification and exemplary implementations be considered as examples only, with a true scope and spirit of the present application being indicated by the following claims.

Claims

1. An artificial intelligence processing element (AIPE), comprising: incorporating shiftable inputs derived from input data for a neural network operation; incorporating shift instructions derived from corresponding log-quantized parameters or constant values ​​of the neural network; shifting the shiftable input leftward or rightward in accordance with the shift instruction to form a shifted output representing the multiplication of the input data with the corresponding log-quantized parameter of the neural network; and a shifter circuit configured to perform the steps of:

2. the shift instruction includes a shift direction and a shift amount, the shift amount being derived from a magnitude of an exponent of the corresponding logarithmically quantized parameter, and the shift direction being derived from a sign of the exponent of the corresponding logarithmically quantized parameter; the shifter circuit shifts the shiftable input in the leftward or rightward direction according to the shift direction and shifts the shiftable input in the shift direction by an amount indicated by the shift amount.

2. The AIPE of claim 1.

3. a circuit configured to take a first sign bit of the shiftable input and a second sign bit of the corresponding logarithmically quantized parameter and form a third sign bit of the shifted output.

2. The AIPE of claim 1 further comprising:

4. a first circuit configured to take the sign bit of the shifted output and the corresponding one of the sign bits of the logarithmically quantized parameter and form one's complement data for the case where the sign bit of the logarithmically quantized parameter indicates a negative sign; a second circuit configured to increment the one's complement data by the sign bit of the corresponding log-quantized parameter and change the shifted output to two's complement data representing the multiplication of the input data with the corresponding log-quantized parameter; 2. The AIPE of claim 1 further comprising:

5. The shifter circuit is a logarithmic shifter circuit or a barrel shifter circuit.

2. The AIPE of claim 1.

6. A circuit configured to capture the output of the neural network operation. Further equipped with said circuit providing said shiftable input from said output of said neural network operation or from resized input data generated from said input data of said neural network operation according to a signal input to said shifter circuit.

2. The AIPE of claim 1.

7. a circuit configured to provide the shift instructions derived from the corresponding logarithmically quantized parameters of the neural network or the constant values ​​according to a signal input; 2. The AIPE of claim 1 further comprising:

8. an adder circuit coupled to the shifter circuit; Further equipped with The AIPE of claim 1 , wherein the adder circuit is configured to sum based on the shifted outputs to form an output of the neural network operation.

9. the adder circuit is an integer adder circuit; The AIPE of claim 8.

10. the adder circuit is configured to add the shifted output to a corresponding one of a plurality of bias parameters of the neural network to form the output of the neural network operation. The AIPE of claim 8.

11. Another shifter circuit; a register circuit coupled to the other shifter circuit for latching an output from the other shifter circuit; Further equipped with the other shifter circuit is configured to take a sign bit associated with the shifted output and each segment of the shifted output, and shift a further shifter circuit input left or right based on the sign bit to form the output from the other shifter circuit; the register circuit is configured to provide the latched output from the further shifter circuit as the further shifter circuit input to the further shifter circuit upon receipt of a signal indicating that the neural network operation is not complete, and to provide the latched output as an output of the neural network operation upon receipt of the signal indicating that the neural network operation is complete.

2. The AIPE of claim 1.

12. each said segment having a size equal to the binary logarithm of a width of said further shifter circuit input; 12. The AIPE of claim 11.

13. a counter configured to capture an overflow or underflow from the other shifter circuit resulting from the shifting of the other shifter circuit input by the shifter circuit; Further equipped with the other shifter circuit is configured to take the overflow or underflow from each of the segments and shift a subsequent segment left or right depending on the amount of the overflow or underflow.

12. The AIPE of claim 11.

14. a one-hot to binary encoding circuit configured to take the latched outputs and generate an encoded output, and to concatenate the encoded outputs from all segments and a sign bit from a result of an overflow or underflow operation to form the output of the neural network operation.

12. The AIPE of claim 11 further comprising:

15. a positive accumulation shifter circuit including a second shifter circuit configured to take each segment of the shifted output and shift a positive accumulation shifter circuit input left when a sign bit associated with the shift instruction indicates a positive sign, the second shifter circuit coupled to a first register circuit configured to latch the shifted positive accumulation shifter circuit input from the second shifter circuit as a first latched output, the first register circuit configured to provide the first latched output as the positive accumulation shifter circuit input upon receipt of a signal indicating that the neural network operation is not complete; a negative accumulation shifter circuit including a third shifter circuit configured to take each segment of the shifted output and left shift a negative accumulation shifter circuit input when the sign bit associated with the shift instruction indicates a negative sign, the third shifter circuit coupled to a second register circuit configured to latch the shifted negative accumulation shifter circuit input from the third shifter circuit as a second latched output, the second register circuit configured to provide the second latched output as the negative accumulation shifter circuit input upon receipt of a signal indicating that the neural network operation is not complete; an adder circuit configured to, upon receipt of the signal indicating that the neural network operation is complete, sum based on the first latched output from the positive accumulate shifter circuit and the second latched output from the negative accumulate shifter circuit to form an output of the neural network operation; 2. The AIPE of claim 1 further comprising:

16. a first counter configured to capture a first overflow from the positive accumulate shifter circuit resulting from the shifting of the positive accumulate shifter circuit input, the second shifter circuit configured to capture the first overflow from each of the segments and shift subsequent segments left by the amount of the first overflow; a second counter configured to capture a second overflow from the negative accumulate shifter circuit resulting from the shifting of the negative accumulate shifter circuit input, the third shifter circuit configured to capture the second overflow from each of the segments and shift subsequent segments left by the amount of the second overflow; 20. The AIPE of claim 15 further comprising:

17. a first one-hot to binary encoding circuit configured to take the first latched output and generate a first encoded output and to concatenate the first encoded output and a positive sign bit from all segments to form a first adder circuit input; a second one-hot to binary encoding circuit configured to take the second latched output and generate a second encoded output and to concatenate the second encoded output and a negative sign bit from all segments to form a second adder circuit input; Further equipped with the adder circuit performs the summing based on the first latched output and the second latched output by adding the first adder circuit input to the second adder circuit input to form the output of the neural network operation.

16. The AIPE of claim 15.

18. the input data is resized to form the shiftable input; 2. The AIPE of claim 1.

19. a register circuit configured to latch the shifted output. Further equipped with Upon receipt of a control signal indicating an addition operation, the shifter circuit is configured to take each segment of the shiftable input and shift the shifted output left or right based on a sign bit associated with the shifted output to form another shifted output representing an addition operation of the shifted output and the shiftable input.

2. The AIPE of claim 1.

20. and if the neural network operation is a parametric ReLU operation, the shifter circuit is configured to perform no shifting if a sign bit of the shiftable input is positive and to provide the shiftable input as the shifted output.

2. The AIPE of claim 1.

Citation Information

Patent Citations

  • Improving the performance of neural network arrays.

    JP2021508895A

  • Predistortion According to an Artificial Neural Network (ANN)-based Model

    US20130343483A1

  • Quantized neural network training and inference

    US20170286830A1

  • Compute optimizations for neural networks

    US20180307950A1

  • Activation Function Functional Block for Electronic Devices

    US20190180182A1