WO2019234794A1 - 演算方法 - Google Patents

演算方法 Download PDF

Info

Publication number
WO2019234794A1
WO2019234794A1 PCT/JP2018/021371 JP2018021371W WO2019234794A1 WO 2019234794 A1 WO2019234794 A1 WO 2019234794A1 JP 2018021371 W JP2018021371 W JP 2018021371W WO 2019234794 A1 WO2019234794 A1 WO 2019234794A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
internal memory
input data
convolution
external memory
Prior art date
Application number
PCT/JP2018/021371
Other languages
English (en)
French (fr)
Inventor
誠 山倉
Original Assignee
株式会社ソシオネクスト
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 株式会社ソシオネクスト filed Critical 株式会社ソシオネクスト
Priority to CN201880093914.3A priority Critical patent/CN112166442B/zh
Priority to PCT/JP2018/021371 priority patent/WO2019234794A1/ja
Priority to JP2020523858A priority patent/JP7136204B2/ja
Publication of WO2019234794A1 publication Critical patent/WO2019234794A1/ja
Priority to US17/108,833 priority patent/US11907327B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/15Correlation function computation including computation of convolution operations
    • G06F17/153Multidimensional correlation or convolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means

Definitions

  • the present disclosure relates to a calculation method, and more particularly, to a calculation method for performing a convolution operation in a convolution layer of a convolutional neural network.
  • Patent Document 1 discloses a technique that can efficiently perform arithmetic processing on two-dimensional data exceeding the memory size of a memory circuit block built in an LSI chip.
  • Patent Document 1 a convolution operation in a relatively small-scale convolutional neural network is an object of calculation processing. For this reason, the technique disclosed in Patent Document 1 has a problem in that when performing a convolution operation in a large-scale convolutional neural network, input data is read from the outside and used, so that power consumption increases.
  • an arithmetic method capable of performing a convolution operation while suppressing power consumption even in an internal memory having a limited capacity such as several megabytes or less.
  • the purpose is to provide.
  • An arithmetic method is an arithmetic method in which a convolution operation in a convolution layer of a neural network is performed by a matrix product operation using an arithmetic unit and an internal memory included in the LSI, and is performed for each convolution layer. Determining whether or not the input data input to the convolution layer is equal to or less than a predetermined amount of data; and when the determination step determines that the input data is equal to or less than the predetermined amount of data, When the first calculation mode is selected and the convolution calculation is performed in the first calculation mode and the determination step determines that the input data is larger than the predetermined data amount, the second calculation is performed.
  • the output data may be output by placing the output data in the internal memory or the external memory as input data in a layer subsequent to the convolution layer.
  • the latter layer may be a convolution layer, a pooling layer, or a normalization layer.
  • the step of executing the convolution operation in the first operation mode includes the step of converting the input data arranged in the internal memory into a matrix of the input data by sampling
  • the step of executing the convolution operation in the operation mode may include a step of converting a part of the input data read into the internal memory into the one or more column or row vector data by sampling.
  • the input data may be arranged in a tiled form in the external memory.
  • the output data when the output data is arranged in the external memory, the output data may be arranged in a tiled form in the external memory.
  • An arithmetic method is an arithmetic method in which a convolution operation in a convolution layer of a neural network is performed by a matrix product operation using an arithmetic unit included in an LSI and an internal memory.
  • the determination step for determining whether or not the input data input to the convolution layer is equal to or less than a predetermined data amount, and in the determination step, the input data is determined to be equal to or less than the predetermined data amount.
  • the first calculation mode is selected, the convolution calculation is performed in the first calculation mode, and the determination step determines that the input data is larger than a predetermined data amount, the second Obtained by executing a convolution operation in the second operation mode, and a step of executing a convolution operation in the second operation mode.
  • An output step of outputting output data as a result of the step, and in the step of executing the convolution operation in the first operation mode, the weight data of the convolution layer is arranged in an external memory outside the LSI.
  • Step placing the input data of the convolutional layer in the internal memory, and reading the weight data from the external memory in part as one or more row or column vector data to the internal memory, Causing the computing unit to perform a matrix product operation with the matrix of input data arranged in the internal memory, and the weight data is read from the external memory to the internal memory only once as a whole.
  • the input data and weight data of the convolution layer are Placing in external memory external to the LSI; placing from the external memory a portion of the weight data in the internal memory as first vector data that is one or more row or column vector data; The input data is partially read from the external memory to the internal memory as one or more column or row vector data, and a matrix product operation with the first vector data arranged in the internal memory is performed.
  • the calculation method of the present disclosure it is possible to perform a convolution calculation while suppressing power consumption even with an internal memory having a limited capacity.
  • FIG. 1 is a block diagram illustrating an example of a configuration of an arithmetic system according to an embodiment.
  • FIG. 2 is a diagram illustrating an example of a configuration of a convolutional neural network according to the embodiment.
  • FIG. 3A is an explanatory diagram of a method for performing a convolution operation by a matrix product operation.
  • FIG. 3B is an explanatory diagram of a method for performing a convolution operation by a matrix product operation.
  • FIG. 4A is a diagram illustrating a method of arranging output data in the external memory according to the embodiment.
  • FIG. 4B is a diagram illustrating an arrangement method of output data in the external memory according to the embodiment.
  • FIG. 5 is a flowchart showing an outline of the operation of the arithmetic system according to the embodiment.
  • FIG. 6 is a flowchart showing details of the operation in step S3 shown in FIG.
  • FIG. 7 is a flowchart showing details of the operation in step S6 shown in FIG.
  • FIG. 8 is a diagram for explaining the effect of the calculation method in the first calculation mode according to the embodiment.
  • FIG. 9 is a diagram for explaining the effect of the calculation method in the first calculation mode according to the embodiment.
  • FIG. 10 is a diagram for explaining the effect of the calculation method in the second calculation mode according to the embodiment.
  • FIG. 11 is a flowchart showing details of the operation in step S6 according to the modification.
  • FIG. 12 is a diagram for explaining the effect of the calculation method in the second calculation mode according to the modification.
  • FIG. 1 is a block diagram illustrating an example of a configuration of an arithmetic system 1 according to the embodiment.
  • FIG. 1 includes a circuit 10, an external memory 20, a determination unit 30, a control unit 40, and an output unit 50.
  • FIG. 2 is a diagram illustrating an example of a configuration of the convolutional neural network 60 according to the embodiment.
  • the external memory 20 is outside the circuit 10 and is configured by, for example, a nonvolatile memory such as an EEPROM or a flash memory, a hard disk, or a RAM with a battery.
  • the external memory 20 stores, for example, weight data in a convolution layer to be subjected to arithmetic processing of the convolutional neural network 60 according to the first arithmetic mode or the second arithmetic mode selected by the control unit 40, or , Input data is arranged.
  • output data obtained by causing the circuit 10 to perform a convolution operation may be arranged in the external memory 20.
  • the convolutional neural network is represented as CNN (ConvolutionalvolutionNeural Network).
  • the convolution neural network 60 is a multilayer neural network that repeats a convolution layer (Conv), a pooling layer (Pooling Layer), and a normalization layer (Normalize Layer). In the example shown in FIG. 2, the convolutional neural network 60 has three different convolutional layers connected after the second pooling layer.
  • the circuit 10 is caused to perform a convolution operation in a plurality of convolution layers constituting the convolutional neural network 60.
  • the circuit 10 is configured by, for example, an LSI or an LSI chip, and performs, for example, a convolution operation in a convolution layer of the convolutional neural network 60 by a matrix product operation. As shown in FIG. 1, the circuit 10 includes an arithmetic unit 11 and an internal memory 12 inside.
  • the internal memory 12 has a relatively small capacity, and is constituted by, for example, a RAM.
  • a relatively small capacity a capacity of several hundred kilobytes to several megabytes or less can be considered.
  • the internal memory 12 is controlled by the control unit 40 described later.
  • the internal memory 12 determines, for example, part of the weight data in the convolutional layer to be subjected to arithmetic processing of the convolutional neural network 60, or the weight according to the first arithmetic mode or the second arithmetic mode selected by the control unit 40. Data is placed.
  • the internal memory 12 may, for example, part of the input data of the convolutional layer to be subjected to arithmetic processing of the convolutional neural network 60 according to the first arithmetic mode or the second arithmetic mode selected by the control unit 40, or Input data is placed.
  • output data obtained by causing the circuit 10 to perform a convolution operation may be arranged.
  • the computing unit 11 is controlled by the control unit 40 described later.
  • the calculator 11 includes a product-sum calculator 111 and a data converter 112 as shown in FIG.
  • Product-sum operation unit 111 is controlled by the control unit 40 and performs a convolution operation by a matrix product operation.
  • FIGS. 3A and 3B are explanatory diagrams of a method for performing a convolution operation by a matrix product operation according to the embodiment.
  • FIG. 3B A more specific method of matrix product of weight data and input data is shown in FIG. 3B, for example. That is, the sum of products of the first row component of the weight data and the first column component of the converted input data becomes the first row and first column component of the output data, and the first row component of the weight data and the converted data The product sum of the components in the second column of the input data becomes the component in the first row and the second column of the output data.
  • the matrix product is calculated so that the sum of products of the component in the a-th row of the weight data and the component in the b-th column of the converted input data becomes the component in the a-th row and b-th column of the output data.
  • bias data may be further added to each element of the output data.
  • the matrix product of the matrix of the weight data and the matrix of the input data after conversion is described as being calculated in this order, but the present invention is not limited to this.
  • the matrix product of the matrix of input data after conversion and the matrix of weight data may be calculated in this order.
  • the input data may be sampled and data converted so that the number of components in one row of the converted input data is the same as the number of components in one column of the weight data matrix.
  • the product-sum operation unit 111 is read from the external memory 20 into the internal memory 12 as one or more row or column vector data part by part. A matrix product operation of the weight data and a matrix of input data arranged in the internal memory 12 is performed.
  • the sum-of-products operation unit 111 is internally stored as one or more column or row vector data, partly from the weight data matrix arranged in the internal memory 12 and the external memory 20. Matrix product operation with the input data read to the memory 12 is performed.
  • the data conversion unit 112 is controlled by the control unit 40, and converts some of the input data read into the internal memory 12 or the input data arranged in the internal memory 12 by sampling. As a result, the input data subjected to data conversion can be subjected to a matrix product operation with a matrix of weight data.
  • the data converter 112 when the first calculation mode is selected, converts the input data arranged in the internal memory 12 into a matrix of input data by sampling. In addition, when the second calculation mode is selected, the data conversion unit 112 converts a part of input data read into the internal memory 12 into one or more column or row vector data by sampling.
  • the determination unit 30 is realized by a CPU (Central Processing Unit) (not shown), a memory, and the like.
  • the determination unit 30 determines for each convolution layer whether or not the input data input to the convolution layer is equal to or less than a predetermined data amount.
  • the predetermined data amount is, for example, the maximum capacity (size) allocated to the input data in the internal memory 12.
  • the determination unit 30 determines whether or not the input data input to the convolution layer is equal to or less than a predetermined data amount. Determine whether. As shown in FIG. 2, when a plurality of convolution layers are connected to the subsequent stage of the same layer, the determination unit 30 has the input data input for each convolution layer not more than a predetermined data amount. Or not.
  • the control unit 40 is realized by a CPU (not shown), a memory, and the like.
  • the control unit 40 selects the first calculation mode and executes the convolution calculation in the first calculation mode. More specifically, when the first calculation mode is selected, the control unit 40 places the weight data of the convolution layer in the external memory 20 outside the circuit 10, and stores the input data of the convolution layer in the internal memory. 12. Then, the control unit 40 reads the weight data from the external memory 20 partly as one or more row or column vector data to the internal memory 12 and a matrix with the input data matrix arranged in the internal memory 12. A product-sum operation unit 111 is caused to perform a product operation. As a result, the weight data as a whole is read from the external memory 20 to the internal memory 12 only once.
  • the control unit 40 selects the second calculation mode and executes the convolution calculation in the second calculation mode. More specifically, when the second calculation mode is selected, the control unit 40 places the input data of the convolution layer in the external memory 20 outside the circuit 10, and sets a matrix of weight data of the convolution layer. It is arranged in the internal memory 12. Then, the control unit 40 reads the input data from the external memory 20 part by part as one or more column or row vector data to the internal memory 12 and a matrix with the weight data matrix arranged in the internal memory 12. A product-sum operation unit 111 is caused to perform a product operation. As a result, the input data as a whole is read from the external memory 20 to the internal memory 12 only once.
  • the output unit 50 outputs output data that is a result obtained by executing the convolution operation.
  • the output unit 50 may output the output data by arranging the output data in the internal memory 12 or the external memory 20 as input data in a layer subsequent to the convolution layer.
  • the subsequent layer is a convolution layer, a pooling layer, or a normalization layer in the convolutional neural network.
  • 4A and 4B are diagrams showing a method of arranging output data in the external memory 20 according to the embodiment.
  • the output unit 50 When outputting the output data to the external memory 20, the output unit 50 may be arranged in a raster form as shown in FIG. 4A, but may be arranged in a tile form.
  • the raster-like format means a format in which numerical values (components) constituting output data are arranged in one horizontal row and arranged in a plurality of rows in a predetermined area.
  • a tiled format is a rectangular area, which is a rectangular area, arranged in a matrix in a predetermined area, and in each square area, numerical values (components) constituting output data are 1 horizontal. It means a form arranged in columns and arranged in multiple rows.
  • the input data is arranged in the external memory 20. That is, the input data may be arranged in a raster-like format in the external memory 20 or may be arranged in a tile-like format.
  • the output unit 50 when the output unit 50 arranges output data and input data in the external memory 20 in a tiled form, the output unit 50 is accessed when calculating a matrix product as compared with a case of arranging in a raster form.
  • the vertical efficiency can be improved and power consumption can be suppressed.
  • FIG. 5 is a flowchart showing an outline of the operation of the arithmetic system 1 according to the embodiment.
  • FIG. 6 is a flowchart showing details of the operation in step S3 shown in FIG.
  • FIG. 7 is a flowchart showing details of the operation in step S6 shown in FIG.
  • the computing system 1 determines whether or not the input data is less than or equal to a predetermined data amount (S1). More specifically, the arithmetic system 1 determines whether or not the input data input to the convolution layer is equal to or less than a predetermined data amount for each convolution layer to be subject to arithmetic processing.
  • step S1 when the input data is equal to or less than the predetermined data amount (Yes in S1), the calculation system 1 selects the first calculation mode (S2), and the weight data and the input data are selected in the first calculation mode.
  • a convolution operation is executed (S3). More specifically, when the operation system 1 determines in step S1 that the input data is less than or equal to the predetermined data amount, the operation system 1 selects the first operation mode and executes the convolution operation in the first operation mode. To do.
  • a more detailed description will be given with reference to FIG.
  • step S3 the arithmetic system 1 first places the weight data of the convolutional layer to be subject to arithmetic processing in the external memory 20 (S31).
  • the arithmetic system 1 places the input data to the convolution layer to be subject to arithmetic processing in the internal memory 12 (S32).
  • the arithmetic system 1 reads a part of the weight data from the external memory 20 to the internal memory 12 as row or column vector data (S33). In the present embodiment, the arithmetic system 1 reads a part of the weight data from the external memory 20 to the internal memory 12 as row vector data.
  • the arithmetic system 1 calculates a matrix product of the row or column vector data arranged in the internal memory 12 and a matrix of input data (S34).
  • the calculation system 1 calculates a matrix product of the row vector data arranged in the internal memory 12 and a matrix of input data obtained by converting the input data into a matrix format by sampling.
  • the arithmetic system 1 determines whether or not the matrix product with the matrix of input data has been calculated for all the weight data arranged in the external memory 20 (S35). In step S35, when all the weight data have been calculated (Yes in S35), the calculation system 1 ends the process of step S3.
  • step S35 when the calculation has not been completed for all the weight data (No in S35), the calculation system 1 returns to step S33.
  • step S33 a part of the weight data different from the part of the weight data read earlier is read from the external memory 20 to the internal memory 12 as row or column vector data, and the process of step S34 is performed.
  • Step S1 when the input data is larger than the predetermined data amount in Step S1 (No in S1), the calculation system 1 selects the second calculation mode (S5), and inputs the weight data in the second calculation mode. A convolution operation with data is executed (S6). More specifically, when it is determined in step S1 that the input data is larger than the predetermined data amount, the arithmetic system 1 selects the second arithmetic mode and executes the convolution operation in the second arithmetic mode. .
  • step S6 the arithmetic system 1 first places the input data to the convolution layer to be subject to arithmetic processing in the external memory 20 (S61).
  • the arithmetic system 1 places the convolutional layer weight data to be subject to arithmetic processing in the internal memory 12 (S62).
  • the arithmetic system 1 reads a part of the input data from the external memory 20 to the internal memory 12 as column or row vector data (S63). In the present embodiment, the arithmetic system 1 reads a part of input data from the external memory 20 to the internal memory 12 as column vector data.
  • the calculation system 1 calculates a matrix product of the matrix of weight data arranged in the internal memory 12 and the column or row vector data arranged in the internal memory 12 (S64).
  • the computing system 1 includes a matrix of weight data arranged in the internal memory 12, and column vector data obtained by performing data conversion so that the column vector data is matched with the number of row components of the matrix of weight data by sampling. The matrix product of is calculated.
  • the arithmetic system 1 determines whether or not the matrix product with the matrix of weight data has been calculated for all the input data arranged in the external memory 20 (S65). In step S65, when calculation has been performed on all of the input data (Yes in S65), the calculation system 1 ends the process of step S6.
  • step S65 if not all of the input data has been calculated (No in S65), the calculation system 1 returns to step S63.
  • step S63 a part of the input data different from the part of the input data read out from the external memory 20 is read out as column or row vector data to the internal memory 12, and the process in step S64 is performed.
  • the arithmetic system 1 When the processing of step S3 or step S6 is completed, the arithmetic system 1 outputs output data (S7). More specifically, the arithmetic system 1 outputs the output data obtained by executing the convolution operation in the convolution layer to be processed to the internal memory 12 or the external memory 20 in the subsequent layer of the convolution layer. Place as input data to.
  • [Effects] 8 and 9 are diagrams for explaining the effect of the calculation method in the first calculation mode according to the embodiment.
  • FIG. 10 is a diagram for explaining the effect of the calculation method in the second calculation mode according to the embodiment.
  • the same elements are denoted by the same reference numerals.
  • the input data and the weight data access method are reversed by switching the control depending on whether or not the input data to the convolutional layer to be calculated fits in the internal memory 12.
  • control is performed to execute the convolution calculation in the first calculation mode.
  • control is performed to execute the convolution operation in the second arithmetic mode.
  • the input data arranged in the internal memory 12 is read out and used while looping the whole number of times.
  • the weight data arranged in the external memory 20 is stored partly in the buffer of the internal memory 12 so that the whole is read from the external memory 20 only once, and the buffer is used while looping many times. It will be. 8 and 9, when the entire input data is repeatedly read from the internal memory 12, the read input data is converted into a matrix format by sampling and supplied to the product-sum operation unit 111. This is for calculating a matrix product with a part of the weight data stored in the buffer of the internal memory 12.
  • a part of the weight data is stored as one or more row vector data in the buffer of the internal memory 12, and the matrix product is calculated.
  • the output data is stored in the internal memory 12 while being generated in the horizontal direction. If the output data does not fit in the internal memory 12, it may be output to the external memory 20 as shown in FIG.
  • the input data since the input data does not fit in the internal memory 12, the input data is arranged in the external memory 20, and all the weight data is stored in the internal memory 12. Deploy. This is because all the input data and all the weight data cannot be placed in the internal memory 12 at the same time. Then, part of the input data is read from the external memory 20 and stored in a buffer which is a partial area of the internal memory 12, and is repeatedly supplied from this buffer to the product-sum operation unit 111. The entire weight data is repeatedly read from the internal memory 12 and supplied to the product-sum operation unit 111. In this way, the entire input data is read from the external memory 20 only once.
  • the weight data arranged in the internal memory 12 is read and used while looping over the whole number of times.
  • the input data arranged in the external memory 20 is partly stored in the buffer of the internal memory 12 so that the whole is read from the external memory 20 only once, and the buffer is used while looping many times. It will be.
  • a part of the input data is stored as one or more column vector data in the buffer of the internal memory 12, and the matrix product is calculated.
  • Data is stored in the internal memory 12 while being generated in the vertical direction. If the output data does not fit in the internal memory 12, it may be output to the external memory 20.
  • the convolution operation can be performed with the limited internal memory 12 without restricting the sizes of the input data and the output data. You can go down.
  • a convolution calculation can be performed while suppressing power consumption even with an internal memory having a limited capacity of, for example, several megabytes or less.
  • the arithmetic system 1 of the present modification cannot place all of the weight data in the internal memory 12 in the second arithmetic mode, as compared with the arithmetic system 1 of the above embodiment. Thereby, the detailed operation of the second calculation mode of the control unit 40 is different. Others are the same as in the above embodiment.
  • control unit 40 selects the second calculation mode when the determination unit 30 determines that the input data is larger than the predetermined data amount, and selects the second calculation mode. Perform a convolution operation in operation mode.
  • control unit 40 first places the input data and weight data of the convolution layer in the external memory 20 outside the circuit 10.
  • control unit 40 places a part of the weight data from the external memory 20 in the internal memory 12 as first vector data that is one or more row or column vector data. Then, the control unit 40 reads the input data from the external memory 20 part by part as one or more column or row vector data to the internal memory 12, and a matrix with the first vector data arranged in the internal memory 12 A product-sum operation unit 111 is caused to perform a product operation.
  • control unit 40 arranges a part of the weight data different from the part of the weight data from the external memory 20 in the internal memory 12 as second vector data that is one or more row or column vector data. Subsequently, the control unit 40 reads the input data from the external memory 20 part by part as one or more column or row vector data to the internal memory 12, and the second vector data arranged in the internal memory 12 is read. Matrix product calculation is performed by the product-sum calculation unit 111.
  • the present invention is not limited to the case where all of the weight data is temporarily placed in the external memory 20.
  • a part of the weight data may be arranged in the internal memory 12 and the rest of the weight data may be arranged in the external memory 20.
  • the size (capacity) of a part of the weight data may be a maximum size that can be stored in the internal memory 12.
  • control unit 40 can perform the above matrix product operation on all of the weight data by reading the weight data as a whole from the external memory 20 to the internal memory 12 only once. .
  • step S6 in FIG. 5 The details of step S6 in FIG. 5 are different in the calculation system 1 of the present modification compared to the calculation system 1 of the above embodiment.
  • step S6 according to the present modification will be described with reference to FIG.
  • FIG. 11 is a flowchart showing details of the operation in step S6 according to the modification.
  • step S6 the arithmetic system 1 according to the present modification first arranges input data and weight data for the convolution layer to be subject to arithmetic processing in the external memory 20 (S601).
  • the arithmetic system 1 reads a part of the weight data from the external memory 20 to the internal memory 12 as one or more row vector data (S602).
  • the arithmetic system 1 reads a part of the input data from the external memory 20 to the internal memory 12 as one or more column vector data (S603).
  • the arithmetic system 1 includes the row vector data that is part of the weight data read to the internal memory 12 and the column vector data that is part of the input data read to the internal memory 12.
  • a matrix product is calculated (S604).
  • the arithmetic system 1 is a matrix of the row vector data read to the internal memory 12 and the column vector data obtained by performing data conversion so that the column vector data matches the number of row components of the row vector data by sampling. Calculate the product.
  • the calculation system 1 has already calculated the matrix product with all the input data arranged in the external memory 20 for the row vector data that is part of the weight data read to the internal memory 12. Whether or not (S605).
  • step S605 When the calculation has not been completed in step S605 (No in S605), the calculation system 1 according to the present modification returns to step S603, and receives a part of the input data different from the part of the input data from one or more column vectors Data is read into the internal memory 12 as data. Then, the process of step S604 is performed.
  • step S605 determines whether the matrix product has been calculated with all the weight data arranged in the external memory 20 (S606).
  • step S606 When the calculation has not been completed in step S606 (No in S606), the calculation system 1 according to the present modification returns to step S602, and transfers a part of the weight data different from the part from the external memory 20 to one or more row vectors. Data is read into the internal memory 12 as data. And the process after step S603 is performed.
  • step S606 the calculation system 1 according to the present modification ends the process of step S6.
  • the calculation system 1 reads the weight data as a whole from the external memory 20 to the internal memory 12 only once, and executes the convolution calculation in the second calculation mode.
  • the input data may be read out from the external memory 20 to the internal memory 12 as a whole, and the convolution operation in the second operation mode may be executed.
  • a part of the input data may be read as column vector data in step S602
  • a part of the weight data may be read as row vector data in step S603.
  • step S605 it is determined whether or not the calculation has been performed for all the weight data with respect to the column vector data.
  • FIG. 12 is a diagram for explaining the effect of the calculation method in the second calculation mode according to the modification. Elements similar to those in FIG. 10 are denoted by the same reference numerals.
  • the input data does not fit in the internal memory 12, so the input data is arranged in the external memory 20.
  • a part of the weight data is arranged in the internal memory 12 and the rest is arranged in the external memory 20. Therefore, a part of the input data is read from the external memory 20 and stored in a buffer which is a partial area of the internal memory 12, and is repeatedly supplied from this buffer to the product-sum operation unit 111. Similarly, part of the weight data is repeatedly read from the internal memory 12 and supplied to the product-sum operation unit 111. In this way, the entire input data or the entire weight data can be read from the external memory 20 only once.
  • the weight data arranged across the internal memory 12 and the external memory 20 may be read and used while looping the whole number of times.
  • the input data arranged in the external memory 20 is stored partly in the buffer of the internal memory 12 so that the whole is read from the external memory 20 only once, while looping the buffer many times. Will be used.
  • the entire input data arranged across the internal memory 12 and the external memory 20 may be read and used while looping many times.
  • the weight data arranged in the external memory 20 is stored partly in the buffer of the internal memory 12 so that the whole is read from the external memory 20 only once, and the buffer is looped many times. Will be used.
  • a part of the input data is stored as one or more column vector data in the buffer of the internal memory 12, and the matrix product is calculated. While being generated in the vertical direction, it is stored in the internal memory 12. If the output data does not fit in the internal memory 12, it may be output to the external memory 20.
  • the internal memory 12 has a limited capacity, the number of times of reading input data or weight data from the external memory with high power consumption can be minimized, so that the convolution operation is performed while further reducing power consumption. It can be performed.
  • a part of the components constituting the arithmetic system may be a computer system including a microprocessor, a ROM, a RAM, a hard disk unit, a display unit, a keyboard, a mouse, and the like.
  • a computer program is stored in the RAM or hard disk unit.
  • the microprocessor achieves its functions by operating according to the computer program.
  • the computer program is configured by combining a plurality of instruction codes indicating instructions for the computer in order to achieve a predetermined function.
  • a part of the constituent elements constituting the above-described arithmetic system may be configured by a single system LSI (Large Scale Integration).
  • the system LSI is an ultra-multifunctional LSI manufactured by integrating a plurality of components on a single chip, and specifically, a computer system including a microprocessor, ROM, RAM, and the like. .
  • a computer program is stored in the RAM.
  • the system LSI achieves its functions by the microprocessor operating according to the computer program.
  • a part of the constituent elements constituting the above-described arithmetic system may be constituted by an IC card that can be attached to and detached from each device or a single module.
  • the IC card or the module is a computer system including a microprocessor, a ROM, a RAM, and the like.
  • the IC card or the module may include the super multifunctional LSI described above.
  • the IC card or the module achieves its function by the microprocessor operating according to the computer program. This IC card or this module may have tamper resistance.
  • some of the constituent elements constituting the above-described arithmetic system include a computer-readable recording medium such as a flexible disk, a hard disk, a CD-ROM, an MO, a DVD, and the like. It may be recorded on a DVD-ROM, DVD-RAM, BD (Blu-ray (registered trademark) Disc), semiconductor memory, or the like. The digital signal may be recorded on these recording media.
  • a computer-readable recording medium such as a flexible disk, a hard disk, a CD-ROM, an MO, a DVD, and the like. It may be recorded on a DVD-ROM, DVD-RAM, BD (Blu-ray (registered trademark) Disc), semiconductor memory, or the like.
  • the digital signal may be recorded on these recording media.
  • some of the components constituting the arithmetic system transmit the computer program or the digital signal via an electric communication line, a wireless or wired communication line, a network represented by the Internet, a data broadcast, or the like. It is good also as what to do.
  • the present disclosure may be the method described above. Further, the present invention may be a computer program that realizes these methods by a computer, or may be a digital signal composed of the computer program.
  • the present disclosure may be a computer system including a microprocessor and a memory, the memory storing the computer program, and the microprocessor operating according to the computer program. .
  • the present disclosure can be used for a calculation method, and in particular, a method for processing a convolution calculation of a convolution layer of a large-scale convolutional neural network that performs image recognition with low power consumption and a calculation method used as a circuit technique.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Algebra (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Biomedical Technology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Complex Calculations (AREA)

Abstract

ニューラルネットワークの畳み込み層における畳み込み演算を行列積演算により行う演算方法であって、畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるかを判定する判定ステップ(S1)と、入力データが所定のデータ量以下であると判定された場合(S1でYes)、第1の演算モードを選択して、第1の演算モードで畳み込み演算を実行するステップと(S2、S3)、入力データが所定のデータ量より大きい場合(S1でNo)、第2の演算モードを選択して、第2の演算モードで畳み込み演算を実行するステップ(S5、S6)と、畳み込み演算を実行することにより得られた結果である出力データを出力する出力ステップ(S7)とを含む演算方法。

Description

演算方法
 本開示は、演算方法に関し、特に、畳み込みニューラルネットワークの畳み込み層における畳み込み演算を行う演算方法に関する。
 近年、局所領域の畳み込み(Convolution)を繰り返す多層のニューラルネットワークからなる畳み込みニューラルネットワークを用いて、画像認識を行うことが可能になっている。
 また、多次元データに対して演算処理を行うことができるLSIチップを用いて、畳み込みニューラルネットワークの畳み込み層における畳み込み演算を行うことができることが知られている(例えば、特許文献1)。特許文献1では、LSIチップに内蔵するメモリ回路ブロックのメモリサイズを超える2次元データに対する演算処理を効率的に実行可能な技術が開示されている。
特開2007-206887号公報
 ところで、近年のディープラーニング技術の進展により、畳み込みニューラルネットワークを用いた画像認識の認識率は向上しているものの、ネットワーク規模が巨大化している。このため、畳み込み層の1層あたりの演算処理量も大きくなっている。
 しかしながら、特許文献1では、比較的小規模の畳み込みニューラルネットワークにおける畳み込み演算が演算処理対象となっている。このため、特許文献1に開示される技術では、大規模な畳み込みニューラルネットワークにおける畳み込み演算を行う際、入力データを外部から読み出して用いることになるので消費電力が大きくなってしまうという問題がある。
 換言すると、特許文献1に開示されるようなLSIチップでは、LSIチップの内部に搭載される内部メモリに収まらないサイズの処理結果は外部メモリに出力せざるを得ない。そして、後段の畳み込み層で再び入力データとして内部メモリに読み出して用いる必要があることから、消費電力が大きくなってしまう。一方で、LSIチップにおいて、消費電力を抑制するために、演算処理結果を一時的に保持する内部メモリの容量を大きくすると、コストアップにつながってしまうという問題もある。
 本開示は、上述の事情を鑑みてなされたもので、例えば数Mバイト以下といった限られた容量の内部メモリであっても、消費電力をより抑制しながら畳み込み演算を行うことができる演算方法を提供することを目的とする。
 本開示の一形態に係る演算方法は、LSIが内部に有する演算器と内部メモリとを用いて、ニューラルネットワークの畳み込み層における畳み込み演算を行列積演算により行う演算方法であって、畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する判定ステップと、前記判定ステップにおいて、前記入力データが所定のデータ量以下であると判定された場合、第1の演算モードを選択して、前記第1の演算モードで畳み込み演算を実行するステップと、前記判定ステップにおいて、前記入力データが所定のデータ量より大きいと判定された場合、第2の演算モードを選択して、前記第2の演算モードで畳み込み演算を実行するステップと、畳み込み演算を実行することにより得られた結果である出力データを出力する出力ステップとを含み、前記第1の演算モードで畳み込み演算を実行するステップでは、当該畳み込み層の重みデータを、前記LSIの外部にある外部メモリに配置するステップと、当該畳み込み層の前記入力データを前記内部メモリに配置するステップと、前記外部メモリから、前記重みデータを、一部ずつ、1以上の行または列ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記入力データの行列との行列積演算を前記演算器に行わせるステップとを含み、前記重みデータは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出され、前記第2の演算モードで畳み込み演算を実行するステップでは、当該畳み込み層の入力データを、前記LSIの外部にある外部メモリに配置するステップと、当該畳み込み層の重みデータの行列を前記内部メモリに配置するステップと、前記外部メモリから、前記入力データを、一部ずつ、1以上の列または行ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記重みデータの行列との行列積演算を前記演算器に行わせるステップとを含み、前記入力データは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出される。
 これにより、限られた容量の内部メモリであっても、消費電力をより抑制しながら畳み込み演算を行うことができる。
 ここで、例えば、前記出力ステップでは、前記出力データを、前記内部メモリまたは前記外部メモリに、当該畳み込み層の後段の層における入力データとして配置することで、前記出力データを出力するとしてもよい。
 また、例えば、前記後段の層は、畳み込み層、プーリング層、または、正規化層であるとしてもよい。
 また、例えば、前記第1の演算モードで畳み込み演算を実行するステップでは、前記内部メモリに配置された前記入力データを、サンプリングすることで前記入力データの行列に変換するステップを含み、前記第2の演算モードで畳み込み演算を実行するステップでは、前記内部メモリに読み出した前記入力データの一部を、サンプリングすることで、前記1以上の列または行ベクトルデータに変換するステップを含むとしてもよい。
 また、例えば、前記第2の演算モードで畳み込み演算を実行するステップでは、前記入力データは、前記外部メモリにタイル状の形式で配置されるとしてもよい。
 また、例えば、前記出力ステップでは、前記出力データが前記外部メモリに配置される場合、前記出力データは、前記外部メモリにタイル状の形式で配置されるとしてもよい。
 また、本開示の一形態に係る演算方法は、LSIが内部に有する演算器と内部メモリとを用いて、ニューラルネットワークの畳み込み層における畳み込み演算を行列積演算により行う演算方法であって、畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する判定ステップと、前記判定ステップにおいて、前記入力データが所定のデータ量以下であると判定された場合、第1の演算モードを選択して、前記第1の演算モードで畳み込み演算を実行するステップと、前記判定ステップにおいて、前記入力データが所定のデータ量より大きいと判定された場合、第2の演算モードを選択して、前記第2の演算モードで畳み込み演算を実行するステップと、畳み込み演算を実行することにより得られた結果である出力データを出力する出力ステップとを含み、前記第1の演算モードで畳み込み演算を実行するステップでは、当該畳み込み層の重みデータを、前記LSIの外部にある外部メモリに配置するステップと、当該畳み込み層の前記入力データを前記内部メモリに配置するステップと、前記外部メモリから、前記重みデータを、一部ずつ、1以上の行または列ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記入力データの行列との行列積演算を前記演算器に行わせるステップとを含み、前記重みデータは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出され、第2の演算モードで畳み込み演算を実行するステップでは、当該畳み込み層の入力データ及び重みデータを、前記LSIの外部にある外部メモリに配置するステップと、前記外部メモリから、前記重みデータの一部を、1以上の行または列ベクトルデータである第1ベクトルデータとして前記内部メモリに配置するステップと、前記外部メモリから、前記入力データを、一部ずつ、1以上の列または行ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記第1ベクトルデータとの行列積演算を前記演算器に行わせるステップと、前記外部メモリから、前記重みデータの一部と異なる一部を、1以上の行または列ベクトルデータである第2ベクトルデータとして前記内部メモリに配置するステップと、前記外部メモリから、前記入力データを、一部ずつ、1以上の列または行ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記第2ベクトルデータとの行列積演算を前記演算器に行わせるステップとを含み、前記重みデータは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出される。
 なお、これらの包括的または具体的な態様は、システム、方法、集積回路、コンピュータプログラムまたはコンピュータで読み取り可能なCD-ROMなどの記録媒体で実現されてもよく、システム、方法、集積回路、コンピュータプログラム及び記録媒体の任意な組み合わせで実現されてもよい。
 本開示の演算方法によれば、限られた容量の内部メモリであっても、消費電力をより抑制しながら畳み込み演算を行うことができる。
図1は、実施の形態に係る演算システムの構成の一例を示すブロック図である。 図2は、実施の形態に係る畳み込みニューラルネットの構成の一例を示す図である。 図3Aは、行列積演算により畳み込み演算を行う方法の説明図である。 図3Bは、行列積演算により畳み込み演算を行う方法の説明図である。 図4Aは、実施の形態に係る外部メモリにおける出力データの配置方法を示す図である。 図4Bは、実施の形態に係る外部メモリにおける出力データの配置方法を示す図である。 図5は、実施の形態に係る演算システムの動作概要を示すフローチャートである。 図6は、図5に示すステップS3の動作詳細を示すフローチャートである。 図7は、図5に示すステップS6の動作詳細を示すフローチャートである。 図8は、実施の形態に係る第1の演算モードでの演算方法の効果を説明するための図である。 図9は、実施の形態に係る第1の演算モードでの演算方法の効果を説明するための図である。 図10は、実施の形態に係る第2の演算モードでの演算方法の効果を説明するための図である。 図11は、変形例に係るステップS6の動作詳細を示すフローチャートである。 図12は、変形例に係る第2の演算モードでの演算方法の効果を説明するための図である。
 以下、本開示の実施の形態について、図面を用いて詳細に説明する。なお、以下で説明する実施の形態は、いずれも本開示の一具体例を示すものである。以下の実施の形態で示される数値、形状、材料、構成要素、構成要素の配置位置及び接続形態、使用手順、通信手順等は、一例であり、本開示を限定する主旨ではない。また、以下の実施の形態における構成要素のうち、本開示の最上位概念を示す独立請求項に記載されていない構成要素については、任意の構成要素として説明される。また、各図は、必ずしも厳密に図示したものではない。各図において、実質的に同一の構成については同一の符号を付し、重複する説明は省略または簡略化する。
 (実施の形態)
 以下では、図面を参照しながら、実施の形態に係る演算方法等の説明を行う。
 [システムの構成]
 図1は、実施の形態に係る演算システム1の構成の一例を示すブロック図である。
 図1に示す演算システム1は、回路10と、外部メモリ20と、判定部30と、制御部40と、出力部50とを備える。図2は、実施の形態に係る畳み込みニューラルネットワーク60の構成の一例を示す図である。
 [外部メモリ20]
 外部メモリ20は、回路10の外部にあり、例えばEEPROM、フラッシュメモリ等の不揮発メモリ、ハードディスク、または、電池つきRAMなどによって構成される。本実施の形態では、外部メモリ20には、制御部40が選択する第1の演算モードまたは第2の演算モードに応じて、例えば畳み込みニューラルネットワーク60の演算処理対象の畳み込み層における重みデータ、または、入力データが配置される。また、外部メモリ20には、回路10に畳み込み演算を行わせることにより得られた出力データが配置されてもよい。
 ここで、図2を用いて、畳み込みニューラルネットワーク60の構成の一例について説明する。図2では、畳み込みニューラルネットワークを、CNN(Convolutional Neural Network)と表記している。
 [畳み込みニューラルネットワーク60]
 畳み込みニューラルネットワーク60は、畳み込み層(Conv)とプーリング層(Pooling Layer)と正規化層(Normalize Layer)とを繰り返す多層のニューラルネットワークである。図2に示す例では、畳み込みニューラルネットワーク60は、2つ目のプーリング層の後段に異なる3つの畳み込み層が接続されている。
 本実施の形態では、例えば畳み込みニューラルネットワーク60を構成する複数の畳み込み層における畳み込み演算を回路10に行わせる。
 [回路10]
 回路10は、例えばLSIまたはLSIチップで構成され、例えば畳み込みニューラルネットワーク60の畳み込み層における畳み込み演算を行列積演算により行う。回路10は、図1に示すように、内部に、演算器11と、内部メモリ12とを有する。
 <内部メモリ12>
 内部メモリ12は、比較的小さい容量からなり、例えばRAMなどによって構成される。ここで、比較的小さい容量の一例としては、数百kバイト~数Mバイト以下の容量が考えられる。本実施の形態では、内部メモリ12は、後述する制御部40により制御される。内部メモリ12は、制御部40が選択する第1の演算モードまたは第2の演算モードに応じて、例えば畳み込みニューラルネットワーク60の演算処理対象の畳み込み層における重みデータの一部ずつ、または、当該重みデータが配置される。また、内部メモリ12は、制御部40が選択する第1の演算モードまたは第2の演算モードに応じて、例えば畳み込みニューラルネットワーク60の演算処理対象の畳み込み層の入力データの一部ずつまたは、当該入力データが配置される。
 なお、内部メモリ12は、回路10に畳み込み演算を行わせることにより得られた出力データが配置されてもよい。
 <演算器11>
 演算器11は、後述する制御部40により制御される。演算器11は、図1に示すように積和演算部111と、データ変換部112とを有する。
 ≪積和演算部111≫
 積和演算部111は、制御部40により制御され、畳み込み演算を行列積演算により行う。
 ここで、図3A及び図3Bを用いて、畳み込み演算を行列積演算により行う方法について説明する。図3A及び図3Bは、実施の形態に係る行列積演算により畳み込み演算を行う方法の説明図である。
 重みデータと入力データとの畳み込み演算を行うことは、重みデータと入力データとの行列積を演算することに相当することが知られている。ここで、例えば図3Aに示すように、重みデータがCo×K行列で表され、入力データがCi×L行列で表されるとする。この場合、例えばサンプリングなどのデータ変換を入力データに行い、K×N行列で表される変換後の入力データを用いて、重みデータとの行列積を演算する。p×q行列とr×s行列の積(行列積)はq=rのときのみ定義されるからである。そして、その結果は、p×s行列になることから、重みデータと変換後の入力データの行列積の結果である出力データは、Co×N行列で表されることになる。
 重みデータと入力データとの行列積のより具体的な方法は、例えば図3Bに示されている。すなわち、重みデータの1行目の成分と変換後の入力データの1列目の成分の積和が出力データの1行1列目の成分となり、重みデータの1行目の成分と変換後の入力データの2列目の成分の積和が出力データの1行2列目の成分となる。このように、重みデータのa行目の成分と変換後の入力データのb列目の成分の積和が出力データのa行b列目の成分となるようにして行列積が演算される。
 なお、行列積演算により畳み込み演算を行う場合、出力データの各要素にはバイアスデータをさらに加える場合もある。
 また、図3A及び図3Bでは、重みデータの行列と変換後の入力データの行列との行列積をこの順で演算するとして説明したが、これに限らない。変換後の入力データの行列と重みデータの行列との行列積をこの順で演算するとしてよい。この場合には、変換後の入力データの1行の成分数が、重みデータの行列の1列の成分数と同一となるように入力データをサンプリングしてデータ変換すればよい。
 本実施の形態では、積和演算部111は、第1の演算モードが選択された場合、外部メモリ20から、一部ずつ、1以上の行または列ベクトルデータとして内部メモリ12に読み出された重みデータと、内部メモリ12に配置された入力データの行列との行列積演算を行う。積和演算部111は、第2の演算モードが選択された場合、内部メモリ12に配置された重みデータの行列と、外部メモリ20から、一部ずつ、1以上の列または行ベクトルデータとして内部メモリ12に読み出された入力データとの行列積演算を行う。
 ≪データ変換部112≫
 データ変換部112は、制御部40により制御され、内部メモリ12に読み出された一部の入力データまたは内部メモリ12に配置された入力データを、サンプリングによりデータ変換する。これにより、データ変換された入力データは、重みデータの行列と行列積演算することができる。
 本実施の形態では、データ変換部112は、第1の演算モードが選択された場合、内部メモリ12に配置された入力データを、サンプリングすることで入力データの行列に変換する。また、データ変換部112は、第2の演算モードが選択された場合、内部メモリ12に読み出した入力データの一部を、サンプリングすることで、1以上の列または行ベクトルデータに変換する。
 [判定部30]
 判定部30は、図示しないCPU(Central Processing Unit)と、メモリとなどにより実現される。判定部30は、畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する。ここで、所定のデータ量は、例えば内部メモリ12のうち入力データに割り当てられる最大の容量(サイズ)である。
 本実施の形態では、判定部30は、例えば図2に示す畳み込みニューラルネットワーク60の演算処理対象となる畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する。なお、図2に示すように、同一レイヤの後段に複数の畳み込み層が接続される場合には、判定部30は、各々の畳み込み層ごとに入力される入力データが所定のデータ量以下であるか否かを判定すればよい。
 [制御部40]
 制御部40は、図示しないCPUと、メモリとなどにより実現される。制御部40は、判定部30により入力データが所定のデータ量以下であると判定された場合、第1の演算モードを選択して、第1の演算モードで畳み込み演算を実行する。より詳細には、制御部40は、第1の演算モードを選択した場合、当該畳み込み層の重みデータを、回路10の外部にある外部メモリ20に配置し、当該畳み込み層の入力データを内部メモリ12に配置する。そして、制御部40は、外部メモリ20から、重みデータを、一部ずつ、1以上の行または列ベクトルデータとして内部メモリ12に読み出して、内部メモリ12に配置された入力データの行列との行列積演算を積和演算部111に行わせる。これにより、重みデータは、全体として、外部メモリ20から内部メモリ12に一度だけ読み出されることになる。
 一方、制御部40は、判定部30により入力データが所定のデータ量より大きいと判定された場合、第2の演算モードを選択して、第2の演算モードで畳み込み演算を実行する。より詳細には、制御部40は、第2の演算モードを選択した場合、当該畳み込み層の入力データを、回路10の外部にある外部メモリ20に配置し、当該畳み込み層の重みデータの行列を内部メモリ12に配置する。そして、制御部40は、外部メモリ20から、入力データを、一部ずつ、1以上の列または行ベクトルデータとして内部メモリ12に読み出して、内部メモリ12に配置された重みデータの行列との行列積演算を積和演算部111に行わせる。これにより、入力データは、全体として、外部メモリ20から内部メモリ12に一度だけ読み出されることになる。
 [出力部50]
 出力部50は、畳み込み演算を実行することにより得られた結果である出力データを出力する。本実施の形態では、出力部50は、当該出力データを、内部メモリ12または外部メモリ20に、当該畳み込み層の後段の層における入力データとして配置することで、出力データを出力してもよい。ここで、後段の層は、畳み込みニューラルネットワークにおける畳み込み層、プーリング層、または、正規化層である。
 図4A及び図4Bは、実施の形態に係る外部メモリ20における出力データの配置方法を示す図である。
 出力部50は、外部メモリ20に出力データを出力する場合には、図4Aに示すラスター状の形式で配置してもよいが、タイル状の形式で配置してもよい。ここで、ラスター状の形式とは、所定の領域において、出力データを構成する数値(成分)が、横1列に並べられ、かつ複数の行に並べるように配置された形式を意味する。また、タイル状の形式とは、所定の領域において、四角い形をした領域である四角領域が行列状に並べられ、個々の四角領域内では、出力データを構成する数値(成分)が、横1列に並べられ、かつ複数の行に並べるように配置された形式を意味する。
 なお、外部メモリ20に入力データを配置する場合も同様のことが言える。すなわち、外部メモリ20には、入力データがラスター状の形式で配置されてもよいし、タイル状の形式で配置されてもよい。
 また、出力部50が、外部メモリ20に出力データ及び入力データをタイル状の形式で配置する場合には、ラスター状の形式で配置する場合と比較して、行列積を演算する際にアクセスされる縦方向の効率が向上し、消費電力を抑制することができる。
 [演算システム1の動作]
 以上のように構成された演算システム1の動作について説明する。
 図5は、実施の形態に係る演算システム1の動作概要を示すフローチャートである。図6は、図5に示すステップS3の動作詳細を示すフローチャートである。図7は、図5に示すステップS6の動作詳細を示すフローチャートである。
 まず、演算システム1は、入力データが所定のデータ量以下であるか否かを判定する(S1)。より具体的には、演算システム1は、演算処理対象となる畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する。
 ステップS1において、入力データが所定のデータ量以下である場合(S1でYes)、演算システム1は、第1の演算モードを選択し(S2)、第1の演算モードで、重みデータと入力データとの畳み込み演算を実行する(S3)。より具体的には、演算システム1は、ステップS1において、入力データが所定のデータ量以下であると判定し場合、第1の演算モードを選択して、第1の演算モードで畳み込み演算を実行する。ここで、より詳細な説明を図6を用いて行う。
 ステップS3において、図6に示すように、演算システム1は、まず、演算処理対象となる畳み込み層の重みデータを外部メモリ20に配置する(S31)。次いで、演算システム1は、演算処理対象となる畳み込み層への入力データを内部メモリ12に配置する(S32)。次いで、演算システム1は、外部メモリ20から重みデータの一部を、行または列ベクトルデータとして内部メモリ12に読み出す(S33)。本実施の形態では、演算システム1は、外部メモリ20から重みデータの一部を、行ベクトルデータとして内部メモリ12に読み出している。次いで、演算システム1は、内部メモリ12に配置された当該行または列ベクトルデータと、入力データの行列との行列積を演算する(S34)。本実施の形態では、演算システム1は、内部メモリ12に配置された当該行ベクトルデータと、入力データをサンプリングにより行列の形式にデータ変換した入力データの行列との行列積を演算している。次いで、演算システム1は、外部メモリ20に配置した重みデータの全てに対して、入力データの行列との行列積を演算済みか否か判定する(S35)。ステップS35において、重みデータの全てに対して演算済みの場合(S35でYes)、演算システム1は、ステップS3の処理を終了する。一方、ステップS35において、重みデータの全てに対して演算済みでない場合(S35でNo)、演算システム1は、ステップS33に戻る。そして、ステップS33において、外部メモリ20から、先ほど読み出した重みデータの一部と異なる重みデータの一部を、行または列ベクトルデータとして内部メモリ12に読み出し、ステップS34の処理を行う。
 以下図5に戻って説明を続ける。
 一方、ステップS1において、入力データが所定のデータ量より大きい場合(S1でNo)、演算システム1は、第2の演算モードを選択し(S5)、第2の演算モードで、重みデータと入力データとの畳み込み演算を実行する(S6)。より具体的には、演算システム1は、ステップS1において、入力データが所定のデータ量より大きいと判定した場合、第2の演算モードを選択して、第2の演算モードで畳み込み演算を実行する。ここで、より詳細な説明を、図7を用いて行う。
 ステップS6において、図7に示すように、演算システム1は、まず、演算処理対象となる畳み込み層への入力データを外部メモリ20に配置する(S61)。次いで、演算システム1は、演算処理対象となる畳み込み層の重みデータを内部メモリ12に配置する(S62)。次いで、演算システム1は、外部メモリ20から入力データの一部を、列または行ベクトルデータとして内部メモリ12に読み出す(S63)。本実施の形態では、演算システム1は、外部メモリ20から入力データの一部を、列ベクトルデータとして内部メモリ12に読み出している。次いで、演算システム1は、内部メモリ12に配置された重みデータの行列と、内部メモリ12に配置された当該列または行ベクトルデータとの行列積を演算する(S64)。本実施の形態では、演算システム1は、内部メモリ12に配置された重みデータの行列と、当該列ベクトルデータをサンプリングにより重みデータの行列の行成分数に合わせるようにデータ変換した列ベクトルデータとの行列積を演算している。次いで、演算システム1は、外部メモリ20に配置した入力データの全てに対して、重みデータの行列との行列積を演算済みか否か判定する(S65)。ステップS65において、入力データの全てに対して演算済みの場合(S65でYes)、演算システム1は、ステップS6の処理を終了する。一方、ステップS65において、入力データの全てに対して演算済みでない場合(S65でNo)、演算システム1は、ステップS63に戻る。そして、ステップS63において、外部メモリ20から、先ほど読み出した入力データの一部と異なる入力データの一部を、列または行ベクトルデータとして内部メモリ12に読み出し、ステップS64の処理を行う。
 以下図5に戻って説明を続ける。
 ステップS3またはステップS6の処理が終了すると、演算システム1は、出力データを出力する(S7)。より具体的には、演算システム1は、演算処理対象の畳み込み層における畳み込み演算を実行することにより得られた結果である出力データを、内部メモリ12または外部メモリ20に当該畳み込み層の後段の層への入力データとして配置する。
 [効果等]
 図8及び図9は、実施の形態に係る第1の演算モードでの演算方法の効果を説明するための図である。図10は、実施の形態に係る第2の演算モードでの演算方法の効果を説明するための図である。図8~図10において、同様の要素には同一の符号を付している。
 本実施の形態の演算方法によれば、演算処理対象となる畳み込み層への入力データが内部メモリ12に収まる場合と収まらない場合とで、制御を切り替えて入力データと重みデータのアクセス方法を逆にする。すなわち、本実施の形態の演算方法によれば、演算処理対象となる畳み込み層への入力データが内部メモリ12に収まる場合には、第1の演算モードで畳み込み演算を実行する制御を行う。一方、演算処理対象となる畳み込み層への入力データが内部メモリ12に収まらない場合には、第2の演算モードで畳み込み演算を実行する制御を行う。
 ここで、図8に示すように、第1の演算モードでの演算方法では、入力データが内部メモリ12に収まるので、入力データ全部を内部メモリ12に配置し、重みデータを外部メモリ20に配置する。入力データ全部と重みデータ全部とを同時に内部メモリ12に配置することができないからである。そして、入力データ全体を内部メモリ12から繰り返し読み出して積和演算部111に供給する。重みデータを、外部メモリ20から一部読み出して内部メモリ12の一部領域であるバッファに格納し、このバッファから積和演算部111へ繰り返し供給する。このようにして、重みデータ全体は、外部メモリ20から1回だけ読み出されるようにする。換言すれば、内部メモリ12に配置される入力データは全体を何回もループしながら読み出して使われる。一方、外部メモリ20に配置される重みデータは、全体を外部メモリ20から1回だけ読み出すことになるように、一部ずつ内部メモリ12のバッファに格納され、バッファを何回もループしながら使われることになる。なお、図8及び図9では、入力データ全体を内部メモリ12から繰り返し読み出したときに、読み出した入力データをサンプリングにより行列の形式にデータ変換して積和演算部111に供給している。内部メモリ12のバッファに格納された一部の重みデータとの行列積を演算するためである。
 また、図8に示す第1の演算モードでの演算方法では、内部メモリ12のバッファに、重みデータの一部が1以上の行ベクトルデータとして格納されて、行列積が演算されることから、出力データは横方向に生成されながら内部メモリ12に格納されている。なお、出力データが内部メモリ12に収まらない場合には、図9に示すように、外部メモリ20に出力すればよい。
 これにより、限られた容量の内部メモリ12であっても、消費電力の大きい外部メモリからの重みデータの読み出し回数を最小にすることができるので、消費電力をより抑制しながら畳み込み演算を行うことができる。
 また、図10に示すように、第2の演算モードでの演算方法では、入力データが内部メモリ12に収まらないので、入力データを外部メモリ20に配置し、重みデータの全部を内部メモリ12に配置する。入力データ全部と重みデータ全部とを同時に内部メモリ12に配置することができないからである。そして、入力データを、外部メモリ20から一部読み出して内部メモリ12の一部領域であるバッファに格納し、このバッファから積和演算部111へ繰り返し供給する。重みデータ全体を内部メモリ12から繰り返し読み出して積和演算部111に供給する。このようにして、入力データ全体は、外部メモリ20から1回だけ読み出されるようにする。換言すれば、内部メモリ12に配置される重みデータは全体を何回もループしながら読み出して使われる。一方、外部メモリ20に配置される入力データは、全体を外部メモリ20から1回だけ読み出すことになるように、一部ずつ内部メモリ12のバッファに格納され、バッファを何回もループしながら使われることになる。
 また、図10に示す第2の演算モードでの演算方法では、内部メモリ12のバッファに、入力データの一部が1以上の列ベクトルデータとして格納されて、行列積が演算されるので、出力データは縦方向に生成されながら内部メモリ12に格納されている。なお、出力データが内部メモリ12に収まらない場合には、外部メモリ20に出力すればよい。
 これにより、限られた容量の内部メモリ12であっても、消費電力の大きい外部メモリからの入力データの読み出し回数を最小にすることができるので、消費電力をより抑制しながら畳み込み演算を行うことができる。
 このように、入力データ及び出力データのサイズに制約を設けることなく、限られた容量の内部メモリ12で畳み込み演算を行うことができるので、大容量の内部メモリ12を備える場合と比較してコストダウンを図ることができる。
 以上のように本実施の形態の演算方法によれば、例えば数Mバイト以下といった限られた容量の内部メモリであっても、消費電力をより抑制しながら畳み込み演算を行うことができる。
 (変形例)
 上記の実施の形態では、入力データが内部メモリ12に収まらない場合、入力データを外部メモリ20に配置し、重みデータの全部を内部メモリ12に配置するとして説明したが、これに限らない。内部メモリ12の容量(サイズ)によっては、重みデータの全部が配置できない場合も考えられる。以下の変形例では、実施の形態と同じ点は説明を省略し、異なる点を中心に説明する。
 本変形例の演算システム1では、上記の実施の形態の演算システム1と比較して、第2の演算モードにおいて重みデータの全部を内部メモリ12に配置することができないとする。これにより、制御部40の第2の演算モードの詳細動作が異なることになる。その他は、上記の実施の形態と同様である。
 [制御部40]
 本変形例の制御部40は、上記の実施の形態と同様に、判定部30により入力データが所定のデータ量より大きいと判定された場合、第2の演算モードを選択して、第2の演算モードで畳み込み演算を実行する。
 より詳細には、制御部40は、まず、第2の演算モードを選択した場合、当該畳み込み層の入力データ及び重みデータを、回路10外部にある外部メモリ20に配置する。
 次に、制御部40は、外部メモリ20から、重みデータの一部を、1以上の行または列ベクトルデータである第1ベクトルデータとして内部メモリ12に配置する。そして、制御部40は、外部メモリ20から、入力データを、一部ずつ、1以上の列または行ベクトルデータとして内部メモリ12に読み出して、内部メモリ12に配置された第1ベクトルデータとの行列積演算を積和演算部111に行わせる。
 次に、制御部40は、外部メモリ20から、重みデータの当該一部と異なる一部を、1以上の行または列ベクトルデータである第2ベクトルデータとして内部メモリ12に配置する。続いて、制御部40は、外部メモリ20から、入力データを、一部ずつ、1以上の列または行ベクトルデータとして内部メモリ12に読み出して、内部メモリ12に配置された第2ベクトルデータとの行列積演算を積和演算部111に行わせる。
 なお、重みデータの全部を一旦外部メモリ20に配置する場合に限らない。重みデータの一部を内部メモリ12に配置し、重みデータの残りを外部メモリ20に配置してもよい。この場合、重みデータの一部のサイズ(容量)は、内部メモリ12に格納可能な最大限のサイズであればよい。
 これにより、制御部40は、重みデータを、全体として、外部メモリ20から内部メモリ12に一度だけ読み出すようにして、上記のような行列積演算を、重みデータの全てに対して行うことができる。
 [演算システム1の動作]
 以上のように構成された本変形例の演算システム1の動作について説明する。本変形例に係る演算システム1の動作概要は、図5で説明した通りであるので説明を省略する。
 本変形例の演算システム1では、上記の実施の形態の演算システム1と比較して、図5のステップS6の詳細が異なる。以下、図11を用いて、本変形例に係るステップS6について説明する。
 図11は、変形例に係るステップS6の動作詳細を示すフローチャートである。
 ステップS6において、図11に示すように、本変形例に係る演算システム1は、まず、演算処理対象となる畳み込み層への入力データと重みデータとを外部メモリ20に配置する(S601)。
 次いで、本変形例に係る演算システム1は、外部メモリ20から、重みデータの一部を、1以上の行ベクトルデータとして内部メモリ12に読み出す(S602)。
 次いで、本変形例に係る演算システム1は、外部メモリ20から、入力データの一部を、1以上の列ベクトルデータとして内部メモリ12に読み出す(S603)。
 次いで、本変形例に係る演算システム1は、内部メモリ12に読み出した重みデータの一部である当該行ベクトルデータと、内部メモリ12に読み出した入力データの一部である当該列ベクトルデータとの行列積を演算する(S604)。本変形例では、演算システム1は、内部メモリ12に読み出した当該行ベクトルデータと、当該列ベクトルデータをサンプリングにより当該行ベクトルデータの行成分数に合わせるようにデータ変換した列ベクトルデータとの行列積を演算する。
 次いで、本変形例に係る演算システム1は、内部メモリ12に読み出した重みデータの一部である当該行ベクトルデータに対して、外部メモリ20に配置された全ての入力データで行列積を演算済みか否か判定する(S605)。
 ステップS605において演算済みでない場合(S605でNo)、本変形例に係る演算システム1は、ステップS603に戻り、外部メモリ20から、入力データの当該一部と異なる一部を、1以上の列ベクトルデータとして内部メモリ12に読み出す。そして、ステップS604の処理を行う。
 一方、ステップS605において演算済みの場合(S605でYes)、本変形例に係る演算システム1は、外部メモリ20に配置する全ての重みデータで行列積を演算済みか否か判定する(S606)。
 ステップS606において演算済みでない場合(S606でNo)、本変形例に係る演算システム1は、ステップS602に戻り、外部メモリ20から、重みデータの当該一部と異なる一部を、1以上の行ベクトルデータとして内部メモリ12に読み出す。そして、ステップS603以降の処理を行う。
 一方、ステップS606において演算済みの場合(S606でYes)、本変形例に係る演算システム1は、ステップS6の処理を終了する。
 このようにして、本変形例に係る演算システム1は、重みデータを、全体として、外部メモリ20から内部メモリ12に一度だけ読み出して、第2の演算モードでの畳み込み演算を実行する。
 なお、図11を用いて、重みデータを全体として内部メモリ12に一度だけ読み出して、第2の演算モードでの畳み込み演算を実行する場合の処理について説明したが、これに限らない。入力データを、全体として、外部メモリ20から内部メモリ12に一度だけ読み出して、第2の演算モードでの畳み込み演算を実行するとしてもよい。この場合、ステップS602で入力データの一部を列ベクトルデータとして読み出し、ステップS603で重みデータの一部を行ベクトルデータとして読み出せばよい。そして、ステップS605では列ベクトルデータに対して全ての重みデータで演算済みか否かを判定し、ステップS606では全ての入力データに対して演算済みか否かを判定すればよい。
 [効果等]
 図12は、変形例に係る第2の演算モードでの演算方法の効果を説明するための図である。図10と同様の要素には同一の符号を付している。
 図12に示すように、第2の演算モードでの演算方法では、入力データが内部メモリ12に収まらないので、入力データを外部メモリ20に配置する。また、本変形例では、重みデータの全部も内部メモリ12に配置できないので、重みデータの一部を内部メモリ12に配置し、残りを外部メモリ20に配置する。このため、入力データを、外部メモリ20から一部読み出して内部メモリ12の一部領域であるバッファに格納し、このバッファから積和演算部111へ繰り返し供給する。同様に、重みデータの一部を、内部メモリ12から繰り返し読み出して積和演算部111に供給する。このようにして、入力データ全体または重みデータ全体が、外部メモリ20から1回だけ読み出されるようにすることができる。
 例えば、内部メモリ12と外部メモリ20に跨って配置される重みデータは全体を何回もループしながら読み出して使われてもよい。この場合、外部メモリ20に配置される入力データは、全体を外部メモリ20から1回だけ読み出すことになるように、一部ずつ内部メモリ12のバッファに格納され、バッファを何回もループしながら使われることになる。
 また、例えば、上述したように、内部メモリ12と外部メモリ20に跨って配置される入力データの全体を何回もループしながら読み出して使ってもよい。この場合、外部メモリ20に配置される重みデータは、全体を外部メモリ20から1回だけ読み出すことになるように、一部ずつ内部メモリ12のバッファに格納され、バッファを何回もループしながら使われることになる。
 図12に示す第2の演算モードでの演算方法では、内部メモリ12のバッファに、入力データの一部が1以上の列ベクトルデータとして格納されて、行列積が演算されるので、出力データは縦方向に生成されながら内部メモリ12に格納されている。なお、出力データが内部メモリ12に収まらない場合には、外部メモリ20に出力すればよい。
 これにより、限られた容量の内部メモリ12であっても、消費電力の大きい外部メモリからの入力データまたは重みデータの読み出し回数を最小にすることができるので、消費電力をより抑制しながら畳み込み演算を行うことができる。
 [その他の実施の形態等]
 以上、本開示の態様に係る演算方法について、実施の形態に基づいて説明したが、本開示は、この実施の形態に限定されるものではない。例えば、本明細書において記載した構成要素を任意に組み合わせて、また、構成要素のいくつかを除外して実現される別の実施の形態を本開示の実施の形態としてもよい。また、上記実施の形態に対して本開示の主旨、すなわち、請求の範囲に記載される文言が示す意味を逸脱しない範囲で当業者が思いつく各種変形を施して得られる変形例も本開示に含まれる。
 また、以下に示す形態も、本開示の一つまたは複数の態様の範囲内に含まれてもよい。
 (1)上記の演算システムを構成する構成要素の一部は、マイクロプロセッサ、ROM、RAM、ハードディスクユニット、ディスプレイユニット、キーボード、マウスなどから構成されるコンピュータシステムであってもよい。前記RAMまたはハードディスクユニットには、コンピュータプログラムが記憶されている。前記マイクロプロセッサが、前記コンピュータプログラムにしたがって動作することにより、その機能を達成する。ここでコンピュータプログラムは、所定の機能を達成するために、コンピュータに対する指令を示す命令コードが複数個組み合わされて構成されたものである。
 (2)上記の演算システムを構成する構成要素の一部は、1個のシステムLSI(Large Scale Integration:大規模集積回路)から構成されているとしてもよい。システムLSIは、複数の構成部を1個のチップ上に集積して製造された超多機能LSIであり、具体的には、マイクロプロセッサ、ROM、RAMなどを含んで構成されるコンピュータシステムである。前記RAMには、コンピュータプログラムが記憶されている。前記マイクロプロセッサが、前記コンピュータプログラムにしたがって動作することにより、システムLSIは、その機能を達成する。
 (3)上記の演算システムを構成する構成要素の一部は、各装置に脱着可能なICカードまたは単体のモジュールから構成されているとしてもよい。前記ICカードまたは前記モジュールは、マイクロプロセッサ、ROM、RAMなどから構成されるコンピュータシステムである。前記ICカードまたは前記モジュールは、上記の超多機能LSIを含むとしてもよい。マイクロプロセッサが、コンピュータプログラムにしたがって動作することにより、前記ICカードまたは前記モジュールは、その機能を達成する。このICカードまたはこのモジュールは、耐タンパ性を有するとしてもよい。
 (4)また、上記の演算システムを構成する構成要素の一部は、前記コンピュータプログラムまたは前記デジタル信号をコンピュータで読み取り可能な記録媒体、例えば、フレキシブルディスク、ハードディスク、CD-ROM、MO、DVD、DVD-ROM、DVD-RAM、BD(Blu-ray(登録商標) Disc)、半導体メモリなどに記録したものとしてもよい。また、これらの記録媒体に記録されている前記デジタル信号であるとしてもよい。
 また、上記の演算システムを構成する構成要素の一部は、前記コンピュータプログラムまたは前記デジタル信号を、電気通信回線、無線または有線通信回線、インターネットを代表とするネットワーク、データ放送等を経由して伝送するものとしてもよい。
 (5)本開示は、上記に示す方法であるとしてもよい。また、これらの方法をコンピュータにより実現するコンピュータプログラムであるとしてもよいし、前記コンピュータプログラムからなるデジタル信号であるとしてもよい。
 (6)また、本開示は、マイクロプロセッサとメモリを備えたコンピュータシステムであって、前記メモリは、上記コンピュータプログラムを記憶しており、前記マイクロプロセッサは、前記コンピュータプログラムにしたがって動作するとしてもよい。
 (7)また、前記プログラムまたは前記デジタル信号を前記記録媒体に記録して移送することにより、または前記プログラムまたは前記デジタル信号を、前記ネットワーク等を経由して移送することにより、独立した他のコンピュータシステムにより実施するとしてもよい。
 (8)上記実施の形態及び上記変形例をそれぞれ組み合わせるとしてもよい。
 本開示は、演算方法に利用でき、特に、画像認識を行う大規模な畳み込みニューラルネットワークの畳み込み層の畳み込み演算を低消費電力で処理する方法及び回路技術として用いられる演算方法に利用できる。
 1  演算システム
 10  回路
 11  演算器
 12  内部メモリ
 20  外部メモリ
 30  判定部
 40  制御部
 50  出力部
 60  畳み込みニューラルネットワーク
 111  積和演算部
 112  データ変換部

Claims (7)

  1.  LSIが内部に有する演算器と内部メモリとを用いて、ニューラルネットワークの畳み込み層における畳み込み演算を行列積演算により行う演算方法であって、
     畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する判定ステップと、
     前記判定ステップにおいて、前記入力データが所定のデータ量以下であると判定された場合、第1の演算モードを選択して、前記第1の演算モードで畳み込み演算を実行するステップと、
     前記判定ステップにおいて、前記入力データが所定のデータ量より大きいと判定された場合、第2の演算モードを選択して、前記第2の演算モードで畳み込み演算を実行するステップと、
     畳み込み演算を実行することにより得られた結果である出力データを出力する出力ステップとを含み、
     前記第1の演算モードで畳み込み演算を実行するステップでは、
     当該畳み込み層の重みデータを、前記LSIの外部にある外部メモリに配置するステップと、
     当該畳み込み層の前記入力データを前記内部メモリに配置するステップと、
     前記外部メモリから、前記重みデータを、一部ずつ、1以上の行または列ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記入力データの行列との行列積演算を前記演算器に行わせるステップとを含み、
     前記重みデータは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出され、
     前記第2の演算モードで畳み込み演算を実行するステップでは、
     当該畳み込み層の入力データを、前記LSIの外部にある外部メモリに配置するステップと、
     当該畳み込み層の重みデータの行列を前記内部メモリに配置するステップと、
     前記外部メモリから、前記入力データを、一部ずつ、1以上の列または行ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記重みデータの行列との行列積演算を前記演算器に行わせるステップとを含み、
     前記入力データは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出される、
     演算方法。
  2.  前記出力ステップでは、前記出力データを、前記内部メモリまたは前記外部メモリに、当該畳み込み層の後段の層における入力データとして配置することで、前記出力データを出力する、
     請求項1に記載の演算方法。
  3.  前記後段の層は、畳み込み層、プーリング層、または、正規化層である、
     請求項2に記載の演算方法。
  4.  前記第1の演算モードで畳み込み演算を実行するステップでは、
     前記内部メモリに配置された前記入力データを、サンプリングすることで前記入力データの行列に変換するステップを含み、
     前記第2の演算モードで畳み込み演算を実行するステップでは、
     前記内部メモリに読み出した前記入力データの一部を、サンプリングすることで、前記1以上の列または行ベクトルデータに変換するステップを含む、
     請求項1~3のいずれか1項に記載の演算方法。
  5.  前記第2の演算モードで畳み込み演算を実行するステップでは、
     前記入力データは、前記外部メモリにタイル状の形式で配置される、
     請求項1~4のいずれか1項に記載の演算方法。
  6.  前記出力ステップでは、前記出力データが前記外部メモリに配置される場合、前記出力データは、前記外部メモリにタイル状の形式で配置される、
     請求項1~5のいずれか1項に記載の演算方法。
  7.  LSIが内部に有する演算器と内部メモリとを用いて、ニューラルネットワークの畳み込み層における畳み込み演算を行列積演算により行う演算方法であって、
     畳み込み層ごとに、当該畳み込み層に入力される入力データが所定のデータ量以下であるか否かを判定する判定ステップと、
     前記判定ステップにおいて、前記入力データが所定のデータ量以下であると判定された場合、第1の演算モードを選択して、前記第1の演算モードで畳み込み演算を実行するステップと、
     前記判定ステップにおいて、前記入力データが所定のデータ量より大きいと判定された場合、第2の演算モードを選択して、前記第2の演算モードで畳み込み演算を実行するステップと、
     畳み込み演算を実行することにより得られた結果である出力データを出力する出力ステップとを含み、
     前記第1の演算モードで畳み込み演算を実行するステップでは、
     当該畳み込み層の重みデータを、前記LSIの外部にある外部メモリに配置するステップと、
     当該畳み込み層の前記入力データを前記内部メモリに配置するステップと、
     前記外部メモリから、前記重みデータを、一部ずつ、1以上の行または列ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記入力データの行列との行列積演算を前記演算器に行わせるステップとを含み、
     前記重みデータは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出され、
     第2の演算モードで畳み込み演算を実行するステップでは、
     当該畳み込み層の入力データ及び重みデータを、前記LSIの外部にある外部メモリに配置するステップと、
     前記外部メモリから、前記重みデータの一部を、1以上の行または列ベクトルデータである第1ベクトルデータとして前記内部メモリに配置するステップと、
     前記外部メモリから、前記入力データを、一部ずつ、1以上の列または行ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記第1ベクトルデータとの行列積演算を前記演算器に行わせるステップと、
     前記外部メモリから、前記重みデータの一部と異なる一部を、1以上の行または列ベクトルデータである第2ベクトルデータとして前記内部メモリに配置するステップと、
     前記外部メモリから、前記入力データを、一部ずつ、1以上の列または行ベクトルデータとして前記内部メモリに読み出して、前記内部メモリに配置された前記第2ベクトルデータとの行列積演算を前記演算器に行わせるステップとを含み、
     前記重みデータは、全体として、前記外部メモリから前記内部メモリに一度だけ読み出される、
     演算方法。
PCT/JP2018/021371 2018-06-04 2018-06-04 演算方法 WO2019234794A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN201880093914.3A CN112166442B (zh) 2018-06-04 2018-06-04 运算方法
PCT/JP2018/021371 WO2019234794A1 (ja) 2018-06-04 2018-06-04 演算方法
JP2020523858A JP7136204B2 (ja) 2018-06-04 2018-06-04 演算方法
US17/108,833 US11907327B2 (en) 2018-06-04 2020-12-01 Arithmetic method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2018/021371 WO2019234794A1 (ja) 2018-06-04 2018-06-04 演算方法

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/108,833 Continuation US11907327B2 (en) 2018-06-04 2020-12-01 Arithmetic method

Publications (1)

Publication Number Publication Date
WO2019234794A1 true WO2019234794A1 (ja) 2019-12-12

Family

ID=68770177

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2018/021371 WO2019234794A1 (ja) 2018-06-04 2018-06-04 演算方法

Country Status (4)

Country Link
US (1) US11907327B2 (ja)
JP (1) JP7136204B2 (ja)
CN (1) CN112166442B (ja)
WO (1) WO2019234794A1 (ja)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021199569A1 (ja) * 2020-03-31 2021-10-07 パナソニックIpマネジメント株式会社 演算処理システムおよび畳み込み演算方法
JP2021163446A (ja) * 2020-03-31 2021-10-11 パナソニックIpマネジメント株式会社 演算処理システムおよび畳み込み演算方法
WO2022259574A1 (ja) * 2021-06-09 2022-12-15 日本電信電話株式会社 画像処理装置、画像処理方法、及び画像処理プログラム

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11494625B2 (en) * 2018-10-03 2022-11-08 Maxim Integrated Products, Inc. Systems and methods for energy-efficient analog matrix multiplication for machine learning processes
US11657252B2 (en) * 2019-06-07 2023-05-23 Meta Platforms, Inc. Point to point connected processing elements with data joiner components
CN115878957B (zh) * 2022-12-29 2023-08-29 珠海市欧冶半导体有限公司 一种矩阵乘法加速装置及方法

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002269067A (ja) * 2001-12-26 2002-09-20 Matsushita Electric Ind Co Ltd 行列演算装置
JP6250782B1 (ja) * 2016-12-01 2017-12-20 ヴィア アライアンス セミコンダクター カンパニー リミテッド ビクティムキャッシュ又はニューラルネットワークユニットメモリとして動作可能なメモリアレイを有するプロセッサ

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4947983B2 (ja) 2006-01-31 2012-06-06 キヤノン株式会社 演算処理システム
JP6611053B2 (ja) * 2015-09-17 2019-11-27 パナソニックIpマネジメント株式会社 主題推定システム、主題推定方法およびプログラム
KR101644998B1 (ko) * 2015-12-22 2016-08-02 엑스브레인 주식회사 Convolutional Neural Network를 이용하여 비정상 입력 데이터를 검출하는 방법 및 장치
CN106127297B (zh) * 2016-06-02 2019-07-12 中国科学院自动化研究所 基于张量分解的深度卷积神经网络的加速与压缩方法
CN106326985A (zh) * 2016-08-18 2017-01-11 北京旷视科技有限公司 神经网络训练方法和装置及数据处理方法和装置
CN106445471B (zh) * 2016-10-13 2018-06-01 北京百度网讯科技有限公司 处理器和用于在处理器上执行矩阵乘运算的方法
CN106502964B (zh) * 2016-12-06 2019-03-26 中国矿业大学 一种基于Spark的极限学习机并行化计算方法
US10387298B2 (en) * 2017-04-04 2019-08-20 Hailo Technologies Ltd Artificial neural network incorporating emphasis and focus techniques
CN107657314A (zh) * 2017-09-26 2018-02-02 济南浪潮高新科技投资发展有限公司 一种基于区间算法的神经网络卷积层设计方法

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002269067A (ja) * 2001-12-26 2002-09-20 Matsushita Electric Ind Co Ltd 行列演算装置
JP6250782B1 (ja) * 2016-12-01 2017-12-20 ヴィア アライアンス セミコンダクター カンパニー リミテッド ビクティムキャッシュ又はニューラルネットワークユニットメモリとして動作可能なメモリアレイを有するプロセッサ

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021199569A1 (ja) * 2020-03-31 2021-10-07 パナソニックIpマネジメント株式会社 演算処理システムおよび畳み込み演算方法
JP2021163446A (ja) * 2020-03-31 2021-10-11 パナソニックIpマネジメント株式会社 演算処理システムおよび畳み込み演算方法
JP7373751B2 (ja) 2020-03-31 2023-11-06 パナソニックIpマネジメント株式会社 演算処理システムおよび畳み込み演算方法
WO2022259574A1 (ja) * 2021-06-09 2022-12-15 日本電信電話株式会社 画像処理装置、画像処理方法、及び画像処理プログラム

Also Published As

Publication number Publication date
CN112166442B (zh) 2023-08-18
CN112166442A (zh) 2021-01-01
JPWO2019234794A1 (ja) 2021-06-17
US11907327B2 (en) 2024-02-20
JP7136204B2 (ja) 2022-09-13
US20210081489A1 (en) 2021-03-18

Similar Documents

Publication Publication Date Title
WO2019234794A1 (ja) 演算方法
US20220261615A1 (en) Neural network devices and methods of operating the same
US11003985B2 (en) Convolutional neural network system and operation method thereof
KR102642853B1 (ko) 컨볼루션 회로, 그것을 포함하는 어플리케이션 프로세서 및 그것의 동작 방법
KR102335955B1 (ko) 컨볼루션 신경망 시스템 및 그것의 동작 방법
CN108108811B (zh) 神经网络中的卷积计算方法和电子设备
CN110678840B (zh) 张量寄存器文件
CN110678841B (zh) 张量处理器指令集架构
JP6365258B2 (ja) 演算処理装置
US20200285605A1 (en) Systolic array and processing system
KR20170007151A (ko) 인공 신경 네트워크를 실행하는 방법 및 장치
KR102610842B1 (ko) 뉴럴 네트워크에서의 프로세싱 엘리먼트 및 그 동작 방법
CN109993275B (zh) 一种信号处理方法及装置
JP7261226B2 (ja) 演算処理装置
An et al. An ultra-low-power image signal processor for hierarchical image recognition with deep neural networks
Shi et al. Hardware-efficient residual neural network execution in line-buffer depth-first processing
US11182128B2 (en) Multiply-accumulate operation device, multiply-accumulate operation methods, and systems
Wong et al. Low bitwidth CNN accelerator on FPGA using Winograd and block floating point arithmetic
JP2020021208A (ja) ニューラルネットワーク用プロセッサ、ニューラルネットワーク用処理方法、および、プログラム
US11475281B2 (en) Electronic apparatus and control method thereof
CN112580796A (zh) 用于神经网络的剪枝方法、装置以及系统
JP6747305B2 (ja) データ処理装置及びニューラルネットワークシステム
JP2009021928A (ja) 情報処理装置及びプログラム
Schmidt et al. Akers's wavefront planner—One of the fastest stencil-based path planners on FPGAs
US20240005972A1 (en) Acceleration of In-Memory-Compute Arrays

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18921442

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020523858

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18921442

Country of ref document: EP

Kind code of ref document: A1