# US 2021/0174180 A1 · Hardware Implementation of a Neural Network

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0174180 A1
- Document ID: US20210174180A1
- Status: Published application
- Kind: A1
- Application number: 17/106,660
- Filed: 2020-11-30
- Published: 2021-06-10
- Earliest claimed: 2019-11-29
- Assignees: Imagination Technologies Limited
- Applicants: Imagination Technologies Limited
- Inventors: Xiran Huang; Cagatay Dikici
- Web page: https://patentgrep.com/patent/US20210174180A1

## CPC

- G06N 3/063: using electronic means
- G11C 11/54: using elements simulating biological cells, e.g. neuron
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/045: Combinations of networks
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G11C: STATIC STORES (semiconductor memory devices H10B)

## Abstract

A hardware implementation of a neural network and a method of processing data in such a hardware implementation are disclosed. Input data for a plurality of layers of the network is processed in blocks, to generate respective blocks of output data. The processing proceeds depth-wise through the plurality of layers, evaluating all layers of the plurality of layers for a given block, before proceeding to the next block.

## Claims

### Claim 1

A method of processing data in a hardware implementation of a neural network including a plurality of layers, the method comprising:
providing, in one or more first memory devices, weight data representing weights for the plurality of layers;
providing, in the one or more first memory devices, input data for a first layer of the plurality of layers, the plurality of layers terminating with an end layer generating p output data sets, each set comprising n output data elements, where n>2 and p≥1 and p depends on the weight data;
reading, from the one or more first memory devices, a first subset of the input data, representing a first block of the input data;
reading the weight data from the one or more first memory devices;
processing the weight data and the first subset of the input data, to evaluate each layer of the plurality of layers and thereby calculate a first block of output data for a first output data set, wherein the first block of output data has m output data elements, where m>1 and m<n; and
writing the first block of output data to the one or more first memory devices,
wherein at least one of the plurality of layers is a convolutional layer.

### Claim 2 (depends on 1)

The method of claim 1, further comprising providing one or more second memory devices, wherein a cost of accessing the one or more second memory devices is less than a cost of accessing the one or more first memory devices,
wherein processing the weight data and the first subset of the input data comprises:
processing the weight data and the first subset of the input data to evaluate the first layer of the plurality of layers, and thereby calculate output data of the first layer;
writing the output data of the first layer to the one or more second memory devices; and
for each subsequent layer of the plurality of layers:
reading, from the one or more second memory devices, the output data of the preceding layer; and
processing the weight data and the output data of the preceding layer to evaluate the current layer of the plurality of layers, and thereby calculate output data of the current layer.

### Claim 3 (depends on 2)

The method of claim 2, further comprising, after reading the weight data from the one or more first memory devices, writing the weight data to the one or more second memory devices,
the method comprising, before evaluating each layer, reading the weight data for that layer from the one or more second memory devices.

### Claim 4 (depends on 2)

The method of claim 2, further comprising, for at least one layer of the plurality of layers:
when calculating output data of the at least one layer:
identifying a disposable portion of the output data of the at least one layer, which can be deleted after calculating the first block of output data for the end layer; and
identifying a non-disposable portion of the output data of the at least one layer, which should be retained after calculating the first block of output data for the end layer, to be used for calculating at least one other block of output data for the end layer,
the method comprising, when writing the output data of the at least one layer to the one or more second memory devices:
writing the disposable portion to a first section of the one or more second memory devices; and
writing the non-disposable portion to a second, different section of the one or more second memory devices.

### Claim 5 (depends on 4)

The method of claim 4, wherein, when evaluating a subsequent layer of the plurality of layers, at least part of the disposable portion of the output data is overwritten, optionally wherein the disposable portion is overwritten by a disposable portion of output data of said subsequent layer.

### Claim 6 (depends on 4)

The method of claim 4, wherein the second section of the one or more second memory devices is double buffered.

### Claim 7 (depends on 4)

The method of claim 4, further comprising, when evaluating a subsequent layer of the plurality of layers:
reading the disposable portion from the first section of the one or more second memory devices;
reading the non-disposable portion from the second section of the one or more second memory devices; and
using the disposable portion and the non-disposable portion in the calculation of the output of said subsequent layer.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
reading, from the one or more first memory devices, a second subset of the input data, representing a second block of the input data;
processing the weight data and the second subset of the input data to evaluate each layer of the plurality of layers, and thereby calculate a second block of output data for the first output data set; and
writing the second block of output data to the one or more first memory devices.

### Claim 9 (depends on 2)

The method of claim 2, further comprising:
reading, from the one or more first memory devices, a second subset of the input data, representing a second block of the input data;
reading, from the one or more second memory devices, a non-disposable portion of output data from at least one of the plurality of layers, which was previously written to the one or more second memory devices during the calculation of the first block of output data for the first output data set;
processing the weight data, the non-disposable portion, and the second subset of the input data to evaluate the plurality of layers, and thereby calculate a second block of output data for the first output data set; and
writing the second block of output data to the one or more first memory devices.

### Claim 10

