Movement of tensor data during reshape operation
AssigneeGoogle Inc.
InventorsArun Chauhan, Fatih Mehmet Bakir, Phitchaya Mangpo Phothilimthana, Dong Hyuk Woo
Life of this patent
Estimating the term…
Abstract
A method of performing a reshape operation specified in a reshape layer of a neural network model is described. The reshape operation reshapes an input tensor with an input tensor shape to an output tensor with an output tensor shape. The tensor data that has to be reshaped is directly routed between tile memories of the hardware accelerator in an efficient manner. This advantageously optimizes usage of memory space and allows any number and type of neural network models to be run on the hardware accelerator.
Claims16
A method of performing a reshape operation specified in a reshape layer of a neural network model, the method comprising:
- transmitting, to a reshape solver, an input tensor with an input tensor shape and an output tensor with an output tensor shape;
- receiving, from the reshape solver, data identifying chunks of tensor data to be moved within memories of a hardware accelerator, a source computing unit on the hardware accelerator from where each corresponding chunk is to be moved, and a target computing unit on the hardware accelerator to where each corresponding chunk is to be moved;
- transmitting, to a constraint based solver, the received data and a maximum number of time steps over which the reshape operation is to be performed;
- receiving, from the constraint based solver, a schedule based on the received data, a number of computing units within the hardware accelerator, and a maximum number of time steps, the schedule indicating routes for transferring the chunks of tensor data between the memories of the hardware accelerator;
- updating the schedule by removing cyclical routes or merging chunks moving over a single route or both to generate an updated schedule;
- compiling the updated schedule to generate compiled data;
- and
- transmitting the compiled data to the hardware accelerator.
A system that performs a reshape operation specified in a reshape layer of a neural network model, the reshape operation configured to reshape an input tensor with an input tensor shape to an output tensor with an output tensor shape, the system comprising:
- at least one programmable processor;
- and
- a machine-readable medium storing instructions that, when executed by the at least one programmable processor, cause the at least one programmable processor to:
- transmit, to a reshape solver, the input tensor and the output tensor;
- receive, from the reshape solver, data identifying chunks of tensor data to be moved within memories of a hardware accelerator, a source computing unit on the hardware accelerator from where each corresponding chunk is to be moved, and a target computing unit on the hardware accelerator to where each corresponding chunk is to be moved;
- transmit, to a constraint based solver, the received data, a number of computing units within the hardware accelerator, and a maximum number of time steps over which the reshape operation is to be performed;
- receive, from the constraint based solver, a schedule based on the received data, the number of computing units within the hardware accelerator, and the maximum number of time steps, the schedule indicating routes for transferring the chunks of tensor data between the memories of the hardware accelerator;
- updating the schedule by removing cyclical routes or merging chunks moving over a single route or both to generate an updated schedule;
- compile the updated schedule to generate compiled data;
- and
- transmit the compiled data to the hardware accelerator.
A non-transitory computer program product storing instructions that, when executed by at least one programmable processor, cause the at least one programmable processor to:
- transmit, to a reshape solver, an input tensor with an input tensor shape and an output tensor with an output tensor shape;
- receive, from the reshape solver, data identifying chunks of tensor data to be moved within memories of a hardware accelerator, a source computing unit on the hardware accelerator from where each corresponding chunk is to be moved, and a target computing unit on the hardware accelerator to where each corresponding chunk is to be moved;
- transmit, to a constraint based solver, the received data, a number of computing units within the hardware accelerator, and a maximum number of time steps over which a reshape operation is to be performed;
- receive, from the constraint based solver, a schedule based on the received data, the number of computing units within the hardware accelerator, and the maximum number of time steps, the schedule indicating routes for transferring the chunks of tensor data between the memories of the hardware accelerator;
- updating the schedule by removing cyclical routes or merging chunks moving over a single route or both to generate an updated schedule;
- compile the updated schedule to generate compiled data;
- and
- transmit the compiled data to the hardware accelerator.
Dependencies are inferred from the claim text.