Implementation of argmax or argmin in hardware
AssigneeImagination Technologies Limited
InventorsAria Ahmadi, Muhammad Asad, Cagatay Dikici, Elia Condorelli
Life of this patent
Estimating the term…
Abstract
A mechanism for processing, on a hardware accelerator comprising fixed-function circuitry, data according to a neural network process that comprises a neural network with an associated argmax or argmin function. The argmax or argmin function is mapped to a set of elementary neural network operations available to the fixed-function circuitry. The neural network process is then executed using the fixed-function circuitry. The data processed using the neural network process comprises image and/or audio data.
Claims14
A method of processing data according to a neural network process using a hardware accelerator comprising fixed-function circuitry configured to perform a set of available elementary neural network operations, the method comprising:
- receiving a definition of a neural network process to be performed on the data, the neural network process comprising a neural network with an associated argmax or argmin function;
- mapping the argmax or argmin function to a set of elementary neural network operations, wherein the set of elementary neural network operations comprises only elementary neural network operations from the set of available elementary neural network operations;
- and
- processing the data according to the neural network process, using the fixed-function circuitry of the hardware accelerator to perform the neural network with the associated argmax or argmin function, wherein the argmax or argmin function is performed using the set of elementary neural network operations;
- wherein the data comprises image data and/or audio data;
- and
- wherein each of the set of elementary neural network operations is selected from a list consisting of:
- an element-wise subtraction operation,
- an element-wise addition operation,
- an element-wise multiplication operation,
- an element-wise maximum operation,
- an element-wise minimum operation,
- a max pooling operation or min pooling operation,
- a magnitude operation, and
- one or more lookups operations using one or more look-up tables;
- wherein the set of elementary neural network operations implements:
- a binary maximum/minimum operation, applied to an input tensor, to produce a binary tensor of the same spatial size as the input tensor, wherein each element in the binary tensor:
- corresponds to a different element of the input tensor;
- and
- contains a binary value indicating whether or not the corresponding element of the input tensor has a value equal to the maximum/minimum value contained in the input tensor:
- an integer index operation, applied to the binary tensor, that identifies one or more indexes of the binary tensor, the identified one or more indexes being indexes of the one or more elements of the binary tensor that have a binary value that indicates the corresponding element of the input tensor has a value equal to the maximum/minimum value contained in the input tensor;
- and
- a tie elimination operation, applied to the identified indexes, that selects a single one of the one or more identified indexes to provide the output of the argmax or argmin function,
- wherein the binary maximum operation is performed if the argmax or argmin function is the argmax function, and binary minimum operation is performed if the argmax or argmin function is the argmin function,
- wherein the binary maximum/minimum operation comprises performing:
- a first maximum/minimum operation, applied to the input tensor, that identifies the maximum/minimum value contained in any element of the input tensor;
- and
- an equals operation, applied to each element of the input tensor, that given the output of the maximum/minimum operation, modifies the value of the element to be either a first binary value or a second, different binary value responsive to whether or not the value of the element contains the maximum/minimum value contained in the input tensor, to thereby produce the binary tensor,
- wherein the first maximum/minimum operation is the first maximum operation if the argmax or argmin function is the argmax function, and the first maximum/minimum operation is the first minimum operation if the argmax or argmin function is the argmin function,
- wherein the first maximum/minimum operation is performed by a first maximum/minimum iterative process comprising:
- splitting a first comparative tensor into two parts;
- processing the two parts of the first comparative tensor using, for the first maximum operation an element-wise maximum operation and for the first minimum operation an element-wise minimum operation, to produce a new first comparative tensor;
- wherein:
- for a first iteration of the maximum/minimum iterative process, the input tensor acts as the first comparative tensor;
- for any subsequent iterations of the maximum/minimum iterative process, the new first comparative tensor acts as the first comparative tensor;
- and
- the maximum/minimum iterative process is repeated until the first comparative tensor contains only a single element, this single element having for the first maximum operation, the maximum value contained in the input tensor or for the first minimum operation the minimum value contained in the input tensor.
A data processing system for processing data according to a neural network process, the data processing system comprising:
- a hardware accelerator comprising fixed-function circuitry configured to perform a set of available elementary neural network operations;
- and
- a controller configured to:
- receive a definition of a neural network process to be performed on the data, the neural network process comprising a neural network with an associated argmax or argmin function,
- map the argmax or argmin function to a set of elementary neural network operations, wherein the set of elementary neural network operations comprises only elementary neural network operations from the set of available elementary neural network operations, and
- process the data according to the neural network process, using the fixed-function circuitry of the hardware accelerator to perform the neural network with the associated argmax or argmin function, wherein the argmax or argmin function is performed using the set of elementary neural network operations;
- wherein the data comprises image data and/or audio data;
- and
- wherein each of the set of elementary neural network operations is selected from a list consisting of:
- an element-wise subtraction operation,
- an element-wise addition operation,
- an element-wise multiplication operation,
- an element-wise maximum operation,
- an element-wise minimum operation,
- a max pooling operation or min pooling operation,
- a magnitude operation, and
- one or more lookups operations using one or more look-up tables,
- wherein the set of elementary neural network operations implements:
- a binary maximum/minimum operation, applied to an input tensor, to produce a binary tensor of the same spatial size as the input tensor, wherein each element in the binary tensor:
- corresponds to a different element of the input tensor;
- and
- contains a binary value indicating whether or not the corresponding element of the input tensor has a value equal to the maximum/minimum value contained in the input tensor;
- an integer index operation, applied to the binary tensor, that identifies one or more indexes of the binary tensor, the identified one or more indexes being indexes of the one or more elements of the binary tensor that have a binary value that indicates the corresponding element of the input tensor has a value equal to the maximum/minimum value contained in the input tensor;
- and
- a tie elimination operation, applied to the identified indexes, that selects a single one of the one or more identified indexes to provide the output of the argmax or argmin function,
- wherein the binary maximum operation is performed if the argmax or argmin function is the argmax function, and binary minimum operation is performed if the argmax or argmin function is the argmin function,
- wherein the binary maximum/minimum operation comprises performing:
- a first maximum/minimum operation, applied to the input tensor, that identifies the maximum/minimum value contained in any element of the input tensor;
- and
- an equals operation, applied to each element of the input tensor, that given the output of the maximum/minimum operation, modifies the value of the element to be either a first binary value or a second, different binary value responsive to whether or not the value of the element contains the maximum/minimum value contained in the input tensor, to thereby produce the binary tensor,
- wherein the first maximum/minimum operation is the first maximum operation if the argmax or argmin function is the argmax function, and the first maximum/minimum operation is the first minimum operation if the argmax or argmin function is the argmin function,
- wherein the first maximum/minimum operation is performed by a first maximum/minimum iterative process comprising:
- splitting a first comparative tensor into two parts;
- processing the two parts of the first comparative tensor using, for the first maximum operation an element-wise maximum operation and for the first minimum operation an element-wise minimum operation, to produce a new first comparative tensor;
- wherein:
- for a first iteration of the maximum/minimum iterative process, the input tensor acts as the first comparative tensor;
- for any subsequent iterations of the maximum/minimum iterative process, the new first comparative tensor acts as the first comparative tensor;
- and
- the maximum/minimum iterative process is repeated until the first comparative tensor contains only a single element, this single element having for the first maximum operation, the maximum value contained in the input tensor or for the first minimum operation the minimum value contained in the input tensor.
Dependencies are inferred from the claim text.