A hardware implementation of a neural network including a plurality of layers at least one of which is a convolutional layer, the hardware implementation comprising:
one or more first memory devices, configured to store:
weight data representing weights for the plurality of layers; and
input data for a first layer of the plurality of layers, the plurality of layers terminating with an end layer generating p output data sets, each set comprising n output data elements, where n>2 and p≥1 and p depends on the weight data,
an input buffer, configured to obtain a first subset of the input data, representing a first block of the input data,
a coefficient buffer, configured to obtain the weight data,
one or more processing elements, configured to process the weight data and the first subset of the input data, to evaluate each layer of the plurality of layers and thereby calculate a first block of output data for a first output data set, wherein the first block of output data has m output data elements, where m>1 and m<n; and
an output buffer, configured to output the first block of output data.

### Claim 11 (depends on 10)

The hardware implementation of claim 10, further comprising one or more second memory devices, wherein a cost of accessing the one or more second memory devices is less than a cost of accessing the one or more first memory devices,
wherein the one or more processing elements are configured to process the weight data and the first subset of the input data to evaluate the first layer of the plurality of layers, and thereby calculate output data of the first layer;
the output buffer is configured to write the output data of the first layer to the one or more second memory devices; and
for each subsequent layer of the plurality of layers:
the input buffer is configured to read, from the one or more second memory devices, the output data of the preceding layer; and
the one or more processing elements are configured to process the weight data, and the output data of the preceding layer, to evaluate the current layer of the plurality of layers, and thereby calculate output data of the current layer.

### Claim 12 (depends on 11)

The hardware implementation of claim 11, wherein the one or more second memory devices are configured to obtain the weight data from the one or more first memory devices,
and the coefficient buffer is configured to, before each layer is evaluated, read the weight data for that layer from the one or more second memory devices.

### Claim 13 (depends on 11)

The hardware implementation of claim 11, wherein, when output data of at least one layer of the plurality of layers has been calculated, the output buffer is configured to:
identify a disposable portion of the output data of the at least one layer, which can be deleted after calculating the first block of output data for the end layer;
identify a non-disposable portion of the output data of the at least one layer, which should be retained after calculating the first block of output data for the end layer, to be used for calculating at least one other block of output data for the end layer;
write the disposable portion to a first section of the one or more second memory devices; and
write the non-disposable portion to a second, different section of the one or more second memory devices.

### Claim 14 (depends on 13)

The hardware implementation of claim 13, wherein, when a subsequent layer of the plurality of layers is evaluated, the output buffer is configured to overwrite at least part of the disposable portion of the output data.

### Claim 15 (depends on 14)

The hardware implementation of claim 14, wherein the output buffer is configured to overwrite the disposable portion by a disposable portion of output data of said subsequent layer.

### Claim 16 (depends on 13)

The hardware implementation of claim 13, wherein the second section of the one or more second memory devices is double buffered.

### Claim 17 (depends on 13)

The hardware implementation of claim 13, wherein, when a subsequent layer of the plurality of layers is evaluated:
the input buffer is configured to read the disposable portion from the first section of the one or more second memory devices;
the input buffer is configured to read the non-disposable portion from the second section of the one or more second memory devices; and
the one or more processing elements are configured to use the disposable portion and the non-disposable portion in the calculation of the output of said subsequent layer.

### Claim 18 (depends on 10)

The hardware implementation of claim 10, wherein:
the input buffer is configured to obtain a second subset of the input data, representing a second block of the input data;
the one or more processing elements are configured to process the weight data and the second subset of the input data to evaluate each layer of the plurality of layers, and thereby calculate a second block of output data for the first output data set; and
the output buffer is configured to output the second block of output data.

### Claim 19 (depends on 11)

The hardware implementation of claim 11, wherein:
the input buffer is configured to obtain a second subset of the input data, representing a second block of the input data;
the input buffer is configured to read, from the one or more second memory devices, a non-disposable portion of output data from at least one of the plurality of layers, which was previously written to the one or more second memory devices during the calculation of the first block of output data for the first output data set;
the one or more processing elements are configured to process the weight data, the non-disposable portion, and the second subset of the input data to evaluate the plurality of layers, and thereby calculate a second block of output data for the first output data set; and
the output buffer is configured to output the second block of output data.

### Claim 20

A non-transitory computer readable storage medium having stored thereon computer readable code configured to cause to be performed, when the code is run, a method of processing data in a hardware implementation of a neural network including a plurality of layers, the method comprising:
providing, in one or more first memory devices, weight data representing weights for the plurality of layers;
providing, in the one or more first memory devices, input data for a first layer of the plurality of layers, the plurality of layers terminating with an end layer generating p output data sets, each set comprising n output data elements, where n>2 and p≥1 and p depends on the weight data;
reading, from the one or more first memory devices, a first subset of the input data, representing a first block of the input data;
reading the weight data from the one or more first memory devices;
processing the weight data and the first subset of the input data, to evaluate each layer of the plurality of layers and thereby calculate a first block of output data for a first output data set, wherein the first block of output data has m output data elements, where m>1 and m<n; and
writing the first block of output data to the one or more first memory devices,
wherein at least one of the plurality of layers is a convolutional layer.
