Vector Computation Unit in Neural Network Processor
By designing dedicated hardware circuits, including activation circuits, normalization circuits and pooling circuits, the problem of low activation value, normalization and pooling operation efficiency in neural network reasoning in the existing technology is solved, and efficient calculation and error reduction are achieved reducing effect.
Patent Information
- Application Number
- CN202110718015.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2016-04-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2036-04-29
AI Technical Summary
Existing hardware is difficult to efficiently process the activation values, normalization and pooling operations of multi-layer neural networks when computing neural network inference, resulting in low computational efficiency and large errors.
A dedicated hardware circuit is designed, including activation circuit, normalization circuit and pooling circuit. Pipeline calculation is realized through systolic array and vector calculation unit, which can calculate multiple activation values and generate normalization in each clock cycle. value and pooling value.
It realizes efficient calculation of multiple activation values of each layer of the neural network, reduces the error of inference calculation, and improves the calculation efficiency.
Smart Images

Figure CN113392964B_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 201680019810.9, the application date is April 29, 2016, and the name of the invention is “Vector Computing Unit in Neural Network Processor”. Technical Field
[0002] This specification relates to computing neural network inference in hardware. Background Art
[0003] A neural network is a machine learning model that uses one or more layers to generate an output, such as a classification, for a received input. Some neural networks include one or more hidden layers in addition to an output layer. The output of each hidden layer is used as the input to the next layer in the network, i.e., the next hidden layer or output layer of the network. Each layer in the network generates an output from the received input according to the current values of its respective parameter set. Summary of the invention
[0004] Generally, this specification describes a dedicated hardware circuit that computes neural network inference.
[0005] Generally, one innovative aspect of the subject matter in this specification can be implemented as a circuit for performing neural network computations on a neural network comprising multiple layers, the circuit comprising: an activation circuit configured to receive a vector of accumulated values and configured to apply a function to each accumulated value to generate a vector of activation values; and a normalization circuit coupled to the activation circuit and configured to generate a respective normalized value for each activation value.
[0006] The implementation can include one or more of the following features. The activation circuit receives a vector of accumulated values from a systolic array in the circuit. The normalization circuit includes a plurality of normalization register columns, each normalization register column including a plurality of normalization registers connected in series, each normalization register column being configured to receive a distinct activation value, and respective normalization units in the normalization register column being configured to calculate respective normalization values. Each normalization register is configured to transmit a distinct activation value to an adjacent normalization unit. Each normalization unit is configured to: receive a respective activation value; generate a respective intermediate normalization value based on the respective activation value; and send the respective intermediate normalization value to one or more adjacent normalization units. Generating respective intermediate normalization values includes generating the square of the respective activation value. Each normalization unit is further configured to: receive one or more intermediate normalization values generated according to the activation value from one or more adjacent normalization units; sum each intermediate normalization value to generate an index; use the index to read one or more values from the lookup table; generate a scaling factor according to the one or more values and the index; and generate respective normalization values according to the scaling factor and the respective activation values. The pooling circuit is configured to receive the normalization value, and is configured to pool the normalization value to generate the pooling value. The pooling circuit is configured to store a plurality of normalization values in a plurality of registers and a plurality of memory cells, wherein the plurality of registers and the plurality of memory cells are connected in series, wherein each register stores a normalization value respectively, and each memory cell stores a plurality of normalization values respectively, wherein the pooling circuit is configured to shift a given normalization value to a subsequent register or memory cell after each clock cycle, and wherein the pooling circuit is configured to generate the pooling value according to the normalization value. The pooling circuit is configured to receive the activation value, and is configured to pool the activation value to generate the pooling value. The pooling circuit is configured to store multiple activation values in multiple registers and multiple memory cells, wherein the multiple registers and the multiple memory cells are connected in series, wherein each register stores a normalized value and each memory cell stores multiple activation values, wherein the pooling circuit is configured to shift a given activation value to a subsequent register or memory cell after each clock cycle, and wherein the pooling circuit is configured to generate a pooled value based on the activation value.
[0007] Specific implementations of the subject matter described in this specification can be implemented to achieve one or more of the following advantageous effects. During a given clock cycle, multiple activation values for each neural network layer of the neural network can be calculated. Optionally, the processor can generate multiple normalized values based on the activation values during another given clock cycle. Optionally, the processor can also generate pooled values based on the normalized values or the activation values. The processor can use a new cumulative sum in each clock cycle and produce activation results, normalized results, and pooled results in each clock cycle, thereby pipelined calculations.
[0008] The present invention also provides a corresponding method for operating a neural network.
[0009] The details of one or more embodiments of the subject matter of this specification will be set forth in the following drawings and description. Other features, aspects, and advantages of the subject matter will be apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a flow chart of an exemplary method for performing computations for a given layer of a neural network.
[0011] Figure 2 An exemplary neural network processing system is shown.
[0012] Figure 3 An exemplary architecture including a matrix computation unit is shown.
[0013] Figure 4 An exemplary architecture of a cell within a systolic array is shown.
[0014] Figure 5 An exemplary architecture of a vector computing unit is shown.
[0015] Figure 6 An exemplary architecture of a normalization circuit is shown.
[0016] Figure 7 Another exemplary architecture of a normalization circuit with sampled activation values is shown.
[0017] Figure 8 An exemplary architecture of a normalization unit within a normalization circuit is shown.
[0018] Fig. 9 An exemplary architecture of a pooling circuit is shown.
[0019] Like reference symbols and designations in the various drawings represent like elements. DETAILED DESCRIPTION
[0020] A neural network having multiple layers can be used to compute inferences. For example, given an input, the neural network can compute an inference for the input. The neural network computes the inference by processing the input through each layer of the neural network. In particular, the layers of the neural network can be arranged in sequence, each layer having a respective set of weights. Each layer receives an input and processes the input according to the set of weights for that layer to generate an output.
[0021] Thus, in order to compute inferences based on received inputs, a neural network receives inputs and processes the inputs through each neural network layer in a sequence to generate inferences, with the output from one neural network layer being provided as input to the next neural network layer. Data inputs to a neural network layer, e.g., either inputs to the neural network or outputs to a layer below that layer in a sequence of neural network layers, can be referred to as activation inputs to that layer.
[0022] In some implementations, the layers of a neural network are arranged in a directed graph. That is, any particular layer can receive multiple inputs, multiple outputs, or both. The layers of a neural network can also be arranged so that the output of a layer can be sent back as input to the previous layer.
[0023] Some neural networks normalize the outputs from one or more neural network layers to produce normalized values that are used as inputs to subsequent neural network layers. Normalizing the outputs can help ensure that the normalized values remain within the domain expected for input to subsequent neural network layers. This can reduce errors in inference computations.
[0024] Some neural networks pool outputs from one or more neural network layers to produce pooled values that serve as input to subsequent neural network layers. In some implementations, the neural network pools a set of outputs by determining a maximum or average of a set of outputs and using the maximum or average as the pooled output for the set. The pooled outputs can maintain certain spatial invariances, so outputs arranged in various configurations can be processed to have the same reasoning. The pooled outputs can also reduce the dimensionality of the inputs received at subsequent neural network layers while maintaining the desired properties of the outputs before pooling, which can improve efficiency without significantly compromising the quality of the reasoning produced by the neural network.
[0025] This specification describes dedicated hardware circuits that optionally perform normalization, pooling, or both on the output of one or more neural network layers.
[0026] Figure 11 is a flow chart of an exemplary process 100 for performing computations on a given layer of a neural network using dedicated hardware circuits. For ease of explanation, the method 100 will be described with respect to a system having one or more circuits that perform the method 100. The method 100 can be performed for each layer of the neural network in order to compute inferences based on received inputs.
[0027] The system receives a weight input group (step 102) and an activation input group (step 104) for a given layer. The weight input group and the activation input group can be received from a dynamic memory and a unified buffer of a dedicated hardware circuit, respectively. In some implementations, both the weight input group and the activation input group can be received from a unified buffer.
[0028] The system generates a cumulative value based on the weight inputs and the activation inputs using a matrix product unit of a dedicated hardware circuit (step 106). In some implementations, the cumulative value can be a dot product of a group of weight inputs and a group of activation inputs. That is, for a group of weights that is a subset of all weights in the layer, the system can multiply each weight input with each activation input and add the products together to form the cumulative value. The system can then calculate the dot products of other groups of weights with other groups of activation inputs.
[0029] The system can generate layer outputs based on the accumulated values using a vector computing unit of a dedicated hardware circuit (step 108). In some implementations, the vector computing unit applies an activation function to the accumulated values, which will be referred to below. Figure 5 The output of a layer can be stored in a unified buffer, used as input to a subsequent layer in the neural network, or can be used to determine an inference. When the received input has been processed through each layer of the neural network to generate an inference for the received input, the system completes processing of the neural network.
[0030] Figure 2 An exemplary application specific integrated circuit 200 for performing neural network calculations is shown. System 200 includes a host interface 202. Host interface 202 is capable of receiving instructions that include parameters for neural network calculations. The parameters may include one or more of the following: how many layers should be processed; a corresponding set of weight inputs for each layer of the model; an initial setting of activation inputs, i.e., inputs to the neural network based on which inference is calculated; corresponding input and output sizes for each layer; a step value for the neural network calculation; and the type of layer to be processed, e.g., a convolutional layer or a fully connected layer.
[0031] The host interface 202 can send instructions to a sequencer 206, which converts the instructions into low-level control signals that control the circuit to perform neural network calculations. In some implementations, the control signal specifies the data flow in the circuit, for example, how the weight input group and the activation input group flow through the circuit. The sequencer 206 can send control signals to a unified buffer 208, a matrix calculation unit 212, and a vector calculation unit 214. In some implementations, the sequencer 206 also sends control signals to a direct memory access engine 204 and a dynamic memory 210. In some implementations, the sequencer 206 is a processor that generates control signals. The sequencer 206 can utilize the timing of the control signal at the appropriate time to send the control signal to each component of the circuit 200. In some other implementations, the host interface 202 transmits control signals from an external processor.
[0032] The host interface 202 can send the weight input group and the initial setting of the activation input to the direct memory access engine 204. The direct memory access engine 204 can store the activation input group at the unified buffer 208. In some implementations, the direct memory access stores the weight group to the dynamic memory 210, which can be a memory unit. In some implementations, the dynamic memory is located outside the circuit.
[0033] The unified buffer 208 is a memory buffer. The unified buffer 208 can be used to store the activated input group from the direct memory access engine 204 and the output of the vector calculation unit 214. Figure 5 The vector computation unit is described in more detail. The direct memory access engine 204 is also capable of reading the output of the vector computation unit 214 from the unified buffer 208 .
[0034] The dynamic memory 210 and the unified buffer 208 can send the weight input group and the activation input group to the matrix calculation unit 212, respectively. In some implementations, the matrix calculation unit 212 is a two-dimensional systolic array. The matrix calculation unit 212 can also be a one-dimensional systolic array or other circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the matrix calculation unit 212 is a general-purpose matrix processor.
[0035] The matrix calculation unit 212 can process the weight input and the activation input and provide the output vector to the vector calculation unit 214. In some implementations, the matrix calculation unit sends the output vector to the unified buffer 208, which sends the output vector to the vector calculation unit 214. The vector calculation unit can process the output vector and store the processed output vector to the unified buffer 208. The processed output vector can be used as an activation input to the matrix calculation unit 212, for example, for use in a subsequent layer in the neural network. Figure 3 and Figure 5 The matrix calculation unit 212 and the vector calculation unit 214 are described in more detail.
[0036] Figure 3 An exemplary architecture 300 including a matrix computing unit is shown. The matrix computing unit is a two-dimensional systolic array 306. The array 306 includes a plurality of cells 304. In some implementations, a first dimension 320 of the systolic array 306 corresponds to columns of cells, and a second dimension 322 of the systolic array 306 corresponds to rows of cells. The systolic array can have more rows than columns, more columns than rows, or an equal number of rows and columns.
[0037] In the illustrated example, the value loader 302 sends activation inputs to the rows of the array 306, and the weight fetcher interface 308 sends weight inputs to the columns of the array 306. However, in some other implementations, the activation inputs are transmitted to the columns of the array 306, and the weight inputs are transmitted to the rows of the array 306.
[0038] The value loader 302 can be from, for example Figure 2 The unified buffer 208 of the array 306 receives the activation input. Each value loader 302 can send the corresponding activation input to a different leftmost cell of the array 306. For example, the value loader 312 can send the activation input to the cell 314. The value loader can also send the activation input to the adjacent value loader, and the activation input can be used in another leftmost cell of the array 306. This allows the activation input to be shifted for use in another specific cell of the array 306.
[0039] The weight reader interface 308 can read from, for example Figure 2 The weight reader interface 308 sends the corresponding weight input to the different topmost cells of the array 306. For example, the weight reader interface 308 can send the weight input to cells 314 and 316.
[0040] In some implementations, a host interface, such as Figure 2 The host interface 202 shifts the activation inputs along one dimension, such as to the right, across the array 306, while at the same time shifting the weight inputs along another dimension, such as to the bottom, across the array 306. For example, in one clock cycle, the activation input at cell 314 can be shifted to the activation register in cell 316 located to the right of cell 314. Similarly, the weight input at cell 316 can be shifted to the weight register at cell 318 below cell 314.
[0041] During each clock cycle, each cell can process a given weight input, a given activation input, and the accumulated output from the neighboring cells to generate an accumulated output. The accumulated output can also be transmitted to the neighboring cells along the same dimension as the given weight input. Figure 4 Further describe a single cell.
[0042] The accumulated outputs can be transmitted along the same columns as the weight inputs, for example, toward the bottom of the columns in the array 306. In some implementations, at the bottom of each column, the array 306 can include an accumulator unit 310 that stores and accumulates each accumulated output from each column when performing calculations with a layer having more activation inputs than rows. In some implementations, each accumulator unit stores multiple parallel accumulations. Figure 6 Further described. The accumulator unit 310 can accumulate each accumulated output to generate a final accumulated value. The final accumulated value can be transmitted to the vector calculation unit, for example, Figure 5 The vector computation unit 502. In some other implementations, the accumulator unit 310 transmits the accumulated value to the vector computation unit without performing any accumulation when processing a layer with a layer having fewer activation inputs than rows.
[0043] Figure 4 It is shown that in Figure 3 306 of the systolic array and an exemplary architecture 400 of a cell within such a systolic array.
[0044] The cell may include an activation register 406 that stores an activation input. The activation register can receive an activation input from a left neighboring cell, i.e., a neighboring cell to the left of a given cell, or from a unified buffer, depending on the position of the cell within the systolic array. The cell may include a weight register 402 that stores a weight input. Depending on the position of the cell within the systolic array, the weight input can be transmitted from a top neighboring cell or from a weight reader interface. The cell may also include a sum in register 404. The sum in register 404 can store an accumulated value from a top neighboring cell. A multiplication circuit 408 can be used to multiply the weight input from the weight register 402 by the activation output from the activation register 406. The multiplication circuit 408 can output the product to a sum circuit 410.
[0045] The sum circuit can add the product to the accumulated value from sum register 404 to generate a new accumulated value. Then, sum circuit 410 can send the new accumulated value to another sum register in the register at the bottom adjacent cell. The new accumulated value can be used as an operand for the sum in the bottom adjacent cell.
[0046] The cell can also shift the weight input and activation input to an adjacent cell for processing. For example, the weight register 402 can send the weight input to another weight register in the bottom adjacent cell. The activation register 406 can send the activation input to another activation register located in the right adjacent cell. Therefore, both the weight input and the activation input can be reused by other cells in the array at subsequent clock cycles.
[0047] In some implementations, the cell also includes a control register. The control register can store a control signal that determines whether the cell should shift the weight input to an adjacent cell or the activation input to an adjacent cell. In some implementations, shifting the weight input or the activation input takes one or more clock cycles. The control signal can also determine whether the activation input or the weight input is transmitted to the multiplication circuit 408, or can determine whether the multiplication circuit 408 operates on the activation input or the weight input. The control signal can also be transmitted to one or more adjacent cells, for example, using wires.
[0048] In some implementations, the weights are pre-shifted into the weight path register 412. The weight path register 412 can receive a weight input from, for example, a top neighboring cell, and transmit the weight input to the weight register 402 based on a control signal. During multiple clock cycles, the weight register 402 can statically store the weight input so that when an activation input is transmitted to the cell, for example, through the activation register 406, the weight input remains in the cell and is not transmitted to the neighboring cell. Thus, the weight input can be applied to multiple activation inputs using, for example, the multiplication circuit 408, and the respective accumulated values can be transmitted to the neighboring cells.
[0049] Figure 5 An exemplary architecture 500 of a vector computing unit 502 is shown. The vector computing unit 502 is capable of receiving data from, for example, a reference Figure 2 A vector of accumulated values describing the matrix computation unit such that the matrix computation unit.
[0050] The vector computation unit 502 can process the vector of accumulated values at the activation unit 404. In some implementations, the activation unit includes a circuit that applies a nonlinear function to each accumulated value to generate an activation value. For example, the nonlinear function can be tanh(x), where x is the accumulated value.
[0051] Optionally, the vector calculation unit 502 can normalize the activation value in a normalization circuit 506, which generates a normalized value according to the activation value.
[0052] Also optionally, the vector calculation unit 502 can pool values such as activation values or normalized values using a pooling circuit 508. The pooling circuit 508 can apply an aggregation function to one or more of the normalized values to generate a pooled value. In some implementations, the aggregation function is a function that returns the maximum, minimum, or average value of a normalized value or a subset of normalized values.
[0053] The control signal 510 can be, for example, Figure 2 The control signal 510 is transmitted to the sequencer 206 of , and can specify how the vector calculation unit 502 processes the vector of accumulated values. That is, the control signal 510 can specify whether the activation value is pooled, normalized, or both. The control signal 501 can also specify the activation function, the normalization function, or the pooling function and other parameters such as the step value used for normalization and pooling.
[0054] The vector calculation unit 502 can send values such as activation values, normalized values, or pooled values to the unified buffer, such as Figure 2 The unified cache 208.
[0055] In some implementations, the pooling unit 508 receives the activation values instead of the normalization circuit 506 and stores the pooled values in the unified buffer. In some implementations, the pooling unit 508 sends the pooled values to the normalization circuit 506, which generates the normalized values to be stored in the unified buffer.
[0056] Figure 6 For example, Figure 5 The normalization circuit 506 of FIG. 600 is an exemplary architecture of a normalization circuit. The normalization circuit can receive a signal from, for example, Figure 5 The normalization circuit may be a vector of activation values for activation circuit 504 such as activation circuit 602. Based on the value of the system parameter, the normalization circuit may pass the vector of activation values to the pooling circuit, i.e., without normalizing the activation values, or generate a vector of normalized values from the vector of activation values. For example, if a system parameter provided by, for example, a user instructs the circuit to pass the vector of activation values to the pooling circuit, e.g., if the user does not want the values to be normalized, the system parameter may be a signal to a multiplexor that passes the values directly to the pooling circuit and skips the normalization circuit.
[0057] In some implementations, the vector of activation values includes activation values generated by applying an activation function to accumulated values generated from activation inputs based on the set of weight inputs.
[0058] In some other implementations, the activation values for the weight input group are staggered between the vectors of multiple activation values because of the delays incurred when shifting the activation inputs and weight inputs. For example, the matrix computation unit can generate an accumulation value A based on the activation input group and the weight input group from kernel A. 0 -A n , generates the accumulated value B based on the activation input group and weight input group from kernel B 0 -B n , and generates an accumulated value C based on the activation input group and weight input group from kernel C 0 -C n Because the weight inputs and activation inputs are shifted in the matrix computation unit before the corresponding accumulated values are calculated, the accumulated value A 0 -A n and B 0 -B n can be generated in subsequent clock cycles, as referenced above Figure 4 A. 0 Can be generated at clock cycle 0, A 1 and B 0 Can be generated at clock cycle 1, A 2 , B 1and C 0 Can be generated at clock cycle 2, A n , B n-1 and C n-2 A can be generated at clock cycle n, and so on. The matrix calculation unit can generate A including A for clock cycle x 0 and B 0 A vector of accumulated values, and A for clock cycle X+1 1 and B 1 Thus, the accumulated values for a given kernel, for example A from kernel A 0 -A n Multiple vectors of accumulated values that can be extended to subsequent clock cycles in a staggered manner.
[0059] As a result, multiple vectors of accumulated values can be used, for example, to Figure 5 After being processed by the activation circuit 504 of the activation circuit 602, the activation values are transformed into multiple vectors of activation values, and each of the multiple vectors of activation values can be sent to different normalization register columns respectively. In particular, the activation circuit 602 can send each activation value from the vector of activation values to different normalization register columns, such as 604, 606, 608 and 610. In particular, normalization registers such as 616, 618, 620 and 622 can receive their respective activation values respectively. The normalization register column may include a group of normalization registers connected in series. That is, the output of the first normalization register in the column can be sent as an input to the second normalization register in the column. In some implementations, each normalization register stores the activation value. In some other implementations, each normalization register also stores the square of the activation value. In some implementations, the normalization circuit has as many normalization register columns as the columns in the activation circuit or the systolic array.
[0060] In some implementations, before providing the vector of activation values to the normalization register column, the circuit sends the vector to a squaring unit. The squaring unit can calculate the square of each activation value for use in calculating the normalization value as further described below. The squaring unit can generate a vector of squared activation values, i.e., for each vector of activation values, and send the vector of squared activation values to the normalization register column. In some other implementations, the squaring unit sends both the vector of activation values and the vector of squared activation values to the normalization register column.
[0061] In some implementations, the normalization circuit forms staggered groups, such as staggered groups 624 and 628, based on a normalization radius parameter. The normalization radius parameter can represent the number of outputs from the surrounding normalization registers used when calculating the normalized value. The number of outputs can be equal to twice the normalization radius parameter. By way of illustration, staggered groups 624 and 628 are formed by a normalization radius parameter of 1. Staggered group 624 includes normalization units 626 and 630, and also includes a zero register 636. When calculating the normalized value at the edge of the normalization circuit, the zero register 636 can always output a value of 0 and can be used as a buffer. The zero registers 636 and 638 can be included in a column of the zero register 612. Reference will be made below to Figure 7 Examples of values within staggered groups are further described.
[0062] In some implementations, a normalization unit, such as normalization units 626, 630, uses the outputs from the staggered groups to generate corresponding components for calculating normalized values, such as the squares of the activation values within the registers of the staggered groups. For example, the components can be used to generate the sum of the squares of all activation values. The normalization unit can use the sum of the squares to calculate the normalized value, which will be further described below. In some implementations, there is a corresponding normalization unit for each staggered group.
[0063] The normalization circuit can generate a normalization value for the activation value based on the staggered group. For example, the normalization value for the activation value stored in the normalization register 632 can be stored in the normalization unit 626. In particular, based on the staggered group 624, the normalization circuit can calculate the sum of all squares generated by the normalization registers in the staggered group 624 using, for example, a summation circuit. The sum can be stored in the normalization unit 626. The sum can be a normalization value corresponding to the activation value. The normalization circuit can continue to generate another corresponding normalization value for the staggered group 628, which includes the normalization registers 634, 640 and 620, and the corresponding normalization value can be stored in the normalization unit 630.
[0064] The normalization circuit can form a vector of normalized values from the generated normalized values, which can be stored in the normalization unit, for example, and can send the vector of normalized values to the pooling circuit, or to the unified buffer if determined by the neural network parameters.
[0065] Figure 7 Another exemplary architecture 700 of a normalization circuit with sampled activation values within a normalization register is shown. Figure 7704, 706, 708, 710, and 712. The normalized radius parameter may be 1, as illustrated in staggered groups 724 and 728. In particular, staggered group 724 includes normalized registers 732 and 718 and zero register 736. Staggered group 728 includes zero register 738 and normalized registers 734 and 740.
[0066] Normalization registers such as 716, 718, 720, 732, 734, and 740 may store, for example, activation values corresponding to columns from a systolic array. The notation AX,Y, such as A0,0, of normalization register 740 represents an activation value corresponding to column X in clock cycle Y.
[0067] As illustrated in the figures, the activation values are loaded in a staggered manner. For example, in clock cycle 0, the activation values A0,0, A1,0, and A2,0 may be calculated, but the normalization circuit loads these three activation values during three clock cycles. In some implementations, the activation values are loaded in a non-staggered manner. That is, A0,0, A1,0, and A2,0 may be loaded in one clock cycle.
[0068] N0 may be the normalization value for A0,1 stored in normalization register 726. N0 may be calculated based on the sum of the squares of A0,1, A1,1, and 0 (from zero register 736), which will be referred to below. Figure 8 Similarly, N1 may be the normalization value for A0,0 stored in normalization register 730, calculated based on the sum of the squares of A0,0, A1,0, and A2,0 (from register 720).
[0069] The normalization circuit may calculate a normalization value for each activation value using radius 1. Other radii may be used. If the normalization circuit has not yet loaded the activation value required for the normalization calculation, the normalization circuit may shift the activation value to a subsequent normalization register until the required activation value is loaded. For example, calculating the normalization value for the activation value A0,2 stored in the normalization register 716 requires the activation value A1,2 according to radius 1. The activation value A1,2 may be loaded into the normalization register 718 in a subsequent clock cycle, at which time the normalization circuit may calculate the normalization value for the activation value A0,2.
[0070] Figure 8An exemplary architecture 800 of a normalization unit within a normalization circuit is shown. The normalization unit may receive an activation value 802. In some implementations, the activation value 802 is transmitted to a subsequent normalization unit through a multiplexer 814, for example, when the circuit determines that the activation value 802 is in an incorrect location, i.e., the activation value needs to be stored in a subsequent normalization unit for normalization calculations. The normalization circuit may send a control signal to the multiplexer 814 to pass a specific output, such as a normalized value or an unaffected activation value.
[0071] In some implementations, the activation value is passed to a squaring circuit 804. The squaring circuit 804 can generate a squared activation value 808, i.e., generate the activation value to the second power. The squaring circuit 804 can send the squared activation value 808 to adjacent normalization units, e.g., other normalization units in the same staggered group of normalization units.
[0072] In some implementations, the received activation values are squared before being provided to the normalization register column, as described above with reference to Figure 6 described.
[0073] The normalization unit may also receive a squared activation value 810 from an adjacent normalization unit at a summing circuit 806. The summing circuit 806 may generate a sum of the squared activation value 808 and the received squared activation value 810.
[0074] The sum may be sent to a memory unit 812. In some implementations, the memory unit 812 includes a lookup table and an interpolation unit. The normalization unit may use a portion of the sum, e.g., a set of high bits of the sum, as an address to look up one or more coefficients provided by the system parameters. The memory and interpolation unit 812 may generate a normalized scaling factor based on the coefficients and the sum of the squared activation values. The normalized scaling factor may be sent to a multiplication unit 816.
[0075] In some implementations, the sum of the squares is a 12-bit value. The normalization unit can use the top 4 bits of the sum of the squares as an index to a lookup table. The top 4 bits can be used to read coefficients specified by a user, for example, from a lookup table. In some implementations, the top 4 bits read 2 12-bit coefficients: A & B. The bottom eight bits can be the delta used in the equation for calculating the normalized scaling factor. Using the scaling factor gives an exemplary equation = minimum(1048575, [A*delta+B*256+2^7]) >> 8, where minimum processes two arguments and returns the argument with the minimum value.
[0076] The normalization unit may utilize a multiplication unit 816 to multiply the normalization scaling factor by the activation value 802 to generate a normalized value. In some implementations, the normalized value is then sent to, for example, Figure 5 The pooling circuit 508 is such a pooling circuit.
[0077] Fig. 9 An exemplary architecture 900 of a pooling circuit is shown. The pooling circuit can apply a clustering function to one or more normalized values or activation values to generate a pooled value. By way of illustration, the architecture 900 can perform pooling of 4x4 groups of activation values or normalized values. Although Fig. 9 The pooling shown has a square area, ie, 4x4, but it can also be a rectangular area. For example, if the area has a window of nxm, then the architecture 900 can have n*m registers, ie, n columns and m rows.
[0078] The pooling circuit can be obtained from e.g. Figure 5 The normalization circuit 506 receives a sequence of elements from a vector of normalization values. For example, the sequence can represent pixels of an 8x8 portion of an image, and the pooling circuit architecture 900 can pool values from a 4x4 subset of the 8x8 portion. In some implementations, the normalization values are added to the sequence once calculated by the normalization circuit coupled to the pooling circuit. In some implementations, the neural network processor includes multiple parallel pooling circuits. During each clock cycle, each pooling circuit can receive a respective element from the vector of normalization values from the normalization circuit. Each pooling circuit can interpret the elements received from the normalization circuit as a two-dimensional image arriving in a grid order.
[0079] The pooling circuit may include a series of registers and memory cells. Each register may send an output to an aggregation circuit 906, which applies an aggregation function to the values stored in the register. The aggregation function may return a minimum, maximum, or average value from a set of values.
[0080] The first normalized value may be sent to and stored in register 902. At a subsequent clock cycle, the first normalized value may be shifted to a subsequent register 908 and stored in memory 904, and a second normalized value may be sent to and stored in register 902.
[0081] After four clock cycles, the four normalized values are stored in the first four registers 902, 908, 910, and 912. In some implementations, the memory unit 904 operates under a first-in, first-out (FIFO). Each memory unit can store up to eight normalized values. After the memory unit 904 contains a complete row of pixels, the memory unit 904 can send the normalized values to the register 914.
[0082] At any given point in time, the aggregation circuit 906 may read a normalized value from each register. The normalized values in the registers should represent the normalized values of the 4x4 portion of the image.
[0083] The pooling circuit may generate a pooling value, such as a maximum, minimum, or average normalized value, based on the read normalized values by using the aggregation circuit 906. The pooling value may be sent to a unified buffer, such as Figure 2 The unified cache 208.
[0084] After generating the first pooled value, the pooling circuit may continue to generate pooled values by shifting the normalized value using each register so that the new normalized value is stored in the register and can be pooled by the aggregation circuit 906. For example, in architecture 900, the pooling circuit may shift the normalized value in another 4 clock cycles, thereby shifting the normalized value in the memory cell into the register. In some implementations, the pooling circuit shifts the new normalized value until the new normalized value is stored in the last top register, such as register 916.
[0085] Aggregation circuitry 906 may then pool the new normalized values stored in the registers.
[0086] In some implementations, the pooling circuit receives a vector of activation values rather than a vector of normalized values, as described above with reference to Figure 5 described.
[0087] The embodiments and functional operations of the subject matter described in this specification may be implemented in: digital electronic circuits, tangibly implemented computer software or firmware, computer hardware, including the structures disclosed in this specification and their structural equivalents, or a combination of more than one of the above. The embodiments of the subject matter described in this specification may be implemented as one or more computer programs, that is, one or more modules of computer program instructions encoded on one or more tangible non-transitory program carriers, for execution by a data processing device or to control the operation of the data processing device. Alternatively or in addition, the program instructions may be encoded on an artificially generated propagating signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated as encoded information for transmission to an appropriate receiver device executed by the data processing device. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of the above devices.
[0088] The term "data processing equipment" includes all kinds of equipment, devices and machines for processing data, including, as examples, programmable processors, computers or multiple processors or multiple computers. The equipment may include special-purpose logic circuits, such as FPGAs (field programmable gate arrays) or ASICs (application-specific integrated circuits). In addition to hardware, the equipment may also include code that creates an execution environment for related computer programs, such as code constituting processor firmware, protocol stacks, database management systems, operating systems, or a combination of one or more of them.
[0089] A computer program (which may also be referred to or described as a program, software, software application, module, software module, script or code) may be written in any form of programming language, including compiled or interpreted languages or declarative or procedural languages, and the computer program may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment. A computer program may, but need not, correspond to a file in a file system. A program may be stored in a portion of a file that stores other programs or data, for example, one or more scripts stored in the following: in a markup language document; in a single file dedicated to a related program; or in multiple collaborative files, for example, files storing one or more modules, subroutines or code portions. A computer program may be deployed to execute on one or more computers, the computers being located in one place or distributed to multiple locations and interconnected by a communication network.
[0090] The processes and logic flows described in this specification may be performed by one or more programmable computers that execute one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows may also be performed by special purpose logic circuits, such as FPGAs (field programmable gate arrays) or ASICs (application specific integrated circuits), and the apparatus may also be implemented as special purpose logic circuits.
[0091] The computer suitable for implementing the computer program includes and exemplarily can be based on a general-purpose microprocessor or a special-purpose microprocessor or both of the above-mentioned processors, or any other kind of central processing unit. Generally, the central processing unit will receive instructions and data from a read-only memory or a random access memory or both. The main element of the computer is a central processing unit for running or executing instructions and one or more memory devices for storing instructions and data. Generally, the computer will also include or be operably coupled to receive data from one or more large-capacity storage devices for storing data or transfer data to the large-capacity storage device, or receive and transfer both, and the large-capacity storage device is, for example, a magnetic disk, a magneto-optical disk or an optical disk. However, the computer does not necessarily have such a device. In addition, the computer can be embedded in another device, for example, a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver or a removable storage device, for example, a universal serial bus (USB) flash drive, etc.
[0092] Computer readable media suitable for storing computer program instructions and data include all forms of nonvolatile memory, media and memory devices, including, as examples: semiconductor memory devices, such as EPROM, EEPROM and flash memory devices; magnetic disks, such as internal hard disks or removable disks; magneto-optical disks; CD-ROM and DVD-ROM disks. The processor and memory may be supplemented by or incorporated into a special purpose logic circuit.
[0093] To transmit interactions with a user, embodiments of the subject matter described in this specification may be implemented on a computer having: a display device, such as a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, for displaying information to the user; and a keyboard and a pointing device, such as a mouse or a trackball, with which the user can transmit input to the computer. Other kinds of devices may also be used to transmit interactions with a user; for example, feedback provided to the user may be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback; and input from the user may be received in any form, including acoustic input, voice input, or tactile input. In addition, a computer may interact with a user by sending documents to a device used by the user and receiving documents from the device; for example, by sending a web page to a web browser on a user's client device in response to a request received from the web browser.
[0094] The embodiments of the subject matter described in this specification can be implemented in a computing system, which includes a back-end component such as a data server, or includes an intermediate component such as an application server, or includes a front-end component such as a client computer, and the client computer has a graphical user interface or a web browser, and a user can interact with the implementation of the subject matter described in this specification through a graphical user interface or a web browser, or the computer system includes any combination of one or more such back-end components, intermediate components, or front-end components. The components in the system can be interconnected by digital data communication of any form or medium such as a communication network. Examples of communication networks include local area networks ("LANs") and wide area networks ("WANs"), for example, the Internet.
[0095] A computing system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship between a client and a server arises from computer programs running on respective computers and having a client-server relationship with each other.
[0096] Although this specification contains many specific implementation details, these should not be interpreted as limitations on the scope of any invention or the scope of what can be claimed, but rather as an illustration of features that can concretize a particular embodiment of a particular invention. The specific features described in this specification in the context of independent embodiments can also be implemented in combination with a single embodiment. Conversely, the various features described in the context of a single embodiment can also be implemented independently in multiple embodiments, or in any suitable sub-combination. In addition, although the features can be described above as a combination effect and even initially required, one or more features from the required combination can be removed from the combination in some cases, and the required combination can be turned to a sub-combination or a variation of the sub-combination.
[0097] Similarly, although operations are described in the accompanying drawings in a particular order, it should not be understood that: in order to achieve the desired results, such operations are required to be performed in the particular order shown or in a sequential order, or that all illustrated operations are performed. In certain cases, multitasking and parallel processing can be advantageous. In addition, the separation of various system modules and components in the above-mentioned embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that program components and systems can generally be integrated into a single software product or packaged into multiple software products.
[0098] Specific implementations of the subject matter have been described. Other implementations are within the scope of the following claims. For example, the activities recited in the claims can be performed in a different order and still achieve the desired results. As an example, the processes described in the accompanying drawings do not necessarily require the specific order or sequential order shown in order to achieve the desired results. In certain implementations, multitasking and parallel processing may be advantageous.
Claims
1. A circuit for performing neural network calculations, the circuit include: A vector calculation unit, wherein the vector calculation unit comprises: A pooling circuit, the pooling circuit being configured to: receiving a set of values from other circuitry included in the vector computation unit, the set of values being a computational output of a neural network layer; performing a specific pooling function on the value group, the specific pooling function being used to pool one or more values in the value group; and generating a pooled value based on the specific pooling function for pooling one or more values in the value group, The pooling circuit is further configured to: storing the value groups in a plurality of registers and a plurality of memory cells included in the pooling circuit, The plurality of registers are connected in series with the plurality of memory cells, each register is configured to store one value in the value group, and each memory cell is configured to store a plurality of values in the value group.
2. The circuit according to claim 1, in, The value set includes normalized values, and the pooling circuit includes an aggregation circuit configured to: An aggregation function is applied to one or more of the normalized values to generate the pooled value, the aggregation function representing the particular pooling function used to pool one or more values in the group of values.
3. The circuit according to claim 2, in, The aggregation function is operable to cause the pooling circuit to return: the maximum, minimum or average of the normalized values in the value group; or The maximum, minimum, or average value of a subset of the normalized values in the set of values.
4. The circuit of claim 3, wherein the specific pooling function is specified by a control signal received by the vector computation unit.
5. The circuit of claim 1 , wherein the pooling circuit is further configured to: Pooling of the M x N value groups is performed based on the particular pooling function, where each of M and N is a respective integer greater than or equal to 1.
6. The circuit according to claim 1, in: The vector calculation unit includes a plurality of parallel pooling circuits; and Each pooling circuit of the plurality of parallel pooling circuits is configured to receive a corresponding element from the group of values on a given clock cycle.
7. The circuit of claim 1 , wherein the pooling circuit is configured to, after each clock cycle, shift a given value in the value group to a subsequent register or memory cell of the pooling circuit to generate the pooled value from the value group.
8. The circuit of claim 1, wherein the value group comprises a vector of accumulated values, and the pooling circuit generates the pooled values based on a particular pooling function specified by a control signal received to the quantity calculation unit.
9. The circuit of claim 8 , wherein the control signal specifies one or more parameters used by the pooling circuit to pool one or more values in the value group, at least one parameter comprising a step size value for a particular neural network layer of the neural network.
10. A method for performing neural network calculations, the method include: receiving, by a pooling circuit included in a vector computation unit, a set of values for performing said neural network computation; The pooling circuit performs a specific pooling function on the value group, the specific pooling function being used to pool one or more values in the value group; generating, by the pooling circuit, a pooled value based on the specific pooling function for pooling one or more values in the value group; The pooling circuit provides the pooled value to other circuits included in the vector calculation unit to perform the neural network calculation; and storing, by the pooling circuit, the value group in a plurality of registers and a plurality of memory cells included in the pooling circuit, The plurality of registers are connected in series with the plurality of memory cells, each register is configured to store one value in the value group, and each memory cell is configured to store a plurality of values in the value group.
11. The method of claim 10, wherein the value set comprises normalized values, and the method further comprises: include: An aggregation function is applied by the pooling circuit to one or more of the normalized values to generate the pooled value, the aggregation function representing the particular pooling function used to pool one or more values in the group of values.
12. The method according to claim 11, in, The aggregation function is operable to cause the pooling circuit to return: the maximum, minimum or average of the normalized values in the value group; or The maximum, minimum, or average value of a subset of the normalized values in the set of values.
13. The method of claim 12, wherein the specific pooling function is specified by a control signal received by the vector computing unit.
14. The method according to claim 10, further comprising: include: After each clock cycle, a given value in the value group is shifted by the pooling circuit to a subsequent register or memory unit of the pooling circuit to generate the pooled value according to the value group.
15. The method of claim 10, wherein generating the pooled value include: The pooled values are generated based on a specific pooling function specified by a control signal received to the quantity calculation unit.
16. The method according to claim 15, further comprising: include: The pooling circuit pools one or more values in the value group based on a control signal, wherein the control signal specifies one or more parameters for pooling the one or more values, at least one parameter including a step size value for a specific neural network layer of the neural network.
17. The method of claim 10, wherein a specific pooling function is performed on the value group include: Pooling of the M x N value groups is performed based on the particular pooling function, where each of M and N is a respective integer greater than or equal to 1.
18. A non-transitory machine-readable storage device storing instructions for performing neural network calculations, the instructions being executable by a processor to cause operations to be performed, the operations include: receiving, by a pooling circuit included in a vector computation unit, a set of values for performing said neural network computation; The pooling circuit performs a specific pooling function on the value group, the specific pooling function being used to pool one or more values in the value group; generating, by the pooling circuit, a pooled value based on the specific pooling function for pooling one or more values in the value group; The pooling circuit provides the pooled value to other circuits included in the vector calculation unit to perform the neural network calculation; and The value group is stored in a plurality of registers and a plurality of memory cells, wherein the plurality of registers are connected in series with the plurality of memory cells, each register is configured to store one value in the value group, and each memory cell is configured to store a plurality of values in the value group.
Citation Information
Patent Citations
Intelligent pooling device and method thereof
CN104485715A
Apparatus and method for detecting or recognizing pattern by employing a plurality of feature detecting elements
US20020038294A1
Method and device for controlling a short circuiting type welding system
US4717807A
Digital computation integrated circuit for convolution type computations
US5005149A
Systolic array image processing system
US5138695A
