Methods and systems for receiving a request to implement a neural network comprising an average pooling layer on a hardware circuit, and in response, generating instructions that when executed by the hardware circuit, cause the hardware circuit to, during processing of a network input by the neural network, generate a layer output tensor that is equivalent to an output of the average pooling neural network layer by performing a convolution of an input tensor to the average pooling neural network layer and a kernel with a size equal to a window of the average pooling neural network layer and composed of elements that are each an identity matrix to generate a first tensor, and performing operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate an initial output tensor.
Please help me write a proper abstract based on the patent claims. CLAIM: 1. A method for processing an average pooling neural network layer of a neural network on a hardware circuit without performing computations of at least a portion of the average pooling neural network layer externally from the hardware circuit, the method comprising: receiving a request to process the neural network on the hardware circuit; and in response, generating instructions that when executed by a hardware matrix computation unit of the hardware circuit that performs matrix multiplications in hardware, cause the hardware matrix computation unit to, during processing of a network input by the neural network, generate a layer output tensor that is equivalent to an output of the average pooling neural network layer by performing operations comprising: performing, by the hardware matrix computation unit, a convolution of an input tensor to the average pooling neural network layer and a kernel with a size equal to a window of the average pooling neural network layer and composed of elements that are each an identity matrix to generate a first tensor; performing, by the hardware matrix computation unit, operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate an initial output tensor; and resealing, by the hardware matrix computation unit, edge elements of the initial output tensor by a first scaling factor and resealing corner elements of the initial output tensor by a second scaling factor to generate the layer output tensor. 2. (canceled) 3. The method of claim 1, wherein the first scaling factor is based on a number of elements of the input tensor that are multiplied with elements of the kernel in performing the convolution to generate an edge element of the first tensor, and the second scaling factor is based on a number of elements of the input tensor that are multiplied with elements of the kernel in performing the convolution to generate a corner element of the first tensor. 4. (canceled) 5. The method of claim 1, wherein performing the convolution of the input tensor and the kernel to generate the first tensor comprises: zero-padding the input tensor to generate a zero-padded input tensor; and performing a convolution of the zero-padded input tensor and the kernel to generate the first tensor. 6. (canceled) 7. The method of claim 1, wherein elements of the first tensor have a higher bit resolution than a bit resolution of the elements of the initial output tensor. 8. The method of claim 1, wherein performing the operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the initial output tensor comprises: generating a masking tensor, wherein a size of the masking tensor is determined by a size of the input tensor and wherein elements of the masking tensor are determined by a size of the window of the average pooling neural network layer; and performing element-wise multiplication of each element of the first tensor and each corresponding element of the masking tensor. 9. The method of claim 8, wherein generating the masking tensor comprises tiling one or more masking tensor fragments stored in memory. 10. The method of claim 8, wherein the input tensor is stored at a unified buffer of the hardware circuit and the masking tensor is stored at a dynamic memory of the hardware circuit, and wherein performing the operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the initial output tensor comprises: sending the input tensor from the unified buffer to the hardware matrix computation unit; sending the masking tensor from the dynamic memory to the hardware matrix computation unit; and performing, by the hardware matrix computation unit, element-wise multiplication of the input tensor and the masking tensor to generate the first tensor. 11. The method of claim 1, wherein the input tensor is stored at a unified buffer of the hardware circuit and the kernel is stored at a dynamic memory of the hardware circuit, and wherein performing the convolution of the input tensor and the kernel to generate the first tensor comprises: sending the input tensor from the unified buffer to the hardware matrix computation unit; sending the kernel from the dynamic memory to the hardware matrix computation unit; and performing, by the hardware matrix computation unit, the convolution of the input tensor and the kernel to generate the first tensor. 12. The method of claim 1, wherein performing the convolution of the input tensor and the kernel to generate the first tensor and performing the operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the initial output tensor are performed as fixed point operations. 13. A system comprising: a hardware circuit; and one or more storage devices storing instructions that are operable, when executed by the hardware circuit, to cause the hardware circuit to perform operations to generate a layer output tensor that is equivalent to an output of an average pooling neural network layer of a neural network, without performing computations of at least a portion of the average pooling neural network layer externally from the hardware circuit, by performing operations comprising: performing, by a hardware matrix computation unit of the hardware circuit that performs matrix multiplications in hardware, a convolution of an input tensor to the average pooling neural network layer and a kernel with a size equal to a window of the average pooling neural network layer and composed of elements that are each an identity matrix to generate a first tensor; performing, by the hardware matrix computation unit, operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate an initial output tensor; and rescaling, by the hardware matrix computation unit, edge elements of the initial output tensor by a first scaling factor and rescaling corner elements of the initial output tensor by a second scaling factor to generate the layer output tensor. 14. (canceled) 15. The system of claim 13, wherein the first scaling factor is based on a number of elements of the input tensor that are multiplied with elements of the kernel in performing the convolution to generate an edge element of the first tensor, and the second scaling factor is based on a number of elements of the input tensor that are multiplied with elements of the kernel in performing the convolution to generate a corner element of the first tensor. 16. (canceled) 17. The system of claim 13, wherein performing the convolution of the input tensor and the kernel to generate the first tensor comprises: zero-padding the input tensor to generate a zero-padded input tensor; and performing a convolution of the zero-padded input tensor and the kernel to generate the first tensor. 18. The system of claim 13, wherein performing the operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the initial output tensor comprises: generating a masking tensor, wherein a size of the masking tensor is determined by a size of the input tensor and wherein elements of the masking tensor are determined by a size of the window of the average pooling neural network layer; and performing element-wise multiplication of each element of the first tensor and each corresponding element of the masking tensor. 19. The system of claim 18, wherein the input tensor is stored at a unified buffer of the hardware circuit and the masking tensor is stored at a dynamic memory of the hardware circuit, and wherein performing the operations to cause each element of the first tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the initial output tensor comprises: sending the input tensor from the unified buffer to the hardware matrix computation unit; sending the masking tensor from the dynamic memory to the hardware matrix computation unit; and performing, by the hardware matrix computation unit, element-wise multiplication of the input tensor and the masking tensor to generate the first tensor. 20. The system of claim 13, wherein the input tensor is stored at a unified buffer of the hardware circuit and the kernel is stored at a dynamic memory of the hardware circuit, and wherein performing the convolution of the input tensor and the kernel to generate the first tensor comprises: sending the input tensor from the unified buffer to the hardware matrix computation unit; sending the kernel from the dynamic memory to the hardware matrix computation unit; and performing, by the hardware matrix computation unit, the convolution of the input tensor and the kernel to generate the first tensor. 21. A method for processing an average pooling neural network layer of a neural network on a hardware circuit without performing computations of at least a portion of the average pooling neural network layer externally from the hardware circuit, the method comprising: receiving a request to process the neural network on the hardware circuit; and in response, generating instructions that when executed by a hardware matrix computation unit of the hardware circuit that performs matrix multiplications in hardware, cause the hardware matrix computation unit to, during processing of a network input by the neural network, generate a layer output tensor that is equivalent to an output of the average pooling neural network layer by performing operations comprising: performing, by the hardware matrix computation unit, a convolution of an input tensor to the average pooling neural network layer and a kernel with a size equal to a window of the average pooling neural network layer and composed of elements that are each an identity matrix to generate a first tensor; resealing, by the hardware matrix computation unit, edge elements of the first tensor by a first scaling factor and resealing corner elements of the first tensor by a second scaling factor to generate an initial output tensor; and performing, by the hardware matrix computation unit, operations to cause each element of the initial output tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the layer output tensor. 22. The method of claim 21, wherein the first scaling factor is based on a number of elements of the input tensor that are multiplied with elements of the kernel in performing the convolution to generate an edge element of the initial output tensor, and the second scaling factor is based on a number of elements of the input tensor that are multiplied with elements of the kernel in performing the convolution to generate a corner element of the initial output tensor. 23. The method of claim 21, wherein performing the convolution of the input tensor and the kernel to generate the first tensor comprises: zero-padding the input tensor to generate a zero-padded input tensor; and performing a convolution of the zero-padded input tensor and the kernel to generate the first tensor. 24. The method of claim 21, wherein performing the operations to cause each element of the initial output tensor to be divided by a number of elements in the window of the average pooling neural network layer to generate the layer output tensor comprises: generating a masking tensor, wherein a size of the masking tensor is determined by a size of the input tensor and wherein elements of the masking tensor are determined by a size of the window of the average pooling neural network layer; and performing element-wise multiplication of each element of the initial output tensor and each corresponding element of the masking tensor. 25. The method of claim 21, wherein the input tensor is stored at a unified buffer of the hardware circuit and the kernel is stored at a dynamic memory of the hardware circuit, and wherein performing the convolution of the input tensor and the kernel to generate the first tensor comprises: sending the input tensor from the unified buffer to the hardware matrix computation unit; sending the kernel from the dynamic memory to the hardware matrix computation unit; and performing, by the hardware matrix computation unit, the convolution of the input tensor and the kernel to generate the first tensor.