# US 2023/0068168 A1 · Neural network transpose layer removal

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

- Number: US 2023/0068168 A1
- Document ID: US20230068168A1
- Status: Published application
- Kind: A1
- Application number: 17/405,738
- Filed: 2021-08-18
- Published: 2023-03-02
- Earliest claimed: 2021-08-18
- Assignees: Micron Technology, Inc.
- Applicants: Micron Technology, Inc.
- Inventors: Patrick Estep
- Web page: https://patentgrep.com/patent/US20230068168A1

## CPC

- G06N 3/063: using electronic means
- G06N 3/082: modifying the architecture, e.g. adding, deleting or silencing nodes or connections
- G06F 9/3887: {controlled by a single instruction for multiple data lanes [SIMD]}
- G06N 3/04: Architecture, e.g. interconnection topology
- G06N 3/0464: Convolutional networks [CNN, ConvNet]
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Devices and techniques for neural network transpose layer removal are described herein. A neural network model that includes matrices of synaptic weights arranged in several layers is obtained. The neural network model is inspected to determine whether a transposition of a matrix to a fully connected layer exists. If there is a matrix transposition, then a modified neural network model is created by changing values of the fully connected layer to correspond to values in the matrix prior to the transposition and eliminating the transposition. The modified neural network model can then be provided to computer hardware to perform inference operations.

## Claims

### Claim 1

An apparatus comprising:
a hybrid threading fabric (HTF); and
a processor configured to:
obtain a neural network model that includes matrices of synaptic weights arranged in several layers;
detect, in the neural network model, a transposition of a matrix to a fully connected layer;
create, in response to detection of the matrix transposition, a modified neural network model, creation of the modified neural network model including:
changes to values of the fully connected layer to correspond to values in the matrix prior to the transposition; and
elimination of the transposition; and
provide the modified neural network model for inference on the HTF.

### Claim 2 (depends on 1)

The apparatus of claim 1, wherein the changes to the values of the fully connected layer to correspond to values in the matrix prior to the transposition include the processor configured to:
map a first position of the matrix to a second position in the fully connected layer under a flatten operation of the neural network model; and
move a weight, of the fully connected layer, that corresponds to the first position to the second position.

### Claim 3 (depends on 2)

The apparatus of claim 2, wherein layers of the neural network model prior to the fully connected layer are convolutional neural network layers.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein, to move the weight, the processor is configured to compute weights for a new convolution CONV2 of the fully connected layer, which has a first dimension of one and a second dimension of OUTSIZE, from an original convolution CONV1:
for c in range (NCHANNELS):
for h in range (HEIGHT):
for w in range (WIDTH):
for j in range (OUTSIZE):
i1 = c * HEIGHT * WIDTH + h * WIDTH + w;
i2 = c * HEIGHT * WIDTH + w * WIDTH + h; and
CONV2.weight[j][i1] = CONV1.weight[j][i2].

### Claim 5 (depends on 3)

The apparatus of claim 3, wherein the convolutional neural network layers were trained separately from layers subsequent to the fully connected layer, and wherein the transposition is a layer incorporated into the neural network model to interface the convolutional neural network layers to the layers subsequent to the fully connected layer.

### Claim 6 (depends on 5)

The apparatus of claim 5, wherein the convolutional neural network layers are an instance of Multi-Task Cascaded Convolutional Networks (MTCNN) for facial recognition and bounding boxes of faces in images.

### Claim 7 (depends on 1)

The apparatus of claim 1, wherein, the processor is configured to detect the transposition of the matrix to the fully connected layer and the processor is configured to create the modified neural network model by a compiler targeting the HTF.

### Claim 8 (depends on 1)

The apparatus of claim 1, wherein the apparatus is a memory device that includes a hybrid threading processor (HTP), a memory controller, and memory.

### Claim 9 (depends on 8)

The apparatus of claim 8, wherein the processor is the HTP.

### Claim 10 (depends on 1)

The apparatus of claim 1, wherein the apparatus is a compute-near memory node that includes a host processor and a memory-compute device, wherein the processor is the host processor and wherein the HTF is included in the memory-compute device.

### Claim 11 (depends on 8)

The apparatus of claim 8, wherein, the processor is configured to detect the transposition of the matrix to the fully connected layer and the processor is configured to create the modified neural network model by a just-in-time (JIT) compiler.

### Claim 12 (depends on 8)

The apparatus of claim 8, wherein the apparatus is configured to:
be included in a vehicle control system that interfaces with a camera of the vehicle configured to capture images as a vehicle operates; and
provide facial recognition and bounding boxes of faces in the images through the inference on the HTF.

### Claim 13 (depends on 1)

The apparatus of claim 1, wherein, to provide the modified neural network model for inference on the HTF, the processor is configured to create at least one of an installation package, an executable application, a loadable module, or a script to run on the HTF.

### Claim 14

