# US 2021/0174181 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/0174181 A1
- Document ID: US20210174181A1
- Status: Published application
- Kind: A1
- Application number: 17/106,892
- 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/US20210174181A1

## 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, the hardware implementation comprising one or more first memory devices and one or more second memory devices, the neural network including a plurality of layers, the method comprising:
providing, in the one or more first memory devices, weight data representing weights for the plurality of layers and input data for the plurality of layers;
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, from the one or more first memory devices, the weight data;
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, wherein evaluating at least one layer subsequent to a first layer of the plurality of layers comprises:
reading output data of a preceding layer from the one or more second memory devices;
processing the weight data and the output data of the preceding layer to evaluate the at least one layer, and thereby calculate output data of the at least one layer; and
writing the output data of the at least one layer into the one or more second memory devices to be read during the evaluation of a subsequent layer; 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, 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 3 (depends on 1)

The method of claim 1, further comprising, 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; 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, to be used for calculating at least one other block of output data.

### Claim 4 (depends on 3)

The method of claim 3, 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 further layer of the plurality of layers, at least part of the disposable portion of the output data is overwritten.

### Claim 6 (depends on 5)

The method of claim 5, wherein the disposable portion is overwritten by a disposable portion of output data of the further layer.

### Claim 7 (depends on 4)

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

### Claim 8 (depends on 4)

The method of claim 4, further comprising, when evaluating the subsequent layer to the at least one layer:
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 9 (depends on 3)

The method of claim 3, 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;
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; and
writing the second block of output data to the one or more first memory devices.

### Claim 10 (depends on 1)

The method of claim 1, 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; and
writing the output data of the first layer to the one or more second memory devices to be read during the evaluation of the next subsequent layer of the plurality of layers.

### Claim 11

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 the plurality of layers,
one or more second memory devices,
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, and
an output buffer, configured to output the first block of output data,
wherein, to evaluate at least one layer subsequent to a first layer of the plurality of layers:
the input buffer is configured to read, from the one or more second memory devices, output data of a preceding layer;
the one or more processing elements are configured to process the weight data and the output data of the preceding layer to evaluate the at least one layer, and thereby calculate output data of the at least one layer; and
the output buffer is configured to write the output data of the at least one layer into the one or more second memory devices to be read during the evaluation of a subsequent 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 the output data of the 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; and
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, to be used for calculating at least one other block of output data.

### Claim 14 (depends on 13)

The hardware implementation of claim 13, wherein when writing the output data of the at least one layer to the one or more second memory devices, the output buffer is configured to:
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 15 (depends on 14)

The hardware implementation of claim 14, wherein, when a further 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 16 (depends on 15)

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

### Claim 17 (depends on 14)

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

### Claim 18 (depends on 14)

The hardware implementation of claim 14, wherein, when the subsequent layer to the at least one layer 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 19 (depends on 14)

The hardware implementation of claim 14, 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;
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; 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, the hardware implementation comprising one or more first memory devices and one or more second memory devices, the neural network including a plurality of layers, the method comprising:
providing, in the one or more first memory devices, weight data representing weights for the plurality of layers and input data for the plurality of layers;
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, from the one or more first memory devices, the weight data;
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, wherein evaluating at least one layer subsequent to a first layer of the plurality of layers comprises:
reading output data of a preceding layer from the one or more second memory devices;
processing the weight data and the output data of the preceding layer to evaluate the at least one layer, and thereby calculate output data of the at least one layer; and
writing the output data of the at least one layer into the one or more second memory devices to be read during the evaluation of a subsequent layer; 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.
