IP Library › Granted Patent US 12,119,846
Granted Patent B2
US 12,119,846 · App. 18/095,039 · Granted Oct 15, 2024

Compressing device and method using parameters of quadtree method

Inventors: Sungho Jun (Hwaseong-si, KR); Junseok Park (Hwaseong-si, KR); Sangmin Suh (Seoul, KR); Heonsoo Lee (Hwaseong-si, KR); Hyukjae Jang (Suwon-Si, KR); Kyungah Jeong (Seoul, KR)
Assignee: SAMSUNG ELECTRONICS CO., LTD.
H03M7/405G06N3/02H03M7/3066
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,119,846
App. No.
18/095,039
Granted
Oct 15, 2024
Kind
B2
Abstract

A device configured to compress a tensor including a plurality of cells includes: a quadtree generator configured to generate a quadtree searching for a non-zero cell included in the tensor and extract at least one parameter value from the quadtree; a mode selector configured to determine a compression mode based on the at least one parameter; and a bitstream generator configured to generate a bitstream by compressing the tensor based on the compression mode.

Claims (53)

1. A compression method of a neural network processor configured to perform computations on a feature map and a weight by using a neural network, the method comprising:

receiving a tensor comprising a plurality of cells as a result of the computations;

setting a quantization range of the tensor based on a largest value of a cell among the plurality of cells;

selectively quantizing the tensor based on the quantization range; and

compressing the quantized tensor.

2. The method of claim 1 , wherein the setting of the quantization range comprises:

calculating a first value obtained by dividing the largest value of the cell by 4 and decimal rounding-down;

calculating a second value obtained by dividing the largest value of the cell by 2 and decimal rounding-down;

setting a range that is greater than or equal to 0 and less than or equal to a first value, to a first range;

setting a range that is greater than or equal to the first value and less than or equal to a second value, to a second range;

setting a range that is greater than or equal to the second value and less than or equal to the largest value of the cell, to a third range; and

classifying the plurality of cells into quantization ranges respectively corresponding to cell values.

3. The method of claim 2 , wherein the selectively quantizing the tensor comprises:

dividing a value of a cell comprised in the second range by 2, and adding a first offset to prevent overlapping the first range; and

dividing a value of a cell comprised in the third range by 4, and adding a second offset to prevent overlapping the second range.

4. The method of claim 1 , wherein the compressing of the quantized tensor comprises:

extracting a first parameter generated as a result of a quadtree and corresponding to a total number of bits in which location information about a non-zero cell is represented in the tensor;

extracting a second parameter corresponding to bits from a least significant bit to a bit having a non-zero largest digit, when a cell having a largest value among the non-zero cells is expressed in binary; and

extracting a third parameter corresponding to a number of zero cells among the plurality of cells.

5. The method of claim 4 , wherein the compressing of the quantized tensor comprises:

comparing a value of the first parameter to a number of cells included in the tensor; and

when the value of the first parameter is less than or equal to the number of cells included in the tensor, select a first compression mode, in which the tensor is compressed in a quadtree method, as a compression mode.

6. The method of claim 5 , wherein the compressing of the quantized tensor comprises:

when the value of the first parameter is greater than the number of cells included in the tensor, comparing a product value of a value of the second parameter and a value of the third parameter with the number of cells; and

when the product value of the value of the second parameter and the value of the third parameter exceeds the number of cells, select a second compression mode, in which the tensor is compressed in a zero bitmap method in which the non-zero cell is regarded as 1 and a zero cell is regarded as 0, as a compression mode.

7. The method of claim 6 , wherein the compressing of the quantized tensor comprises:

when the product value of the value of the second parameter and the value of the third parameter is less than or equal to the number of cells, select a third compression mode, in which the tensor is compressed in a fixed length method in which the tensor is compressed based on a bit width of a cell of a largest value among the plurality of cells, as a compression mode.

8. A device configured to compress a tensor comprising a plurality of cells, the device comprising:

a quantizer configured to quantize the tensor;

a quadtree generator configured to generate a quadtree searching for a non-zero cell comprised in the quantized tensor and extract at least one parameter from the quadtree;

a mode selector configured to determine a compression mode based on the at least one parameter; and

a bitstream generator configured to generate a bitstream by compressing the quantized tensor based on the compression mode.

9. The device of claim 8 , wherein the quantizer is further configured to set a quantization range of the tensor based on a largest value of a cell among the plurality of cells, and selectively quantize the tensor based on the quantization range.

