CN110489819B - Anti-pooling operation method and circuit - Google Patents

Anti-pooling operation method and circuit Download PDF

Info

Publication number
CN110489819B
CN110489819B CN201910690114.6A CN201910690114A CN110489819B CN 110489819 B CN110489819 B CN 110489819B CN 201910690114 A CN201910690114 A CN 201910690114A CN 110489819 B CN110489819 B CN 110489819B
Authority
CN
China
Prior art keywords
pooling
unit
value
effective
reduction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910690114.6A
Other languages
Chinese (zh)
Other versions
CN110489819A (en
Inventor
廖裕民
卢捷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Rockchip Electronics Co Ltd
Original Assignee
Rockchip Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rockchip Electronics Co Ltd filed Critical Rockchip Electronics Co Ltd
Priority to CN201910690114.6A priority Critical patent/CN110489819B/en
Publication of CN110489819A publication Critical patent/CN110489819A/en
Application granted granted Critical
Publication of CN110489819B publication Critical patent/CN110489819B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention provides an inverse pooling operation method and a circuit, wherein the method comprises the following steps: the data acquisition control unit acquires at least one effective value and coordinate values corresponding to the effective values from the data cache unit, stores the acquired effective values in the effective value cache unit, and stores the coordinate values corresponding to the effective values in the coordinate value cache unit; the pooling reduction unit reduces the pooling blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the valid point judging unit judges whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if yes, the restoration writing control unit writes the numerical value of the valid point into the restoration caching unit; the restoring and reading control unit reads the effective points in the restoring and caching unit and writes the read effective values back to the data caching unit through the bus write-back unit. The anti-pooling operation circuit has clear logic and easy control, and can efficiently realize anti-pooling operation.

Description

Anti-pooling operation method and circuit
Technical Field
The invention relates to the field of chip circuit design, in particular to an inverse pooling operation method and circuit.
Background
With the rapid development of artificial intelligence deep learning neural networks, people have more and more strong demands on artificial intelligence application. Due to the fact that the deep learning neural network has high requirements on hardware resources, huge power consumption is generated during operation, and the problems that the endurance capacity of electronic equipment is poor, the power consumption is large and the like are caused. The inverse pooling technology is one of the most important calculations in the neural network operation process, the inverse pooling calculation is often handed to a general purpose computing unit such as a CPU or a GPU by the existing neural network accelerating circuit, and the pooling calculation is often a bottleneck of the whole neural network operation due to the huge calculation amount and the complex control.
Disclosure of Invention
Therefore, a technical scheme of inverse pooling operation needs to be provided to solve the problem of large power consumption in the operation process due to large calculation amount and complex control of inverse pooling operation.
In order to achieve the above object, the inventor provides an anti-pooling operation circuit, which includes a data fetch control unit, a valid value caching unit, a coordinate value caching unit, a pooling reduction unit, a valid point determining unit, a reduction write control unit, a reduction caching unit, a reduction read control unit, and a bus write-back unit;
the data fetching control unit is respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is also respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is connected with the effective point judgment unit, the effective point judgment unit is connected with the reduction writing control unit, the reduction writing control unit is connected with the reduction cache unit, the reduction cache unit is connected with the reduction reading control unit, and the reduction reading control unit is connected with the bus write-back unit;
the data acquisition control unit is used for acquiring at least one effective value and coordinate values corresponding to the effective values from the data cache unit, storing the acquired effective values in the effective value cache unit and storing the coordinate values corresponding to the effective values in the coordinate value cache unit;
the pooling reduction unit is used for reducing pooling blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the pooling block comprises a plurality of pooling windows, and each pooling window is restored according to an effective value and a coordinate position corresponding to the effective value;
the valid point judging unit is used for judging whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if so, the restoration writing control unit writes the numerical value of the valid point into the restoration cache unit;
the reduction reading control unit is used for reading the effective points in the reduction cache unit and writing back the read effective values to the data cache unit through the bus write-back unit.
Furthermore, the reduction cache unit comprises a plurality of cache groups, each cache group comprises a plurality of caches, and each cache is used for storing a valid point value; the reduction writing control unit writes the valid point value into the reduction cache unit includes:
and the reduction writing control unit writes the effective point numerical values in the current pooling window into the corresponding buffer group in sequence by taking the pooling window as a unit.
Further, the number of buffers included in each buffer set is the value of the size of the pooling window.
Further, the recovery reading control unit reads the valid point values in the cache set based on the row or column ordering of the pooled blocks according to the coordinate order of each valid point on the pooled blocks.
Further, the "pooling reduction unit is configured to reduce the pooled blocks according to the obtained effective values and the coordinate positions corresponding to the effective values" includes:
the pooling reduction unit fills the effective value to the corresponding position in the pooling window according to the effective value and the coordinate position corresponding to the effective value, and fills the numerical value corresponding to the effective value to other positions except the effective value in the pooling window according to a preset pooling rule; and executing the operation until all the pooling windows corresponding to the effective values are restored, and obtaining a pooling block.
The invention also provides an anti-pooling operation method, which is applied to an anti-pooling operation circuit, wherein the circuit comprises a data acquisition control unit, a valid value caching unit, a coordinate value caching unit, a pooling reduction unit, a valid point judgment unit, a reduction writing control unit, a reduction caching unit, a reduction reading control unit and a bus write-back unit;
the data fetching control unit is respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is also respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is connected with the effective point judgment unit, the effective point judgment unit is connected with the reduction writing control unit, the reduction writing control unit is connected with the reduction cache unit, the reduction cache unit is connected with the reduction reading control unit, and the reduction reading control unit is connected with the bus write-back unit;
the method comprises the following steps:
the data acquisition control unit acquires at least one effective value and coordinate values corresponding to the effective values from the data cache unit, stores the acquired effective values in the effective value cache unit, and stores the coordinate values corresponding to the effective values in the coordinate value cache unit;
the pooling reduction unit reduces the pooled blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the pooling block comprises a plurality of pooling windows, and each pooling window is restored according to an effective value and a coordinate position corresponding to the effective value;
the valid point judging unit judges whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if so, the restoration writing control unit writes the numerical value of the valid point into the restoration cache unit;
the restoring and reading control unit reads the effective points in the restoring and caching unit and writes the read effective values back to the data caching unit through the bus write-back unit.
Furthermore, the reduction cache unit comprises a plurality of cache groups, each cache group comprises a plurality of caches, and each cache is used for storing a valid point value; the reduction writing control unit writes the valid point value into the reduction cache unit includes:
and the reduction writing control unit writes the effective point numerical values in the current pooling window into the corresponding buffer group in sequence by taking the pooling window as a unit.
Further, the number of buffers included in each buffer set is the value of the size of the pooling window.
Further, the method comprises:
and the restoring and reading control unit reads the effective point numerical values in the cache group based on the row or column sorting of the pooling blocks according to the coordinate sequence of each effective point on the pooling blocks.
Further, the "pooling reduction unit is configured to reduce the pooled blocks according to the obtained effective values and coordinate positions corresponding to the effective values" includes:
the pooling reduction unit fills the effective value to a corresponding position in a pooling window according to the effective value and a coordinate position corresponding to the effective value, and fills a numerical value corresponding to the effective value to other positions except the effective value in the pooling window according to a preset pooling rule; and executing the operation until all the pooling windows corresponding to the effective values are restored, and obtaining a pooling block.
The inverse pooling operation method and the circuit in the technical scheme comprise the following steps: the data acquisition control unit acquires at least one effective value and coordinate values corresponding to the effective values from the data cache unit, stores the acquired effective values in the effective value cache unit, and stores the coordinate values corresponding to the effective values in the coordinate value cache unit; the pooling reduction unit reduces the pooled blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the valid point judging unit judges whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if yes, the restoration writing control unit writes the numerical value of the valid point into the restoration caching unit; the restoring and reading control unit reads the effective points in the restoring and caching unit and writes the read effective values back to the data caching unit through the bus write-back unit. The anti-pooling operation circuit has clear logic and easy control, and can efficiently realize anti-pooling operation.
Drawings
FIG. 1 is a schematic diagram of an inverse pooling circuit according to an embodiment of the present invention;
FIG. 2 is a flowchart of an inverse pooling method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an inverse pooling operation according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a process for determining valid points of a pooling window according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a process for determining valid points of a pooling window according to another embodiment of the present invention;
FIG. 6 is a diagram illustrating a process of determining valid points of a pooling window according to another embodiment of the present invention
FIG. 7 is a diagram illustrating a process for determining valid points of a pooling window according to another embodiment of the present invention;
FIG. 8 is a diagram illustrating the write-back control unit writing valid dot values according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating reading of valid point values according to a pooled block row ordering according to an embodiment of the present invention;
FIG. 10 is a diagram illustrating a read command unit reading a valid dot value according to an embodiment of the present invention.
Description of reference numerals:
101. a fetch control unit; 102. an effective value caching unit; 103. a coordinate value caching unit; 104. a pooling reduction unit; 105. an effective point judgment unit; 106. a restore write control unit; 107. a reduction cache unit; 108. a recovery read control unit; 109. a bus write-back unit; 110. a bus transmission assembly unit; 111. and a data buffer unit.
Detailed Description
To explain technical contents, structural features, and objects and effects of the technical solutions in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
Fig. 3 is a schematic diagram of an inverse pooling operation according to an embodiment of the present invention. The forward pooling operation of the preceding network layer stores the pooling result together with the selected pooling point coordinates in the data cache unit (e.g., DDR) before the inverse pooling operation is performed, so that the pooling result and the coordinate position corresponding to the pooling point can be directly read out from the data cache unit as input data to perform the inverse pooling operation when the inverse pooling operation is performed. Specifically, the inverse pooling operation is implemented by:
for the anti-pooling operation in the max-pooling mode, after the value of the pooling point (i.e., the winner value) and the corresponding coordinate position thereof are obtained, the remaining points in the pooling window except the winner point are filled with zeros according to the size of the pooling window. Because the winner value is greater than zero, the winner value can be guaranteed to be the maximum value in the filled pooling window, and therefore the anti-pooling operation in the maximum pooling mode is realized.
For the anti-pooling operation in the minimum pooling mode, after the pooling point values (i.e., the winner values) and their corresponding coordinate positions are obtained, the remaining points within the pooling window, excluding the winner points, are filled with configuration values (denoted by f in fig. 3) according to the size of the pooling window. Preferably, the configuration value is a value with a larger value, so that the winner value in the filled pooling window can be ensured to be the minimum value, and therefore, the anti-pooling operation in the minimum pooling mode can be realized.
For the anti-pooling operation in the average pooling mode, after the pooling point values (i.e., the winner values) and their corresponding coordinate positions are obtained, the remaining points within the pooling window, except for the winner points, are filled to the same values as the winner according to the size of the pooling window. In this way, it is ensured that all values in the filled pooling window are equal, thereby achieving the anti-pooling operation in the average pooling mode.
Referring to fig. 1, a schematic diagram of an inverse pooling operation circuit according to an embodiment of the invention is shown. The circuit comprises a data acquisition control unit 101, a valid value cache unit 102, a coordinate value cache unit 103, a pooling reduction unit 104, a valid point judgment unit 105, a reduction write control unit 106, a reduction cache unit 107, a reduction read control unit 108 and a bus write-back unit 109.
The access control unit 101 is respectively connected with the valid value cache unit 102 and the coordinate value cache unit 103, the pooling reduction unit 104 is further respectively connected with the valid value cache unit 102 and the coordinate value cache unit 103, the pooling reduction unit 104 is connected with the valid point judgment unit 105, the valid point judgment unit 105 is connected with the reduction write control unit 106, the reduction write control unit 106 is connected with the reduction cache unit 107, the reduction cache unit is connected with the reduction read control unit, and the reduction read control unit is connected with the bus write-back unit;
the data access control unit 101 is configured to obtain at least one valid value and coordinate values corresponding to the valid value from the data caching unit 111, store the obtained valid value in the valid value caching unit 102, and store the coordinate values corresponding to the valid value in the coordinate value caching unit 103;
the pooling reduction unit 104 is configured to reduce pooled blocks according to the obtained effective values and coordinate positions corresponding to the effective values; the pooling block comprises a plurality of pooling windows, and each pooling window is restored according to an effective value and a coordinate position corresponding to the effective value;
the valid point judging unit 105 is configured to judge whether each value included in the current pooling window is a valid point according to the size and the step value of the pooling window, and if yes, the restoration write control unit 106 writes the valid point value into the restoration cache unit 107; the valid point is a numerical value of a point which moves with the stepping of the pooling window but the value of which is not updated.
The restore and read control unit 108 is configured to read the valid point in the restore cache unit, and write back the read valid value to the data cache unit 111 through the bus write-back unit 109.
The anti-pooling operation circuit of the embodiment has clear logic and easy control, and can efficiently realize anti-pooling operation.
In some embodiments, the "pooling reduction unit is configured to reduce the pooled blocks according to the obtained effective values and the coordinate positions corresponding to the effective values" includes: the pooling reduction unit fills the effective value to a corresponding position in a pooling window according to the effective value and a coordinate position corresponding to the effective value, and fills a numerical value corresponding to the effective value to other positions except the effective value in the pooling window according to a preset pooling rule; and executing the operation until all the pooling windows corresponding to the effective values are restored, and obtaining a pooling block.
The determination of the valid point will be specifically described below with reference to fig. 4 to 7.
As shown in fig. 4, assuming that the size of the pooling window is 2x2, the moving step value is 1, and there is no padding (there is no boundary, the boundary value remains the same along with the movement of the pooling window), the pooling direction is from left to right, from top to bottom, and according to the position of the current pooling window in the whole pooling block (the size of the pooling block in fig. 4 to 7 is 7x 7), the following 4 cases can be classified:
when the pooling window is located at a position of 'non-last row and non-rightmost column' in the pooling block (that is, the current pooling window does not intersect with the last row and the rightmost column of the whole pooling block), the computed value is updated only by the point 1 at the upper left, that is, when the pooling window is moved to the next position, only the value at the upper left corner in the 2x2 pooling window is not updated again, so that the upper left corner of the current pooling window can be determined as a valid point, and the value is written into the reduction cache unit.
When the pooling window is located at a position of a non-last line and a rightmost column in the pooling block (i.e. the current pooling window does not have an intersection with the last line of the whole pooling block but has an intersection with the rightmost column), the calculated value is updated by only 2 points above, i.e. when the pooling window is moved to the next position, only two point values located above the 2x2 pooling window are not updated again, so that the two points above the current pooling window can be determined as valid points, and the values of the two points are written into the reduction cache unit.
When the pooling window is located in the position of the last row and not the rightmost column in the pooling block (i.e. the current pooling window intersects with the last row of the whole pooling block but does not intersect with the rightmost column), the computed value is updated by only the left 2 points, i.e. when the pooling window is moved to the next position, the values of only the two points located on the left in the 2x2 pooling window are not updated again, so that the two points on the left of the current pooling window can be determined as valid points, and the values of the two points are written into the reduction cache unit.
When the pooling window is located at the position of the last row and the rightmost column in the pooling block (that is, the current pooling window intersects with both the last row and the rightmost column of the entire pooling block), the computed value updates all points in the current 2 × 2 pooling window, that is, when the pooling window is located at the last position of the current pooling block, the values of all points in the current pooling window cannot be updated by the next operation (because the situation of moving to the next pooling window does not exist), so that all points in the current pooling window can be determined as valid points, and the values of the four points are written into the reduction cache unit.
As shown in fig. 5, assuming that the size of the pooling window is 2 × 2, the moving step value is 1, and there is padding, the padding refers to the boundary of the pooling window, and all the boundary values are invalid values by default, that is, the values of the top row, the right-most row, the left-most row, and the bottom row are always invalid values for the entire pooling block regardless of the position of the current pooling window.
Compared with the case without padding in fig. 4, the manner of determining the valid point in fig. 5 is as follows:
and when the position of the pooling window has intersection with the uppermost line or the leftmost column of the pooling block, judging that no valid point exists in the current pooling window all the time.
When the position of the pooling window does not intersect with the uppermost row or the leftmost column of the pooling block, the judgment of the effective point in the current pooling window is consistent with that in fig. 4, and the position of the pooling window is determined.
As shown in fig. 6, assuming that the size of the pooling window is 3x3, the moving step value is 2, and there is no padding (i.e. there is no boundary, the boundary value remains constant with the movement of the pooling window), the pooling direction is from left to right, from top to bottom, and the following 4 cases can be classified according to the position of the current pooling window in the whole pooling block (the size of the pooling block in fig. 4 to 7 is 7x 7):
when the pooling window is located at a position of 'non-last row and non-rightmost column' in the pooling block (that is, the current pooling window does not intersect with the last row and the rightmost column of the whole pooling block), the computed value updates only 4 points of the 2x2 block at the upper left side, that is, when the pooling window moves to the next position, only 4 points of the 2x2 block located at the upper left corner of the current pooling window (with a total size of 3x 3) are not updated again, so that 4 points of the 2x2 block at the upper left corner of the current pooling window can be determined as valid points, and the values are written into the reduction cache unit.
When the pooling window is located in a position of a non-last row and a rightmost column in the pooling block (namely, the current pooling window does not have an intersection with the last row of the whole pooling block but has an intersection with the rightmost column), the calculated value only updates the numerical values of 6 points in the upper 2x3, namely when the pooling window moves to the next position, the numerical values of 6 points in the upper two rows of the 3x3 pooling window are not updated again, so that the upper two rows of the current pooling window can be determined as valid points, and the numerical values of the two points are written into the reduction cache unit.
When the pooling window is located at the position of the last row and the non-rightmost column in the pooling block (namely the current pooling window has an intersection with the last row of the whole pooling block but has no intersection with the rightmost column), the computed value updates only the left two columns 3x2 to total 6 points, namely when the pooling window moves to the next position, the values of only the left two columns of points in the 3x3 pooling window are not updated again, so that the points of the left two columns of the current pooling window can be determined as valid points, and the point values of the two columns are written into the reduction cache unit.
When the pooling window is located at the position of the last row and the rightmost column in the pooling block (namely, the current pooling window intersects with the last row and the rightmost column of the whole pooling block), the calculated value updates all the points in the current 3x3 pooling window, namely, when the pooling window is located at the last position of the current pooling block, the numerical values of all the points in the current pooling window cannot be updated by the next operation (because the situation of moving to the next pooling window does not exist), so that all the points in the current pooling window can be determined as valid points, and the numerical values of the nine points are written into the reduction cache unit.
As shown in fig. 7, assuming that the size of the pooling window is 3 × 3, the moving step value is 2, and padding exists, padding refers to the boundary of the pooling window, and all boundary values are invalid values by default, that is, the values of the top row, the right column, the left column, and the bottom row are always invalid values for the entire pooling block regardless of the position of the current pooling window.
Compared with the case of no padding in fig. 6, the determination manner for the valid point in fig. 7 is as follows:
if the intersection exists between the current position of the pooling window and the uppermost line of the pooling block, the effective point is determined according to the following 2 conditions:
(1) If the position of the current pooling window and the leftmost column have intersection, only the point at the most central position in the current 3x3 pooling window is determined as a valid point;
(2) If there is no intersection between the current pooling window position and the leftmost column, only 2 points of the 2 nd row, the 1 st column and the 2 nd column of the 2 nd row in the current 3x3 pooling window are determined as valid points.
If the position of the current pooling window does not intersect with the uppermost line and the lowermost line of the pooling block, determining the effective point according to the following 2 conditions
(1) If the position of the current pooling window intersects with the leftmost column, only two points of the 1 st row, the 2 nd column and the 2 nd row, the 2 nd column in the current 3x3 pooling window are determined as effective points;
(2) If there is no intersection between the current pooling window position and the leftmost column, only 4 points of the 1 st row, the 2 nd column, the 2 nd row, the 1 st column and the 2 nd column in the current 3x3 pooling window are determined as valid points.
If there is an intersection between the current position of the pooling window and the lowest row of the pooling blocks, then the valid point is determined according to the following 2 conditions:
(1) If the position of the current pooling window is intersected with the leftmost column, only two points of the 1 st row, the 2 nd column and the 2 nd row, the 2 nd column in the current 3x3 pooling window are determined as valid points;
(2) If there is no intersection between the current pooling window position and the leftmost column, only 4 points of the 1 st row, the 2 nd column, the 2 nd row, the 1 st column and the 2 nd column in the current 3x3 pooling window are determined as valid points.
In other embodiments, the padding setting may be configured based on four directions, namely, in an actual application process, any one or more of the upper boundary, the lower boundary, the left boundary, and the right boundary may be configured to be valid or invalid as needed, and when a boundary is configured to be valid, it indicates that the value of the boundary does not change with the movement of the pooling window, that is, the boundary value is always an invalid value; conversely, when a boundary is configured to be invalid, i.e., no boundary protection exists, whether the value within the pooling window is valid is determined according to the manner of FIG. 4 or FIG. 6.
Of course, the size of the pooling block, the size of the pooling window, and the pooling step value may be set according to actual needs to meet the requirements of inverse pooling operations of different sizes, and the method used in determining the valid point is similar to the above method, and is not described herein again. In short, the rule for determining the valid point can be summarized as: (1) A value in the pooling window is not updated when the pooling window moves to the position of the next pooling window along with stepping, and the value is an effective value; (2) The boundary value is determined according to whether the boundary value is configured to be valid, if the boundary value is configured to be invalid, the boundary value is judged to be in accordance with the rule (1), and if the boundary value is configured to be valid, the boundary value is always an invalid value.
As shown in fig. 8, the restore buffer unit includes a plurality of buffer groups, each of which includes a plurality of buffers, each of which is used for storing a valid point value; the reduction writing control unit writes the valid point value into the reduction cache unit comprises the following steps: and the reduction writing control unit writes the effective point numerical values in the current pooling window into the corresponding buffer group in sequence by taking the pooling window as a unit. Preferably, each buffer set includes a number of buffers corresponding to the size of the pooling window.
In other embodiments, the number of the buffer groups is determined according to the size of the pooling block, the size of the pooling window, and the pooling step value, and compared with a mode in which all the buffers are configured as the size of the pooling window, the number of the buffer groups is determined according to the size of the pooling block, the size of the pooling window, and the pooling step value, the reusability of the buffer groups can be effectively improved, and the hardware area can be reduced.
For example, if the pooling block 3x3 in fig. 6 is moved from the leftmost column to the rightmost column, only 3 positions (i.e., the initial position, the middle position, and the end position) need to be moved, and the number of buffer sets is configured to be 3. The number of buffers included in each buffer may also be configured according to actual needs, specifically, the number of buffers included in the first buffer group is determined by a maximum value of the number of valid values included in leftmost 3 positions (upper left, middle left, and lower left, that is, 3 positions in the leftmost column in fig. 6) of the current pooling window (in fig. 6, the valid values included in the lower left are 6, and are the maximum values of the 3 positions); similarly, the buffer number included in the second buffer group is determined by the maximum value of the number of valid values included in the middle 3 positions (middle upper, middle, middle lower, i.e. 3 positions in the middle column of fig. 6) of the current pooling window (the valid values included in the middle lower in fig. 6 are 6, and are the maximum values of the 3 positions); the number of buffers included in the third buffer group is determined by the maximum value of the number of valid values included in the right 3 positions (upper right, middle right, and lower right, i.e., 3 positions in the middle column in fig. 6) of the current pooling window (the number of valid values included in the lower right in fig. 6 is 9, which is the maximum value among 3). Therefore, the number of the buffers included in the buffer group is sequentially configured to be 6, and 9, and when the first line of anti-pooling operation is completed, the values in the first buffer, the second buffer, and the third buffer are output according to a preset sequence (i.e., a left-to-right line-by-line sequence of the pooling block), so that the first anti-pooling operation is completed. And then starting a second anti-pooling operation, namely sequentially writing effective values of the pooling window in the left middle, the middle and the right middle into the first buffer, the second buffer and the third buffer, and sequentially reading data in 3 buffer groups from left to right according to a row-by-row sequence of the pooling blocks.
Then, a 3 rd anti-pooling operation may be started, as shown in FIGS. 8-10, with a pooling window size of 3x3, and each buffer set contains 9 (since the valid values are at most 9). Preferably, the data width of each buffer = number of channels × number of bits per data, for example, 8 bits per data, and the number of channels is 32, then the bit width of the buffer is 256 bits.
Of the 9 buffers, the first 6 buffers have a depth of a quotient of a maximum supported inverse pooling width that can be buffered divided by 2, for example, the maximum supported inverse pooling size is 7, the depth of the first 6 buffers is 3, the last 3 buffers are only used for inverse pooling operations of the last row and the last column (i.e., when the pooling window is moved to a position where the pooling window intersects with both the last row and the last column of the pooling block), and the bit width is the same as that of the first 6 buffers, and the depth is 1.
The 9 buffers correspond to 9 coordinate positions of 3x3, respectively, wherein the last 3 are 1/4 of the first 6. After the valid points in the 3x3 pooling window are calculated each time, the numerical values judged as valid points in the pooling window are respectively stored in the buffers in the buffer group at the corresponding positions at one time according to the conditions of the previous columns.
The 3 rd inverse pooling reads data as shown in fig. 9 and 10, starting from address 0 of mem00, then to address 0 of mem01, to address 1 of mem00, to address 1 of mem01, so that addresses are alternately added between mem00 and mem01 until all data of mem00 and mem01 are read, and finally data in mem02 is read, thereby completing the data reading of the first row. And alternately reading the data in the mem10 and the mem11 until the reading is finished, and finally reading the last data in the mem12 so as to finish the data reading of the second row.
In short, the number of buffer groups and the number of buffers included in each buffer group are determined according to the pooling window size, the pooling block size, and the step value. As shown in fig. 4, the pooling block size is 7x7, the pooling window size is 2x2, and the step value is 1, so that when the pooling window moves from the leftmost column to the rightmost column in the pooling block, the total number of the movement steps is 6, the number of the buffer groups is 6, and the number of the buffers included in the remaining buffer groups except the last buffer group (including 4 buffers) may be configured to be two (the valid value included in other positions is at most 2). When a certain pooling window moves from the leftmost column to the rightmost column, one pooling operation is finished, data are output from left to right first and then from top to bottom according to the row arrangement sequence of the pooling blocks, and 6 pooling operations are finished in total (because from top to bottom, the pooling windows moving from the top row to the bottom row need to move 6 times), so that the whole anti-pooling operation is finished.
When the pooling block size, the pooling window size, and the step value are other values, the number of the buffer groups and the number of the buffers included in each buffer group are adjusted according to the above rules, which are not described herein again.
In some embodiments, the circuit includes a bus transmission assembling unit 110, where the bus transmission assembling unit 110 is configured to assemble and output data read by the restoring and reading control unit 108, and preferably, the bus transmission assembling unit 110 assembles valid point data read by the restoring and reading control unit 108, for example, the restoring and reading control unit 108 sequentially reads values in different buffers according to an arrow in fig. 10, and then transmits the values to a bus write-back unit 109, and the bus write-back unit 109 writes back the assembled data to a data cache unit (DDR), thereby completing the 3 rd anti-pooling operation.
As shown in fig. 2, the inventor further provides an inverse pooling operation method, which is applied to an inverse pooling operation circuit, where the circuit includes a fetch control unit, a valid value cache unit, a coordinate value cache unit, a pooling reduction unit, a valid point determination unit, a reduction write control unit, a reduction cache unit, a reduction read control unit, and a bus write-back unit;
the data fetching control unit is respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is also respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is connected with the effective point judgment unit, the effective point judgment unit is connected with the reduction writing control unit, the reduction writing control unit is connected with the reduction cache unit, the reduction cache unit is connected with the reduction reading control unit, and the reduction reading control unit is connected with the bus write-back unit;
the method comprises the following steps:
firstly, step S201 is entered, the numerical control unit obtains at least one effective value and coordinate values corresponding to the effective value from the data cache unit, and stores the obtained effective value in the effective value cache unit, and stores the coordinate values corresponding to the effective value in the coordinate value cache unit;
then, the step S202 is carried out, namely the pooling reduction unit restores pooled blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the pooling block comprises a plurality of pooling windows, and each pooling window is restored according to an effective value and a coordinate position corresponding to the effective value;
then step S203 is entered, the valid point judging unit judges whether each numerical value contained in the current pooling window is a valid point according to the size and the stepping value of the pooling window, if so, the restoration writing control unit writes the numerical value of the valid point into the restoration cache unit;
and then step S04 is carried out, the restoring and reading control unit reads the effective point in the restoring cache unit, and the read effective value is written back to the data cache unit through the bus write-back unit.
In some embodiments, the restore buffer unit includes a plurality of buffer groups, each buffer group including a plurality of buffers, each buffer for storing a valid point value; the reduction writing control unit writes the valid point value into the reduction cache unit comprises the following steps: and the reduction writing control unit writes the effective point numerical values in the current pooling window into the corresponding buffer group in sequence by taking the pooling window as a unit. Preferably, each buffer set includes a number of buffers equal to the pool window size.
In certain embodiments, the method comprises: and the restoring and reading control unit reads the effective point numerical values in the cache group based on the row or column sorting of the pooling blocks according to the coordinate sequence of each effective point on the pooling blocks.
In some embodiments, the "pooling reduction unit is configured to reduce the pooled blocks according to the obtained effective values and the coordinate positions corresponding to the effective values" includes: the pooling reduction unit fills the effective value to the corresponding position in the pooling window according to the effective value and the coordinate position corresponding to the effective value, and fills the numerical value corresponding to the effective value to other positions except the effective value in the pooling window according to a preset pooling rule; and executing the operation until all the pooling windows corresponding to the effective values are restored, and obtaining a pooling block.
The invention provides an inverse pooling operation method and a circuit, wherein the method comprises the following steps: the data acquisition control unit acquires at least one effective value and coordinate values corresponding to the effective values from the data cache unit, stores the acquired effective values in the effective value cache unit, and stores the coordinate values corresponding to the effective values in the coordinate value cache unit; the pooling reduction unit reduces the pooling blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the valid point judging unit judges whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if so, the restoration writing control unit writes the numerical value of the valid point into the restoration cache unit; the restoring and reading control unit reads the effective points in the restoring and caching unit and writes the read effective values back to the data caching unit through the bus write-back unit. The anti-pooling operation circuit has clear logic and easy control, and can efficiently realize anti-pooling operation.
It should be noted that, although the above embodiments have been described herein, the invention is not limited thereto. Therefore, based on the innovative concepts of the present invention, the technical solutions of the present invention can be directly or indirectly applied to other related technical fields by making changes and modifications to the embodiments described herein, or by using equivalent structures or equivalent processes performed in the content of the present specification and the attached drawings, which are included in the scope of the present invention.

Claims (8)

1. An anti-pooling operation circuit is characterized by comprising a data fetching control unit, a valid value caching unit, a coordinate value caching unit, a pooling reduction unit, a valid point judging unit, a reduction writing control unit, a reduction caching unit, a reduction reading control unit and a bus write-back unit;
the data fetching control unit is respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is also respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is connected with the effective point judgment unit, the effective point judgment unit is connected with the reduction writing control unit, the reduction writing control unit is connected with the reduction cache unit, the reduction cache unit is connected with the reduction reading control unit, and the reduction reading control unit is connected with the bus write-back unit;
the data acquisition control unit is used for acquiring at least one effective value and coordinate values corresponding to the effective values from the data cache unit, storing the acquired effective values in the effective value cache unit and storing the coordinate values corresponding to the effective values in the coordinate value cache unit;
the pooling reduction unit is used for reducing pooling blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the pooling block comprises a plurality of pooling windows, and each pooling window is restored according to an effective value and a coordinate position corresponding to the effective value; the step of reducing the pooled blocks by the pooled reduction unit according to the obtained effective values and the coordinate positions corresponding to the effective values comprises the following steps: the pooling reduction unit fills the effective value to a corresponding position in a pooling window according to the effective value and a coordinate position corresponding to the effective value, and fills a numerical value corresponding to the effective value to other positions except the effective value in the pooling window according to a preset pooling rule; executing the operation until all the pooling windows corresponding to the effective values are restored to obtain pooling blocks;
the valid point judging unit is used for judging whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if so, the restoration writing control unit writes the numerical value of the valid point into the restoration cache unit;
the reduction reading control unit is used for reading the effective points in the reduction cache unit and writing back the read effective values to the data cache unit through the bus write-back unit.
2. The anti-pooling computing circuit of claim 1 wherein said restore buffer unit includes a plurality of buffer banks, each buffer bank including a plurality of registers, each register for storing a valid point value; the reduction writing control unit writes the valid point value into the reduction cache unit comprises the following steps:
and the reduction writing control unit writes the effective point numerical values in the current pooling window into the corresponding buffer group in sequence by taking the pooling window as a unit.
3. The anti-pooling computing circuit of claim 2 wherein each of the buffer sets includes a number of buffers that is a value of a pooling window size, or wherein the number of buffer sets and the number of buffers included in each of the buffer sets are determined based on the pooling block size, the pooling window size, and the step value.
4. The anti-pooling arithmetic circuit of claim 2 or 3 wherein said restore read control unit reads the valid point values in said buffer pool based on a row or column ordering of the pooled blocks according to a coordinate order of the respective valid points on the pooled blocks.
5. The anti-pooling operation method is applied to an anti-pooling operation circuit, and the circuit comprises a data acquisition control unit, a valid value caching unit, a coordinate value caching unit, a pooling reduction unit, a valid point judgment unit, a reduction writing control unit, a reduction caching unit, a reduction reading control unit and a bus write-back unit;
the data fetching control unit is respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is also respectively connected with the effective value cache unit and the coordinate value cache unit, the pooling reduction unit is connected with the effective point judgment unit, the effective point judgment unit is connected with the reduction writing control unit, the reduction writing control unit is connected with the reduction cache unit, the reduction cache unit is connected with the reduction reading control unit, and the reduction reading control unit is connected with the bus write-back unit;
the method comprises the following steps:
the data acquisition control unit acquires at least one effective value and coordinate values corresponding to the effective values from the data cache unit, stores the acquired effective values in the effective value cache unit, and stores the coordinate values corresponding to the effective values in the coordinate value cache unit;
the pooling reduction unit reduces the pooling blocks according to the obtained effective values and the coordinate positions corresponding to the effective values; the pooling block comprises a plurality of pooling windows, and each pooling window is restored according to an effective value and a coordinate position corresponding to the effective value; the 'pooling reduction unit is used for reducing the pooling blocks according to the obtained effective values and the coordinate positions corresponding to the effective values' and comprises the following steps: the pooling reduction unit fills the effective value to a corresponding position in a pooling window according to the effective value and a coordinate position corresponding to the effective value, and fills a numerical value corresponding to the effective value to other positions except the effective value in the pooling window according to a preset pooling rule; executing the operation until all the pooling windows corresponding to the effective values are restored, and obtaining pooling blocks;
the valid point judging unit judges whether each numerical value contained in the current pooling window is a valid point or not according to the size and the stepping value of the pooling window, and if yes, the restoration writing control unit writes the numerical value of the valid point into the restoration caching unit;
the restoration read control unit reads the effective points in the restoration cache unit and writes the read effective values back to the data cache unit through the bus write-back unit.
6. The method of claim 5, wherein the reduction buffer unit comprises a plurality of buffer sets, each buffer set comprising a plurality of registers, each register for storing a valid point value; the reduction writing control unit writes the valid point value into the reduction cache unit includes:
and the reduction writing control unit writes the effective point numerical values in the current pooling window into the corresponding buffer group in sequence by taking the pooling window as a unit.
7. The method of claim 6, wherein the number of buffers included in each buffer set is a value of a pooling window size, or the number of buffer sets and the number of buffers included in each buffer set are determined according to a pooling block size, a pooling window size, and a step value.
8. The method of anti-pooling operation of claim 6 or 7 wherein said method includes:
and the restoring and reading control unit reads the effective point numerical values in the cache group based on the row or column sorting of the pooling blocks according to the coordinate sequence of each effective point on the pooling blocks.
CN201910690114.6A 2019-07-29 2019-07-29 Anti-pooling operation method and circuit Active CN110489819B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910690114.6A CN110489819B (en) 2019-07-29 2019-07-29 Anti-pooling operation method and circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910690114.6A CN110489819B (en) 2019-07-29 2019-07-29 Anti-pooling operation method and circuit

Publications (2)

Publication Number Publication Date
CN110489819A CN110489819A (en) 2019-11-22
CN110489819B true CN110489819B (en) 2022-11-18

Family

ID=68548546

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910690114.6A Active CN110489819B (en) 2019-07-29 2019-07-29 Anti-pooling operation method and circuit

Country Status (1)

Country Link
CN (1) CN110489819B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106529517A (en) * 2016-12-30 2017-03-22 北京旷视科技有限公司 Image processing method and image processing device
CN108304925A (en) * 2018-01-08 2018-07-20 中国科学院计算技术研究所 A kind of pond computing device and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9507685B2 (en) * 2013-04-03 2016-11-29 Vmware, Inc. Grouping failure events with adaptive polling and sliding window buffering

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106529517A (en) * 2016-12-30 2017-03-22 北京旷视科技有限公司 Image processing method and image processing device
CN108304925A (en) * 2018-01-08 2018-07-20 中国科学院计算技术研究所 A kind of pond computing device and method

Also Published As

Publication number Publication date
CN110489819A (en) 2019-11-22

Similar Documents

Publication Publication Date Title
KR102642853B1 (en) Convolution circuit, application processor having the same, and operating methoe thereof
CN104934062B (en) Nonvolatile memory and wiring method
CN108573305B (en) Data processing method, equipment and device
CN109886395B (en) Data reading method for multi-core image processing convolutional neural network
CN107748723B (en) Storage method and access device supporting conflict-free stepping block-by-block access
US8130234B2 (en) Computer graphics rendering apparatus and method
WO2022206556A1 (en) Matrix operation method and apparatus for image data, device, and storage medium
CN114565501A (en) Data loading method and device for convolution operation
CN112633470A (en) Method, system, device and medium for optimizing neural network convolution residual structure
CN110009644B (en) Method and device for segmenting line pixels of feature map
CN110009103B (en) Deep learning convolution calculation method and device
JPH09179999A (en) Method and device for image generation
CN111310115A (en) Data processing method, device and chip, electronic equipment and storage medium
US5861888A (en) Method and a system for the nonlinear storage of a texture map within a linear memory device
CN110489819B (en) Anti-pooling operation method and circuit
CN112183732A (en) Convolutional neural network acceleration method and device and computer equipment
CN110490312B (en) Pooling calculation method and circuit
US10140681B2 (en) Caching method of graphic processing unit
CN108024116A (en) A kind of data cache method and device
KR102657104B1 (en) Operation device of convolutional neural network, operation method of convolutional neural network and computer program stored in a recording medium to execute the method thereof
CN110503193B (en) ROI-based pooling operation method and circuit
CN109816093B (en) Single-path convolution implementation method
CN111078589B (en) Data reading system, method and chip applied to deep learning calculation
JP5113174B2 (en) Method and apparatus for simultaneously generating multi-site FM screen dots
CN112308762A (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 350003 building 18, No.89, software Avenue, Gulou District, Fuzhou City, Fujian Province

Applicant after: Ruixin Microelectronics Co.,Ltd.

Address before: 350003 building 18, No.89, software Avenue, Gulou District, Fuzhou City, Fujian Province

Applicant before: FUZHOU ROCKCHIP ELECTRONICS Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant