| CPC G06F 17/15 (2013.01) | 20 Claims |

|
1. A convolution operation method, comprising:
determining an operation convolution kernel, wherein the operation convolution kernel is obtained based on an initial convolution kernel, the initial convolution kernel is expressed as [R, S, C, K], the operation convolution kernel is expressed as [1, 1, (C×R×S), K], and R, S, C, and K are integers greater than 0;
adjusting a layout of input data based on a number of channels of the operation convolution kernel to obtain target data, wherein a size and a number of channels of the target data are different from a size and a number of channels of the input data, and the number of channels of the target data is equal to the number of channels of the operation convolution kernel; and
performing a convolution operation based on the target data and the operation convolution kernel to obtain a convolution operation result, wherein the convolution operation result of the target data and the operation convolution kernel is equal to a convolution operation result of the input data and the initial convolution kernel,
wherein the adjusting the layout of the input data based on the number of channels of the operation convolution kernel to obtain the target data comprises:
storing the input data in a static memory in units of rows, wherein each row of the input data is stored in corresponding N entries in the static memory, N being an integer greater than 0,
performing padding on the input data stored in the static memory to obtain extended data, wherein the performing padding on the input data stored in the static memory comprises:
in the static memory, padding entries in front of and after a storage location corresponding to the input data with a first preset value to obtain first intermediate data, wherein the first intermediate data comprise the input data and the padded first preset value,
transmitting the first intermediate data to a vector calculation circuit that comprises a memory, and padding two ends of each row corresponding to the first intermediate data with a second preset value using a shift instruction and a padding instruction from the vector calculation circuit to obtain second intermediate data, wherein the second intermediate data comprise the first intermediate data and the padded second preset value, and
transmitting the second intermediate data to a corresponding storage location in the static memory to obtain the extended data, wherein the extended data is the same as the second intermediate data in content.
|