10. The device of claim 9 , wherein the quantizer is further configured to calculate a first value obtained by dividing the largest value of the cell by 4 and decimal rounding-down, calculate a second value obtained by dividing the largest value of the cell by 2 and decimal rounding-down, set a range that is greater than or equal to 0 and less than or equal to a first value to a first range, set a range that is greater than or equal to the first value and less than or equal to a second value to a second range, set a range that is greater than or equal to the second value and less than or equal to the largest value of the cell to a third range, and classify the plurality of cells into quantization ranges respectively corresponding to cell values.

11. The device of claim 10 , wherein the quantizer is further configured to divide a value of a cell comprised in the second range by 2, add a first offset to a divided value of the cell comprised in the second range, divide a value of a cell comprised in the third range by 4, and add a second offset to a divided value of the cell comprised in the third range.

12. The device of claim 8 , wherein the at least one parameter comprises:

a first parameter generated as a result of the quadtree and corresponding to a total number of bits in which location information about the non-zero cell is represented;

a second parameter corresponding to a number of bits from a least significant bit to a bit of a non-zero largest digit, in response to a cell having a largest value among non-zero cells being expressed in binary; and

a third parameter corresponding to a number of zero cells among the plurality of cells.

13. The device of claim 12 , wherein the mode selector is further configured to select a first compression mode, in which the tensor is compressed in a quadtree method, as the compression mode, in response to a value of the first parameter being less than or equal to a number of cells included in the tensor.

14. The device of claim 12 , wherein the mode selector is further configured to select a second compression mode, in which the tensor is compressed in a zero bitmap method in which the non-zero cell is regarded as 1 and a zero cell is regarded as 0, as the compression mode, in response to a value of the first parameter exceeding a number of cells included in the tensor and a product value of a value of the second parameter and a value of the third parameter exceeding the number of cells.

15. The device of claim 12 , wherein the mode selector is further configured to select a third compression mode, in which the tensor is compressed in a fixed length method in which the tensor is compressed based on a bit width of a cell of a largest value among the plurality of cells, as the compression mode, in response to a value of the first parameter exceeding a number of cells included in the tensor and a product value of a value of the second parameter and a value of the third parameter being less than or equal to the number of cells.

16. A neural network processor comprising:

an arithmetic circuit configured to generate a tensor comprising a plurality of cells by performing a computation on input data by using a neural network; and

a neural tensor compressor configured to output a bitstream by compressing the tensor,

wherein the neural tensor compressor is further configured to quantize the tensor, to generate a quadtree corresponding to a repetitive spatial division method to search for a non-zero cell comprised in the quantized tensor, extract at least one parameter from the quadtree, and determine a compression mode of the bitstream based on the at least one parameter.

17. The neural network processor of claim 16 , wherein the neural tensor compressor is further configured to set a quantization range of the tensor based on a largest value of a cell among the plurality of cells, and selectively quantize the tensor based on the quantization range.

18. The neural network processor of claim 17 , wherein the neural tensor compressor is further configured to calculate a first value obtained by dividing the largest value of the cell by 4 and decimal rounding-down, calculate a second value obtained by dividing the largest value of the cell by 2 and decimal rounding-down, set a range that is greater than or equal to 0 and less than or equal to a first value to a first range, set a range that is greater than or equal to the first value and less than or equal to a second value to a second range, set a range that is greater than or equal to the second value and less than or equal to the largest value of the cell to a third range, and classify the plurality of cells into quantization ranges respectively corresponding to cell values.

19. The neural network processor of claim 18 , wherein the neural tensor compressor is further configured to divide a value of a cell comprised in the second range by 2, add a first offset to a divided value of the cell comprised in the second range, divide a value of a cell comprised in the third range by 4, and add a second offset to a divided value of the cell comprised in the third range.

20. The neural network processor of claim 16 , wherein the at least one parameter comprises:

a first parameter generated as a result of the quadtree and corresponding to a total number of bits in which location information about the non-zero cell is represented;

a second parameter corresponding to a number of bits from a least significant bit to a bit of a non-zero largest digit, in response to a cell having a largest value among non-zero cells being expressed in binary; and

a third parameter corresponding to a number of zero cells among the plurality of cells.

Priority Claims (1)
KR 10-2020-0054770 · May 7, 2020 · national
Continuity (2)
Continuation 17183471 · Feb 24, 2021
Related Publication 20230144499A1 · May 11, 2023