A method comprising:
obtaining a neural network model that includes matrices of synaptic weights arranged in several layers;
detecting, in the neural network model, a transposition of a matrix to a fully connected layer;
creating, in response to detecting the matrix transposition, a modified neural network model, including:
changing values of the fully connected layer to correspond to values in the matrix prior to the transposition; and
eliminating the transposition; and
providing the modified neural network model for inference on computer hardware.

### Claim 15 (depends on 14)

The method of claim 14, wherein changing the values of the fully connected layer to correspond to values in the matrix prior to the transposition includes:
mapping a first position of the matrix to a second position in the fully connected layer under a flatten operation of the neural network model; and
moving a weight, of the fully connected layer, that corresponds to the first position to the second position.

### Claim 16 (depends on 15)

The method of claim 15, wherein layers of the neural network model prior to the fully connected layer are convolutional neural network layers.

### Claim 17 (depends on 16)

The method of claim 16, wherein moving the weight includes computing weights for a new convolution CONV2 of the fully connected layer, which has a first dimension of one and a second dimension of OUTSIZE, from an original convolution CONV1:
for c in range (NCHANNELS):
for h in range (HEIGHT):
for w in range (WIDTH):
for j in range (OUTSIZE):
i1 = c * HEIGHT * WIDTH + h * WIDTH + w;
i2 = c * HEIGHT * WIDTH + w * WIDTH + h; and
CONV2.weight[j][i1] = CONV1.weight[j][i2].

### Claim 18

Machine readable media including instructions that, when executed by processing circuitry, cause processing circuitry to perform operations comprising:
obtaining a neural network model that includes matrices of synaptic weights arranged in several layers;
detecting, in the neural network model, a transposition of a matrix to a fully connected layer;
creating, in response to detecting the matrix transposition, a modified neural network model, including:
changing values of the fully connected layer to correspond to values in the matrix prior to the transposition; and
eliminating the transposition; and
providing the modified neural network model for inference on computer hardware.

### Claim 19 (depends on 18)

The machine readable media of claim 18, wherein changing the values of the fully connected layer to correspond to values in the matrix prior to the transposition includes:
mapping a first position of the matrix to a second position in the fully connected layer under a flatten operation of the neural network model; and
moving a weight, of the fully connected layer, that corresponds to the first position to the second position.

### Claim 20 (depends on 19)

The machine readable media of claim 19, wherein layers of the neural network model prior to the fully connected layer are convolutional neural network layers.

### Claim 21 (depends on 20)

The machine readable media of claim 20, wherein moving the weight includes computing weights for a new convolution CONV2 of the fully connected layer, which has a first dimension of one and a second dimension of OUTSIZE, from an original convolution CONV1:
for c in range (NCHANNELS):
for h in range (HEIGHT):
for w in range (WIDTH):
for j in range (OUTSIZE):
i1 = c * HEIGHT * WIDTH + h * WIDTH + w;
i2 = c * HEIGHT * WIDTH + w * WIDTH + h; and
CONV2.weight[j][i1] = CONV1.weight[j][i2].

### Claim 22 (depends on 20)

The machine readable media of claim 20, wherein the convolutional neural network layers were trained separately from layers subsequent to the fully connected layer, and wherein the transposition is a layer incorporated into the neural network model to interface the convolutional neural network layers to the layers subsequent to the fully connected layer.

### Claim 23 (depends on 22)

The machine readable media of claim 22, wherein the convolutional neural network layers are an instance of Multi-Task Cascaded Convolutional Networks (MTCNN) for facial recognition and bounding boxes of faces in images.

### Claim 24 (depends on 18)

The machine readable media of claim 18, wherein detecting the transposition of the matrix to the fully connected layer and creating the modified neural network model are performed by a compiler targeting the computer hardware.

### Claim 25 (depends on 18)

The machine readable media of claim 18, wherein the computer hardware conforms to a single instruction, multiple data (SIMD) architecture.

### Claim 26 (depends on 25)

The machine readable media of claim 25, wherein the computer hardware is a hybrid threading fabric (HTF) device.

### Claim 27 (depends on 26)

The machine readable media of claim 26, wherein the HTF device is included in a memory device that also includes a hybrid threading processor (HTP), a memory controller, and memory.

### Claim 28 (depends on 27)

The machine readable media of claim 27, wherein detecting the transposition of the matrix to the fully connected layer and creating the modified neural network model are performed by a just-in-time (JIT) compiler of the memory device.

### Claim 29 (depends on 27)

The machine readable media of claim 27, wherein the memory device is configured to:
be included in a vehicle control system that interfaces with a camera of the vehicle configured to capture images as a vehicle operates; and
provide facial recognition and bounding boxes of faces in the images through the inference on the computer hardware.

### Claim 30 (depends on 18)

The machine readable media of claim 18, wherein providing the modified neural network model for inference on the computer hardware includes creating at least one of an installation package, an executable application, a loadable module, or a script to run on the computer hardware.
