WO2020145146A1 - 推論処理装置および推論処理方法 - Google Patents
推論処理装置および推論処理方法 Download PDFInfo
- Publication number
- WO2020145146A1 WO2020145146A1 PCT/JP2019/050832 JP2019050832W WO2020145146A1 WO 2020145146 A1 WO2020145146 A1 WO 2020145146A1 JP 2019050832 W JP2019050832 W JP 2019050832W WO 2020145146 A1 WO2020145146 A1 WO 2020145146A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- inference
- input data
- data
- batch
- unit
- Prior art date
- Legal status (The legal status 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 status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/06—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
- G06N3/063—Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
- G06N3/0442—Recurrent networks, e.g. Hopfield networks characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0495—Quantised networks; Sparse networks; Compressed networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/048—Activation functions
Definitions
- the present invention relates to an inference processing device and an inference processing method, and more particularly to a technique for performing inference using a neural network.
- DNN Deep Neural Networks
- the DNN process has two phases, learning and inference.
- learning requires a large amount of data, and thus may be processed in the cloud.
- inference a learned DNN model is used, and an output is estimated with respect to unknown input data.
- input data such as time series data or image data is given to the learned neural network model to infer the characteristics of the input data.
- a sensor terminal equipped with an acceleration sensor and a gyro sensor is used to detect an event such as rotation or stop of a garbage collection vehicle, thereby I am estimating the quantity.
- a neural network model learned using time-series data in which the event at each time is known in advance is used.
- Non-Patent Document 1 time-series data acquired from a sensor terminal is used as input data, and it is necessary to extract events in real time. Therefore, it is necessary to speed up the inference process. Therefore, conventionally, an FPGA that implements inference processing is mounted on a sensor terminal, and inference operation is performed by such FPGA to speed up the processing (see Non-Patent Document 2).
- Kishino, et. al “Detecting garbage collection duration using motion sensors mounted on a garbage truck smart waste management”, SPWID17 Kishino, et. al, “Datafying city: detecting and accumulating spatio-temporal events by vehicle-mounted sensors”, BIGDATA 2017
- the present invention has been made to solve the above-mentioned problems, and an object of the present invention is to provide an inference processing technique that can eliminate the bottleneck of data transfer and reduce the processing time of the inference operation.
- an inference processing device is based on a first storage unit that stores input data, a second storage unit that stores the weight of a neural network, and information based on the input data.
- a batch processing control unit that sets a batch size, a memory control unit that reads the input data corresponding to the set batch size from the first storage unit, the input data and the weight corresponding to the batch size,
- an inference operation unit that infers the characteristics of the input data by batch processing the operations of the neural network is provided.
- the batch processing control unit may set the batch size based on information about a hardware resource used for inference operation.
- the inference operation unit applies a matrix operation unit that performs a matrix operation of the input data and the weight, and an activation function to a matrix operation result by the matrix operation unit.
- the matrix operation unit may include a multiplier that multiplies the input data and the weight, and an adder that adds a multiplication result of the multiplier.
- a plurality of the matrix operation units may be provided and the matrix operation may be performed in parallel.
- the matrix operation unit may include a plurality of the multipliers and the adders, respectively, and perform multiplication and addition in parallel.
- the inference processing device may further include a data conversion unit that converts the data type of the input data and the weight input to the inference operation unit.
- a plurality of the inference operation units may be provided and the inference operation may be performed in parallel.
- the inference processing method includes a first step of setting a batch size based on information about input data stored in a first storage unit, and the set batch size.
- the input data according to the batch size set based on the information about the input data and the weight are input, and the operation of the learned neural network is batch-processed. , It is possible to eliminate the bottleneck of data transfer and reduce the processing time of the inference operation.
- FIG. 1 is a block diagram showing the configuration of an inference processing apparatus according to the first embodiment of the present invention.
- FIG. 2 is a block diagram showing the configuration of the storage unit according to the first embodiment.
- FIG. 3 is a block diagram showing the configuration of the inference operation unit according to the first embodiment.
- FIG. 4 is a block diagram showing the configuration of the matrix calculation unit according to the first embodiment.
- FIG. 5 is a block diagram showing the hardware configuration of the inference processing apparatus according to the first embodiment.
- FIG. 6 is a diagram illustrating an example of sample code of the inference processing program according to the first embodiment.
- FIG. 7A is a diagram for explaining the inference process using the neural network according to the first embodiment.
- FIG. 7B is a diagram for explaining inference processing using the neural network according to the first embodiment.
- FIG. 7A is a diagram for explaining the inference process using the neural network according to the first embodiment.
- FIG. 7B is a diagram for explaining inference processing using the neural network according to the first embodiment
- FIG. 8 is a flow chart for explaining the operation of the inference processing device according to the first embodiment.
- FIG. 9 is a flowchart for explaining the batch size setting process according to the first embodiment.
- FIG. 10 is a diagram for explaining data transfer in a conventional inference processing device.
- FIG. 11 is a diagram for explaining data transfer in the inference processing device according to the first embodiment.
- FIG. 12 is a diagram for explaining the effect of the first embodiment.
- FIG. 13 is a block diagram showing the configuration of the inference processing apparatus according to the second embodiment.
- FIG. 14 is a flow chart for explaining the operation of the inference processing device according to the second embodiment.
- FIG. 15 is a diagram for explaining the effect of the second embodiment.
- FIG. 16 is a block diagram showing the arrangement of the inference processing apparatus according to the third embodiment.
- FIG. 17 is a block diagram showing the configuration of the inference calculation section according to the fourth embodiment.
- FIG. 18 is a block diagram showing the configuration of the matrix calculation unit according to the fifth embodiment.
- FIG. 19 is a block diagram showing the configuration of the inference processing apparatus according to the sixth embodiment.
- FIG. 20 is a block diagram showing a configuration of an inference processing device according to a conventional example.
- FIG. 1 is a block diagram showing the configuration of an inference processing device 1 according to the first embodiment of the present invention.
- the inference processing device 1 uses time series data such as voice data and language data acquired from an external sensor 2 or image data as input data X to be inferred.
- the inference processing apparatus 1 uses the learned neural network model to batch process the operation of the neural network and infers the characteristics of the input data X.
- the inference processing device 1 uses a neural network model learned in advance using input data X such as time-series data whose events at each time are known.
- the inference processing apparatus 1 inputs the input data X such as unknown time series data according to the set batch size and the weight data W of the learned neural network, and estimates the event at each time by batch processing.
- the input data X and the weight data W are matrix data.
- the inference processing apparatus 1 batch-processes the input data X acquired from the sensor 2 including the acceleration sensor and the gyro sensor, and detects an event such as rotation or stop of the garbage truck to detect the amount of dust. Can be estimated (see Non-Patent Document 1).
- the inference processing apparatus 1 includes a batch processing control unit 10, a memory control unit 11, a storage unit 12, and an inference operation unit 13.
- the batch processing control unit 10 sets a batch size for batch processing the input data X in the inference operation unit 13 based on the information about the input data X.
- the batch processing control unit 10 sends to the memory control unit 11 an instruction to read the input data X corresponding to the set batch size from the storage unit 12.
- the batch processing control unit 10 can set the number of input data X to be handled in one batch processing, that is, the batch size, based on the information on the hardware resources used for the inference calculation described later.
- the batch processing control unit 10 can set the batch size based on the matrix size of the weight data W of the neural network model or the matrix size of the input data X stored in the storage unit 12.
- the batch processing control unit 10 can optimize the data transmission/reception time and the data calculation time, for example, and set an optimum batch size according to the balance between the transmission/reception time and the calculation time. ..
- the batch processing control unit 10 may set the batch size based on the processing time and the inference accuracy of the entire inference processing apparatus 1.
- the memory control unit 11 reads out the input data X according to the batch size set by the batch processing control unit 10 from the storage unit 12. The memory control unit 11 also reads the weight data W of the neural network from the storage unit 12. The memory control unit 11 transfers the read input data X and weight data W to the inference calculation unit 13.
- the storage unit 12 includes an input data storage unit (first storage unit) 120 and a learned neural network (NN) storage unit (second storage unit) 121.
- the input data storage unit 120 stores input data X such as time-series data acquired from the external sensor 2.
- the learned NN storage unit 121 stores a learned neural network that has been learned and constructed in advance, that is, weight data W that is a learned parameter of the neural network. For example, the weight data W that has been determined by learning in advance by an external server or the like is loaded and stored in the learned NN storage unit 121.
- CNN convolutional neural network
- LSTM long-term short-term memory
- GRU gated recursive unit
- Residual Network Residual Network
- the sizes of the input data X and the weight data W are determined by the neural network model used in the inference processing device 1.
- the input data X and the weight data W are represented by, for example, a 32-bit floating point type.
- the inference operation unit 13 batch-processes the operation of the neural network with the input data X and the weight data W according to the set batch size as inputs, and infers the characteristics of the input data X. More specifically, the input data X and the weight data W read and transferred by the memory control unit 11 are input to the inference operation unit 13 to perform the inference operation.
- the inference operation unit 13 includes a matrix operation unit 130 and an activation function operation unit 131.
- the matrix calculation unit 130 includes a multiplier 132 and an adder 133, as shown in FIG.
- the matrix calculation unit 130 performs matrix calculation on the input data X and the weight data W. More specifically, as shown in FIG. 4, the multiplier 132 multiplies the input data X by the weight data W. The multiplication results are added by the adder 133, and the addition result is output. The addition result is output as the matrix calculation result A by the matrix calculation unit 130.
- the matrix operation result A is input to the activation function operation unit 131, a preset activation function is applied, and the inference result Y which is the result of the inference operation is determined. More specifically, the activation function operation unit 131 determines how the matrix operation result A is activated by applying the activation function, converts the matrix operation result A, and outputs the inference result Y. To do.
- the activation function can be selected from, for example, a step function, a sigmoid function, a tanh function, a ReLU function, and a softmax function.
- the inference processing apparatus 1 is, for example, a computer including a processor 102, a main storage device 103, a communication interface 104, an auxiliary storage device 105, and an input/output device 106, which are connected via a bus 101, and these.
- the display device 107 may be connected via the bus 101, and the inference result may be displayed on the display screen.
- the sensor 2 may be connected via the bus 101, and the inference processing apparatus 1 may measure the input data X which is time-series data such as voice data to be inferred.
- the main storage device 103 is realized by a semiconductor memory such as SRAM, DRAM, and ROM.
- the main storage device 103 realizes the storage unit 12 described in FIG.
- a program for the processor 102 to perform various controls and calculations is stored in the main storage device 103 in advance.
- Each function of the inference processing apparatus 1 including the batch processing control unit 10, the memory control unit 11, and the inference operation unit 13 illustrated in FIGS. 1 to 4 is realized by the processor 102 and the main storage device 103.
- the communication interface 104 is an interface circuit for communicating with various external electronic devices via the communication network NW.
- the inference processing apparatus 1 may receive the weight data W of the learned neural network from the outside via the communication interface 104 or may send the inference result Y to the outside.
- the communication interface 104 for example, an interface and an antenna compatible with wireless data communication standards such as LTE, 3G, wireless LAN, and Bluetooth (registered trademark) are used.
- the communication network NW includes, for example, a WAN (Wide Area Network), a LAN (Local Area Network), the Internet, a dedicated line, a wireless base station, a provider, and the like.
- the auxiliary storage device 105 includes a readable/writable storage medium and a drive device for reading/writing various information such as programs and data from/to the storage medium.
- the auxiliary storage device 105 can use a semiconductor memory such as a hard disk or a flash memory as a storage medium.
- the auxiliary storage device 105 has a program storage area for storing a program for the inference processing device 1 to perform inference by batch processing. Furthermore, the auxiliary storage device 105 may have, for example, a backup area for backing up the above-mentioned data and programs. The auxiliary storage device 105 can store the inference processing program shown in FIG. 6, for example.
- the input/output device 106 is configured by an I/O terminal that inputs a signal from an external device such as the display device 107 and outputs a signal to the external device.
- the inference processing device 1 is not limited to being realized by one computer, but may be distributed by a plurality of computers connected to each other by the communication network NW.
- the processor 102 may be realized by hardware such as an FPGA (Field-Programmable Gate Array), an LSI (Large Scale Integration), and an ASIC (Application Specific Circuit).
- the circuit configuration can be flexibly rewritten according to the configuration of the input data X and the neural network model used.
- the inference processing device 1 capable of supporting various applications can be realized.
- the softmax function shown in FIG. 7B is used as the activation function.
- the features of the input data X to be inferred are represented by M (M is a positive integer) components, and the features of the inference result Y are represented by N (N is a positive integer) components.
- the data size of the weight data W of the neural network is represented by M ⁇ N.
- the weight data W is represented by a matrix of 2 rows and 2 columns having four components.
- the data size of the matrix calculation result A is Batch ⁇ N, that is, 1 ⁇ 2.
- a softmax function is applied to the matrix calculation result A as an activation function to obtain an inference result Y.
- the batch size Batch is a value in the range of 1 or more and less than or equal to the number of input data X data.
- the softmax function is applied to each component of the matrix calculation result A[a1, a2] (softmax(A[a1, a2]), and the inference result Y[y1, y2] is obtained. Is output.
- the storage unit 12 stores the weight data W of the neural network constructed by learning in advance.
- Input data X such as time-series data and image data measured by the external sensor 2 is stored in the storage unit 12.
- the batch processing control unit 10 sets the batch size of the input data X handled in one batch processing (step S1).
- the batch processing control unit 10 acquires the data size of the weight data W and the data number of the input data X stored in the storage unit 12 as shown in FIG. 9 (step S100). .. Next, the batch processing control unit 10 acquires information on the hardware resources of the entire inference processing device 1 from the storage unit 12 (step S101). Information about the hardware resources of the entire inference processing device 1 is stored in the storage unit 12 in advance.
- the hardware resource is a combination of a memory capacity required to store the input data X and the weight data W, and a combination of standard cells required to form a circuit for performing arithmetic processing such as addition and multiplication. It means a circuit etc.
- a combination circuit such as a flip-flop (FF), a look-up table (LUT), and a digital signal processor (DSP) can be given as an example of the hardware resource.
- step S101 the memory capacity of the entire inference processing apparatus 1 and the device scale of the entire inference processing apparatus 1, that is, the hardware resources included in the entire inference processing apparatus 1 as an arithmetic circuit, for example, FF, LUT for FPGA, The number of DSPs and the like is acquired from the storage unit 12.
- step S102 the batch processing control unit 10 sets the total number of pieces of input data X as an initial value of the batch size handled in one batch processing. That is, in step S102, the total number of input data X, which is the maximum value of the batch size, is set as the initial value of the batch size.
- step S103 The hardware resources necessary for the circuit configuration for realizing the inference operation unit 13 are obtained (step S103).
- the batch processing control unit 10 can build the logic circuit of the inference operation unit 13 and acquire the hardware resources used.
- step S104 when the number of hardware resources used when the inference operation unit 13 performs the inference operation exceeds the number of hardware resources included in the entire inference processing apparatus 1 (step S104: YES), batch processing control The unit 10 reduces the batch size initialized in step S102 (step S105). For example, the batch processing control unit 10 subtracts 1 from the initially set batch size.
- step S106 NO
- the batch size Is used as the set value the batch processing control unit 10 instructs the memory control unit 11 to read the input data X according to the set batch size.
- step S106 If the number of hardware resources used by the inference operation unit 13 for the inference operation exceeds the number of hardware resources included in the entire inference processing apparatus 1 in step S106 (step S106: YES), the batch processing control unit In step 10, the batch size is reduced again (step S105).
- the memory control unit 11 reads the input data X and the weight data W according to the set batch size from the storage unit 12 (step S2). More specifically, the memory control unit 11 reads the input data X and the weight data W from the storage unit 12 and transfers them to the inference operation unit 13.
- the inference operation unit 13 batch-processes the operation of the neural network based on the input data X and the weight data W to obtain the inference result Y (step S3). More specifically, in the matrix calculation unit 130, the product-sum calculation of the input data X and the weight data W is performed. Specifically, the multiplier 132 multiplies the input data X by the weight data W. The multiplication result is added by the adder 133 to obtain the matrix operation result A. An activation function is applied to the matrix operation result A by the activation function operation unit 131, and the inference result Y is output (step S4).
- the inference processing device 1 can infer the characteristics of the input data X using the learned neural network by using the time-series data such as image data and sound as the input data X.
- the inference processing apparatus 1 can perform a relatively large matrix calculation by performing batch processing, and has a higher calculation speed than executing a divided smaller matrix calculation. The calculation can be made faster.
- FIG. 12 shows the effect of the present embodiment by batch processing when the data size of the weight data W is 30 ⁇ 30.
- the broken line shows the relationship between the batch size and the normalized processing time of the inference operation when the batch processing is not performed and when the batch processing according to the present embodiment is performed.
- the processing time is shortened as compared with the case where the batch processing is not performed.
- the batch processing of one batch is performed based on the hardware resources used by the inference operation unit 13 for the hardware resources of the entire inference processing apparatus 1.
- the inference operation unit 13 executes the inference operation of the 32-bit floating point type input data X and the weight data W has been described.
- the inference operation is executed after converting the bit representation of the data input to the inference operation unit 13 into the data of lower bit precision.
- FIG. 13 is a block diagram showing the configuration of the inference processing apparatus 1A according to this embodiment.
- the inference processing apparatus 1A includes a batch processing control unit 10, a memory control unit 11, a storage unit 12, an inference operation unit 13, and a data type conversion unit (data conversion unit) 14.
- the data type conversion unit 14 converts the data types of the input data X and the weight data W input to the inference calculation unit 13. More specifically, the data type conversion unit 14 sets the data types of the input data X and the weight data W read by the memory control unit 11 from the storage unit 12 and transferred to the inference operation unit 13 to a 32-bit floating point number. The type is converted into a preset data type, for example, an 8-bit or 16-bit data representation with a reduced precision by reducing the number of digits.
- the data type conversion unit 14 can convert the input data X including the decimal point and the weight data W into an integer type by performing rounding processing such as rounding up, rounding down, or rounding off, for example.
- the data type conversion unit 14 can convert the data type of the input data X and the weight data W read by the memory control unit 11 accessing the storage unit 12 before being transferred. Further, the data type conversion unit 14 may convert the input data X and the weight data W into data types having different bit expressions as long as the number of digits is lower and the bit precision is lower than that of the original data type. ..
- the memory control unit 11 transfers the input data X′ and the weight data W′, the data types of which have been converted by the data type conversion unit 14 and the bit precision of which has become lower, to the inference operation unit 13. More specifically, the memory control unit 11 reads from the storage unit 12 the input data X corresponding to the batch size set by the batch processing control unit 10 and the weight data W stored in the storage unit 12 in advance. Thereafter, the read input data X and weight data W are converted in data type by the data type conversion unit 14, and the converted input data X′ and weight data W′ are transferred to the inference operation unit 13.
- the storage unit 12 stores the weight data W of the neural network constructed by learning in advance.
- the weight data W and the input data X acquired from the sensor 2 and stored in the storage unit 12 are both 32-bit floating point type data.
- the batch processing control unit 10 sets the batch size of the input data X handled in one batch processing (step S10).
- the batch size setting process is the same as in the first embodiment (FIG. 9).
- the memory control unit 11 reads from the storage unit 12 the input data X and the weight data W according to the batch size set by the batch processing control unit 10 (step S11).
- the data type conversion unit 14 converts the data types of the input data X and the weight data W read by the memory control unit 11 (step S12).
- the data type conversion unit 14 converts the 32-bit floating point type input data X and the weight data W into data with lower bit precision, for example, 8-bit input data X′ and weight data W′. Convert to.
- the input data X′ and the weight data W′ whose data types have been converted are transferred to the inference operation unit 13 by the memory control unit 11.
- the inference operation unit 13 batch-processes the operation of the neural network based on the input data X'and the weight data W'converted into low-bit precision data to obtain the inference result Y (step S13). More specifically, the matrix operation unit 130 performs a product-sum operation on the input data X′ and the weight data W′. Specifically, the multiplier 132 multiplies the input data X′ and the weight data W′. The multiplication results are added by the adder 133, and the matrix calculation result A is obtained. An activation function is applied to the matrix operation result A by the activation function operation unit 131, and the inference result Y is output (step S14).
- the inference processing device 1A can infer the characteristics of the input data X using the learned neural network, using the time-series data such as image data and sound as the input data X.
- the memory control unit 11 reads the input data X and the weight data W from the storage unit 12 and transfers the data, the data converted into low-bit precision data is transferred, so that the transfer time can be reduced. ..
- the input data X and the weight data W input to the inference operation unit 13 are converted into data of lower bit precision, so that the cache Can improve the usage rate and reduce the bottleneck of the data bus bandwidth.
- the inference processing device 1A performs the calculation of the neural network using the low bit precision input data X′ and the weight data W′, the number of multipliers 132 and adders 133 required for the calculation can be reduced. it can. As a result, the inference processing device 1A can be realized with fewer hardware resources, and the circuit scale of the entire device can be reduced.
- the inference processing device 1A since the hardware resources used can be reduced, it is possible to reduce power consumption and heat generation.
- the inference processing device 1A performs the neural network operation using the input data X'and the weight data W'having lower bit precision, the processing can be speeded up by performing the processing at a higher clock frequency.
- the inference processing device 1A performs the operation of the neural network using the input data X′ and the weight data W′ having a bit precision lower than 32 bits, the number of operations is larger than that in the case of performing the operation with 32 bits. Parallel processing and batch processing are possible, and the processing speed can be increased.
- inference operation unit 13 performs the operation processing of the neural network.
- a plurality of inference operation units 13a and 13b are used to process the inference operation indicated by the broken line frame 60 in the sample code of FIG. 6 in parallel.
- the configuration different from the first and second embodiments will be mainly described.
- the inference processing apparatus 1B includes a batch processing control unit 10, a memory control unit 11, a storage unit 12, and a plurality of inference operation units 13a and 13b.
- the inference operation units 13a and 13b are provided, for example, K (K is an integer of 2 or more and Batch (batch size) or less, where Batch is 2 or more).
- K is an integer of 2 or more and Batch (batch size) or less, where Batch is 2 or more).
- the inference operation units 13a and 13b perform matrix operation of the input data X and the weight data W transferred by the memory control unit 11 in the matrix operation unit 130 included therein, and output the matrix operation result A, respectively.
- the activation function operation unit 131 provided in each of the plurality of inference operation units 13a and 13b, the activation function is applied to the matrix operation result A, and the inference result Y which is the output is obtained.
- the input data X is Batch row N column.
- the operation that needs to be repeated Batch times to obtain the inference result Y for the number of data of the input data X according to the set batch size is the present embodiment.
- K parallel is performed.
- K inference operation units 13a and 13b are provided, and the operation of the neural network that needs to be repeated Batch times is performed in K parallel. Since this is performed, the number of repetitive operations is reduced, and the processing of the inference operation can be speeded up.
- the inference operation unit 13 includes only one matrix operation unit 130 and performs the product sum operation of matrices.
- the inference operation unit 13C includes a plurality of matrix operation units 130a and 130b, and the product-sum operation of the matrices shown in the broken line frame 61 of the sample code shown in FIG. 6 is performed in parallel. Execute.
- the configuration different from the first to third embodiments will be mainly described.
- the inference operation unit 13C includes a plurality of matrix operation units 130a and 130b and one activation function operation unit 131.
- the other configuration of the inference processing apparatus 1 according to this embodiment is the same as that of the inference processing apparatus 1 shown in FIG.
- the inference operation unit 13C includes K (K is an integer of 2 or more and N or less) matrix operation units 130a and 130b.
- the K matrix operation units 130a and 130b perform matrix operation on the input data X and the weight data W in K parallels, and output a matrix operation result A.
- the product-sum operation of these matrices is repeated N times to obtain a batch size (Batch) ⁇
- the calculation for one row of the matrix operation result A having N data size is completed.
- the matrix calculation unit 130a receives the first column components W11 and W21 of the weight data W
- the matrix calculation unit 130b receives the second column components W21 and W22 of the weight data W.
- the memory control unit 11 can control the distribution of the weight data W according to the number of matrix operation units 130a and 130b.
- the matrix operation unit 130a performs a sum of products operation and outputs the component a1 of the matrix operation result A.
- the matrix calculation unit 130b also performs the product-sum calculation in the same manner, and outputs the component a2 of the matrix calculation result A.
- the calculation results of the matrix calculation units 130a and 130b are input to the activation function calculation unit 131 and multiplied by the activation function to determine the inference result Y.
- the K matrix operation units 130a and 130b perform the matrix operation in K parallels, so that the iterative calculation in the matrix operation for one row of the matrix operation result A is performed.
- the number of times can be reduced.
- the inference processing of the inference processing device 1 can be speeded up.
- the plurality of matrix operation units 130a and 130b according to the fourth embodiment may be combined with the third embodiment. Since each of the plurality of inference operation units 13a and 13b described in the third embodiment includes the plurality of matrix operation units 130a and 130b, it is possible to further speed up the inference operation.
- the matrix calculation unit 130 includes one multiplier 132 and one adder 133
- the matrix calculation unit 130D includes a plurality of multipliers 132a and 132b and adders 133a and 133, and the matrix calculation unit 130D performs the matrix calculation indicated by the broken line frame 62 of the sample code in FIG. Perform internal processing in parallel.
- the matrix calculation unit 130D includes K (K is an integer of 2 or more and M or less) multipliers 132a and 132b and adders 133a and 133b.
- K is an integer of 2 or more and M or less
- the matrix calculation unit 130D calculates the sum of products of the input data X and the weight data W to calculate the components of one row of the matrix calculation result A.
- the matrix calculation unit 130D performs the product-sum calculation in K parallels in the K multipliers 132a and 132b and the adders 133a and 133b. In the matrix operation, the sum of products operation of the input data X having M components and the weight data W having a data size of M ⁇ N is performed.
- the weight data W has a data size of 3 ⁇ 2 (M ⁇ N), for example.
- the first column of the weight data W is represented by W11, W21, W31.
- the matrix operation result A has two components and is represented by A[a1, a2].
- the component x1 of the input data X and the component W11 of the weight data W are input to the multiplier 132a.
- the multiplier 132b receives the component x2 of the input data X and the component W21 of the weight data W, and the component x3 of the input data X and the component W31 of the weight data.
- Each of the multipliers 132a and 132b outputs the multiplication result.
- the multiplier 132a outputs the multiplication result x1W11
- the multiplier 132b outputs the multiplication result x2W21 and the multiplication result x3W31.
- the adder 133b adds the multiplication result x2W21 of the multiplier 132b and the multiplication result x3W31.
- the adder 133a adds the multiplication result x1W11 of the multiplier 132a and the addition result x2W21+x3W31 of the adder 133b, and outputs the component a1 of the matrix operation result A.
- the fifth embodiment may be combined with the third and fourth embodiments.
- the matrix operation unit 130 of each of the plurality of inference operation units 13a and 13b according to the third embodiment includes the plurality of multipliers 132a and 132b according to the present embodiment, and thus the third embodiment
- the inference operation can be speeded up as compared with the case where only such a configuration is adopted.
- each of the matrix operation units 130a and 130b according to the fourth embodiment includes the multipliers 132a and 132b according to the present embodiment, only the configuration according to the fourth embodiment is achieved. It is possible to further speed up the matrix calculation as compared with the case where it is adopted.
- the inference processing apparatus 1B according to the third embodiment can speed up the processing most. Then, the processing can be speeded up in the order of the fourth embodiment and the fifth embodiment.
- one adder 133 may be provided. Even in that case, since the multiplication process is executed in parallel, the matrix calculation can be speeded up. This embodiment is particularly effective when M is 4 or more.
- the inference processing apparatus 1E includes the wireless communication unit 15 that receives the weight data W via the communication network NW.
- the inference processing apparatus 1E includes a batch processing control unit 10, a memory control unit 11, a storage unit 12, an inference operation unit 13, and a wireless communication unit 15.
- the wireless communication unit 15 receives the weight data W of the neural network model used in the inference processing apparatus 1E from an external cloud server or the like via the communication network NW and stores it in the storage unit 12. For example, when the weight data W of the neural network model used in the inference processing device 1E is relearned and updated, the wireless communication unit 15 downloads the updated weight data W by wireless communication and stores it in the storage unit 12. The old weight data W that has been rewritten is rewritten.
- the wireless communication unit 15 receives the new learned neural network weight data W received from an external cloud server or the like. It is received and stored in the storage unit 12.
- the weight data W of the neural network model can be rewritten, and the optimum weight data W can be used in the inference processing device 1E. It is possible to prevent the inference accuracy from being lowered due to fluctuations in the input data X.
- each functional unit except the inference operation unit in the inference processing device of the present invention can be realized by a computer and a program, and the program can be recorded in a recording medium or provided through a network.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- General Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Computational Linguistics (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Artificial Intelligence (AREA)
- Neurology (AREA)
- Feedback Control In General (AREA)
- Image Analysis (AREA)
- Complex Calculations (AREA)
Abstract
データ転送のボトルネックを排除して推論演算の処理時間を削減することができる推論処理技術を提供することを目的とする。 推論処理装置1は、入力データXを記憶する入力データ格納部120と、ニューラルネットワークの重みデータWを記憶する学習済みNN格納部121と、入力データXに関する情報に基づいて、バッチサイズを設定するバッチ処理制御部10と、設定されたバッチサイズに応じた入力データXを入力データ格納部120から読み出すメモリ制御部11と、バッチサイズに応じた入力データXおよび重みデータWを入力として、ニューラルネットワークの演算をバッチ処理して、入力データXの特徴を推論する推論演算部13とを備える。
Description
本発明は、推論処理装置および推論処理方法に関し、特に、ニューラルネットワークを用いて推論を行う技術に関する。
近年、モバイル端末やInternet of Things(IoT)デバイス等のエッジデバイスの増加に伴い、生成されるデータが爆発的に増加している。この膨大なデータから有意義な情報を抽出するには、深層ニューラルネットワーク(Deep Neural Networks:DNN)とよばれる最先端の機械学習技術が優位である。近年のDNNに関する研究の進歩により、データの解析精度は大幅に改善されており、DNNを利用した技術のさらなる発展が期待されている。
DNNの処理は学習および推論の2つのフェーズがある。一般に、学習では、大量のデータを必要とするため、クラウドで処理される場合がある。一方、推論では学習済みのDNNモデルを使用し、未知の入力データに対して出力を推定する。
より詳細に説明すると、DNNにおける推論処理では、学習済みのニューラルネットワークモデルに時系列データまたは画像データなどの入力データを与えて、入力データの特徴を推論する。例えば、非特許文献1に開示されている具体的な例によると、加速度センサとジャイロセンサとを搭載したセンサ端末を用いて、ゴミ収集車の回転や停止といったイベントを検出することで、ゴミの量を推定している。このように、未知の時系列データを入力として、各時刻におけるイベントを推定するには、予め各時刻におけるイベントが既知である時系列データを用いて学習したニューラルネットワークモデルを用いる。
非特許文献1では、センサ端末から取得される時系列データを入力データとして用いており、リアルタイムにイベントを抽出する必要がある。そのため、推論処理をより高速化することが必要となる。そこで、従来から、推論処理を実現するFPGAをセンサ端末に搭載し、そのようなFPGAで推論演算を行い、処理の高速化を図っている(非特許文献2参照)。
Kishino,et.al,"Detecting garbage collection duration using motion sensors mounted on a garbage truck toward smart waste management",SPWID17
Kishino,et.al,"Datafying city:detecting and accumulating spatio-temporal events by vehicle-mounted sensors",BIGDATA 2017
しかし、従来の技術では、推論処理を行う際に、メモリから入力データおよびニューラルネットワークモデルの重みを推論処理の対象となるデータセットごとに読み出し、推論演算を行う回路に転送する必要があった。そのため、扱うデータ量が多くなるとデータ転送がボトルネックになり、推論演算の処理時間を削減することが困難であった。
本発明は、上述した課題を解決するためになされたものであり、データ転送のボトルネックを排除して推論演算の処理時間を削減することができる推論処理技術を提供することを目的とする。
上述した課題を解決するために、本発明に係る推論処理装置は、入力データを記憶する第1記憶部と、ニューラルネットワークの重みを記憶する第2記憶部と、前記入力データに関する情報に基づいて、バッチサイズを設定するバッチ処理制御部と、設定された前記バッチサイズに応じた前記入力データを前記第1記憶部から読み出すメモリ制御部と、前記バッチサイズに応じた前記入力データおよび前記重みを入力として、前記ニューラルネットワークの演算をバッチ処理して、前記入力データの特徴を推論する推論演算部とを備える。
また、本発明に係る推論処理装置において、前記バッチ処理制御部は、推論演算に用いられるハードウェアリソースに関する情報に基づいて、前記バッチサイズを設定してもよい。
また、本発明に係る推論処理装置において、前記推論演算部は、前記入力データと前記重みとの行列演算を行う行列演算部と、前記行列演算部による行列演算結果に対して活性化関数を適用する活性化関数演算部とを備え、前記行列演算部は、前記入力データと前記重みとを乗算する乗算器と、前記乗算器による乗算結果を加算する加算器とを有していてもよい。
また、本発明に係る推論処理装置において、前記行列演算部は、複数具備され、行列演算を並列に行ってもよい。
また、本発明に係る推論処理装置において、前記行列演算部は、前記乗算器および前記加算器をそれぞれ複数具備し、乗算および加算を並列に行ってもよい。
また、本発明に係る推論処理装置において、前記推論演算部に入力される前記入力データおよび前記重みのデータタイプを変換するデータ変換部をさらに備えていてもよい。
また、本発明に係る推論処理装置において、前記推論演算部は、複数具備され、推論演算を並列に行ってもよい。
上述した課題を解決するために、本発明に係る推論処理方法は、第1記憶部に記憶された入力データに関する情報に基づいて、バッチサイズを設定する第1ステップと、設定された前記バッチサイズに応じた前記入力データを前記第1記憶部から読み出す第2ステップと、前記バッチサイズに応じた前記入力データおよび第2記憶部に記憶されたニューラルネットワークの重みを入力として、前記ニューラルネットワークの演算をバッチ処理して、前記入力データの特徴を推論する第3ステップとを備える。
本発明によれば、入力データに関する情報に基づいて設定されたバッチサイズに応じた入力データ、および重みを入力として、学習済みニューラルネットワークの演算をバッチ処理するので、扱うデータ量が多くなっても、データ転送のボトルネックを排除して、推論演算の処理時間を削減することができる。
以下、本発明の好適な実施の形態について、図1から図20を参照して詳細に説明する。
[第1の実施の形態]
図1は、本発明の第1の実施の形態に係る推論処理装置1の構成を示すブロック図である。本実施の形態に係る推論処理装置1は、図1に示すように、外部のセンサ2などから取得された音声データや言語データなどの時系列データ、または画像データを推論対象の入力データXとして用いる。推論処理装置1は、学習済みのニューラルネットワークモデルを用いてニューラルネットワークの演算をバッチ処理し、入力データXの特徴を推論する。
図1は、本発明の第1の実施の形態に係る推論処理装置1の構成を示すブロック図である。本実施の形態に係る推論処理装置1は、図1に示すように、外部のセンサ2などから取得された音声データや言語データなどの時系列データ、または画像データを推論対象の入力データXとして用いる。推論処理装置1は、学習済みのニューラルネットワークモデルを用いてニューラルネットワークの演算をバッチ処理し、入力データXの特徴を推論する。
より詳細には、推論処理装置1は、各時刻におけるイベントが既知である時系列データなどの入力データXを用いて予め学習したニューラルネットワークモデルを用いる。推論処理装置1は、設定されたバッチサイズに応じた未知の時系列データなどの入力データXおよび学習済みのニューラルネットワークの重みデータWを入力として、各時刻におけるイベントの推定をバッチ処理により行う。なお、入力データXおよび重みデータWは、行列データである。
例えば、推論処理装置1は、加速度センサとジャイロセンサとを搭載したセンサ2から取得された入力データXをバッチ処理して、ごみ収集車の回転や停止といったイベントを検出することで、ゴミの量を推定することができる(非特許文献1参照)。
[推論処理装置の構成]
推論処理装置1は、図1に示すように、バッチ処理制御部10、メモリ制御部11、記憶部12、および推論演算部13を備える。
推論処理装置1は、図1に示すように、バッチ処理制御部10、メモリ制御部11、記憶部12、および推論演算部13を備える。
バッチ処理制御部10は、入力データXに関する情報に基づいて、推論演算部13で入力データXをバッチ処理するためのバッチサイズを設定する。バッチ処理制御部10は、メモリ制御部11に対して、設定されたバッチサイズに応じた入力データXを記憶部12から読み出す指示を送る。
例えば、バッチ処理制御部10は、後述する推論演算に用いられるハードウェアリソースに関する情報に基づいて、1回のバッチ処理で扱う入力データXの数、すなわちバッチサイズを設定することができる。
あるいは、バッチ処理制御部10は、記憶部12に記憶されているニューラルネットワークモデルの重みデータWの行列サイズまたは入力データXの行列サイズに基づいて、バッチサイズを設定することができる。
上記例の他にも、バッチ処理制御部10は、例えば、データの送受信時間およびデータの演算時間の最適化を行い、送受信時間と演算時間とのバランスにより最適なバッチサイズを設定することもできる。また、バッチ処理制御部10は、推論処理装置1全体の処理時間および推論精度に基づいて、バッチサイズを設定してもよい。
メモリ制御部11は、バッチ処理制御部10で設定されたバッチサイズに応じた入力データXを記憶部12から読み出す。また、メモリ制御部11は、記憶部12からニューラルネットワークの重みデータWを読み出す。メモリ制御部11は、読み出した入力データXおよび重みデータWを推論演算部13に転送する。
記憶部12は、図2に示すように、入力データ格納部(第1記憶部)120および学習済みニューラルネットワーク(NN)格納部(第2記憶部)121を備える。
入力データ格納部120には、外部のセンサ2から取得された時系列データなどの入力データXが格納される。
入力データ格納部120には、外部のセンサ2から取得された時系列データなどの入力データXが格納される。
学習済みNN格納部121には、予め学習され構築された学習済みニューラルネットワーク、すなわち、ニューラルネットワークの学習済みパラメータである重みデータWが格納される。例えば、予め外部のサーバなどで学習が行われて決定された重みデータWがロードされ、学習済みNN格納部121に格納されている。
なお、推論処理装置1において採用されるニューラルネットワークモデルとして、例えば、畳み込みニューラルネットワーク(CNN)、長期短期記憶(LSTM)、ゲート付き再帰型ユニット(GRU)、Residual Network(ResNet) CNN、その他の公知の少なくとも1層の中間層を有するニューラルネットモデル、あるいはこれらを組み合わせたニューラルネットワークを用いることができる。
また、行列である入力データXおよび重みデータWのサイズは推論処理装置1で用いられるニューラルネットワークモデルにより定まる。入力データXおよび重みデータWは、例えば、32ビットの浮動小数点型で表される。
推論演算部13は、設定されたバッチサイズに応じた入力データXおよび重みデータWを入力としてニューラルネットワークの演算をバッチ処理し、入力データXの特徴を推論する。より詳細には、メモリ制御部11によって読み出され、転送された入力データXおよび重みデータWが推論演算部13に入力されて、推論演算が行われる。
推論演算部13は、図3に示すように、行列演算部130、および活性化関数演算部131を備える。行列演算部130は、図4に示すように、乗算器132と加算器133とを有する。
行列演算部130は、入力データXと重みデータWとの行列演算を行う。より詳細には、図4に示すように、乗算器132は、入力データXと重みデータWとの乗算を行う。乗算結果は、加算器133によって加算され、加算結果が出力される。この加算結果は、行列演算部130による行列演算結果Aとして出力される。
行列演算結果Aは、活性化関数演算部131に入力され、予め設定された活性化関数が適用されて、推論演算の結果である推論結果Yが決定される。より具体的には、活性化関数演算部131は、活性化関数の適用により、行列演算結果Aがどのように活性化するかを決定し、行列演算結果Aを変換して推論結果Yを出力する。活性化関数は、例えば、ステップ関数、シグモイド関数、tanh関数、ReLU関数、softmax関数などから選択することができる。
[推論処理装置のハードウェア構成]
次に、上述した構成を有する推論処理装置1のハードウェア構成の一例について図5を参照して説明する。
次に、上述した構成を有する推論処理装置1のハードウェア構成の一例について図5を参照して説明する。
図5に示すように、推論処理装置1は、例えば、バス101を介して接続されるプロセッサ102、主記憶装置103、通信インターフェース104、補助記憶装置105、入出力装置106を備えるコンピュータと、これらのハードウェア資源を制御するプログラムによって実現することができる。推論処理装置1は、例えば、表示装置107がバス101を介して接続され、表示画面に推論結果などを表示してもよい。また、センサ2がバス101を介して接続され、推論処理装置1において推論の対象となる音声データなどの時系列データからなる入力データXを測定してもよい。
主記憶装置103は、例えば、SRAM、DRAM、およびROMなどの半導体メモリによって実現される。主記憶装置103は、図1で説明した記憶部12を実現する。
主記憶装置103には、プロセッサ102が各種制御や演算を行うためのプログラムが予め格納されている。プロセッサ102と主記憶装置103とによって、図1から図4に示したバッチ処理制御部10、メモリ制御部11、推論演算部13を含む推論処理装置1の各機能が実現される。
通信インターフェース104は、通信ネットワークNWを介して各種外部電子機器との通信を行うためのインターフェース回路である。推論処理装置1は、通信インターフェース104を介して外部から学習済みニューラルネットワークの重みデータWを受信したり、外部に推論結果Yを送出してもよい。
通信インターフェース104としては、例えば、LTE、3G、無線LAN、Bluetooth(登録商標)などの無線データ通信規格に対応したインターフェースおよびアンテナが用いられる。通信ネットワークNWは、例えば、WAN(Wide Area Network)やLAN(Local Area Network)、インターネット、専用回線、無線基地局、プロバイダなどを含む。
補助記憶装置105は、読み書き可能な記憶媒体と、その記憶媒体に対してプログラムやデータなどの各種情報を読み書きするための駆動装置とで構成されている。補助記憶装置105には、記憶媒体としてハードディスクやフラッシュメモリなどの半導体メモリを使用することができる。
補助記憶装置105は、推論処理装置1がバッチ処理により推論を行うためのプログラムを格納するプログラム格納領域を有する。さらには、補助記憶装置105は、例えば、上述したデータやプログラムやなどをバックアップするためのバックアップ領域などを有していてもよい。補助記憶装置105は、例えば、図6に示す推論処理プログラムを記憶することができる。
入出力装置106は、表示装置107など外部機器からの信号を入力したり、外部機器へ信号を出力したりするI/O端子により構成される。
なお、推論処理装置1は、1つのコンピュータによって実現される場合だけでなく、互いに通信ネットワークNWで接続された複数のコンピュータによって分散されていてもよい。また、プロセッサ102は、FPGA(Field-Programmable Gate Array)、LSI(Large Scale Integration)、ASIC(Application Specific Integrated Circuit)等のハードウェアによって実現されていてもよい。
特に、推論演算部13をFPGAなどの書き換え可能なゲートアレイを用いて構成することで、入力データXの構成や使用されるニューラルネットワークモデルに応じて柔軟に回路構成を書き換えることができる。この場合、様々なアプリケーションに対応することが可能な推論処理装置1を実現できる。
[推論処理方法の概要]
次に、本実施の形態に係る推論処理装置1による入力データXの推論処理の概要について、図7Aおよび図7Bに示す具体例を用いて説明する。
次に、本実施の形態に係る推論処理装置1による入力データXの推論処理の概要について、図7Aおよび図7Bに示す具体例を用いて説明する。
図7Aに示すように、入力層、中間層、および出力層の3層からなるニューラルネットワークを例に挙げて説明する。活性化関数としては、図7Bに示すsoftmax関数を用いる。推論の対象となる入力データXの特徴は、M個(Mは正の整数)の成分、推論結果Yの特徴は、N個(Nは正の整数)の成分で表される。また、ニューラルネットワークの重みデータWのデータサイズはM×Nで表される。
図7Aおよび図7Bの具体例に示すように、M=N=2とする。また、説明の簡単のため、バッチ処理制御部10によって設定された1回のバッチ処理で扱われるバッチサイズは、Batch=1とする。このとき、バッチサイズBatch=1に対応する入力データXは、X[x1,x2]である。また、重みデータWは、4つの成分を有する2行2列の行列で表される。
図7Bに示すように、まず、バッチサイズBatch=1に応じた入力データXと、重みデータWとの行列の積和演算が行われ、行列演算結果Aが得られる。行列演算結果Aのデータサイズは、Batch×N、すなわち1×2である。その後、行列演算結果Aには、活性化関数としてsoftmax関数が適用されて、推論結果Yが求められる。
設定されたバッチサイズBatchに応じたデータ数の入力データXに対しては、そのバッチサイズBatchに応じたデータ数の推論結果Yが出力される。したがって、図7Aおよび図7Bの例では、Batch=1に応じた1セットの入力データX[x1,x2]に対して、1セットの推論結果Y[y1,y2]が出力されている。なお、バッチサイズBatchは、1以上かつ入力データXのデータ数以下の範囲の値である。
活性化関数の演算処理においては、行列演算結果Aの各成分の値ak(k=1,・・・,n)に対してsoftmax関数が適用されて、推論結果Yの各成分yk(k=1,・・・,n)の値が求められる。図7Aおよび図7Bに示す具体例では、行列演算結果A[a1,a2]の各成分にsoftmax関数が適用されて(softmax(A[a1,a2])、推論結果Y[y1,y2]が出力される。
なお、設定されたバッチサイズに応じて、入力データXのバッチ処理により推論演算を繰り返し行って推論結果Yを出力する処理は、図6のサンプルコードの破線の枠60に示されている。この推論演算において、入力データXの行の成分と重みデータWの列の成分との積およびその和が計算される(図6のサンプルコードにおける破線の枠61、62を参照)。
[推論処理装置の動作]
次に、本実施の形態に係る推論処理装置1の動作について、図8および図9のフローチャートを参照してより詳細に説明する。以下の説明では、記憶部12には、予め学習が行われて構築されたニューラルネットワークの重みデータWが格納されているものとする。また、外部のセンサ2によって測定された時系列データや画像データなどの入力データXは、記憶部12に保持されるものとする。
次に、本実施の形態に係る推論処理装置1の動作について、図8および図9のフローチャートを参照してより詳細に説明する。以下の説明では、記憶部12には、予め学習が行われて構築されたニューラルネットワークの重みデータWが格納されているものとする。また、外部のセンサ2によって測定された時系列データや画像データなどの入力データXは、記憶部12に保持されるものとする。
まず、図8に示すように、バッチ処理制御部10は、1回のバッチ処理で扱う入力データXのバッチサイズを設定する(ステップS1)。
より詳細には、バッチ処理制御部10は、図9に示すように、記憶部12に記憶されている重みデータWのデータサイズ、および入力データXのデータ数の情報を取得する(ステップS100)。次に、バッチ処理制御部10は、推論処理装置1全体におけるハードウェアリソースの情報を記憶部12から取得する(ステップS101)。なお、推論処理装置1全体のハードウェアリソースに関する情報は、予め記憶部12に記憶されている。
ここで、ハードウェアリソースとは、入力データXや重みデータWを記憶するために必要なメモリ容量や、加算、乗算などの演算処理を行うための回路を構成するのに必要なスタンダードセルの組合せ回路などを意味する。例えば、FPGAの場合であれば、フリップフロップ(FF)、ルックアップテーブル(LUT)、デジタルシグナルプロセッサ(DSP)などの組合せ回路がハードウェアリソースの例として挙げられる。
ステップS101では、推論処理装置1全体におけるメモリ容量、および推論処理装置1全体のデバイスとしての規模、すなわち推論処理装置1全体が演算回路として備えるハードウェアリソース、例えば、FPGAであればFF、LUT、DSPなどの数が記憶部12から取得される。
次に、バッチ処理制御部10は、入力データXの全データ数を1回のバッチ処理で扱うバッチサイズの初期値として設定する(ステップS102)。すなわち、ステップS102では、バッチサイズの最大値である、入力データXの全データ数がバッチサイズの初期値として設定される。
その後、ステップS100で取得した重みデータWのデータサイズおよび入力データXのデータ数、ステップS101で取得した推論処理装置1全体のハードウェアリソースの情報、およびステップS102で設定されたバッチサイズに基づいて、推論演算部13を実現する回路構成に必要なハードウェアリソースを求める(ステップS103)。例えば、バッチ処理制御部10は、推論演算部13のロジック回路を構築して、使用されるハードウェアリソースを取得することができる。
次に、推論演算部13が推論演算を行う際に使用するハードウェアリソースの数が、推論処理装置1全体が備えるハードウェアリソースの数を超える場合には(ステップS104:YES)、バッチ処理制御部10は、ステップS102で初期設定されたバッチサイズを小さくする(ステップS105)。例えば、バッチ処理制御部10は、初期設定されたバッチサイズから1を減算する。
その後、より小さいバッチサイズに基づいて求められる推論演算部13のハードウェアリソースの数が、推論処理装置1全体のハードウェアリソースの数以下となる場合には(ステップS106:NO)、そのバッチサイズが設定値として用いられ、処理は図8に戻る。より詳細には、バッチ処理制御部10は、メモリ制御部11に対して、設定されたバッチサイズに応じた入力データXを読み出すことを指示する。
なお、ステップS106で推論演算部13が推論演算に使用するハードウェアリソースの数が、推論処理装置1全体の備えるハードウェアリソースの数を超える場合には(ステップS106:YES)、バッチ処理制御部10は、再びバッチサイズを減らす処理を行う(ステップS105)。
その後、メモリ制御部11は、設定されたバッチサイズに応じた入力データX、および重みデータWを記憶部12から読み出す(ステップS2)。より詳細には、メモリ制御部11は、入力データXおよび重みデータWを記憶部12から読み出して、推論演算部13へ転送する。
次に、推論演算部13は、入力データXおよび重みデータWに基づいてニューラルネットワークの演算をバッチ処理し、推論結果Yを求める(ステップS3)。より詳細には、行列演算部130において、入力データXと重みデータWとの積和演算が行われる。具体的には、乗算器132が入力データXと重みデータWとの乗算を行う。乗算結果は加算器133によって加算されて行列演算結果Aが求められる。行列演算結果Aに対しては、活性化関数演算部131によって活性化関数が適用され、推論結果Yが出力される(ステップS4)。
上記処理によって推論処理装置1は、画像データや音声などの時系列データを入力データXとして、学習済みのニューラルネットワークを用いた入力データXの特徴の推論を行うことができる。
ここで、本実施の形態に係るバッチ処理制御部10の効果について、図10および図11、ならびに図20を用いて説明する。まず、比較のため、従来例の推論処理装置(図20)として、本実施の形態に係るバッチ処理制御部10を備えていない推論処理装置について説明する。図10に示すように、従来例に係る推論処理装置では、入力データXをn個(nは正の整数)処理すると、重みデータWをn回にわたって推論演算部に転送する必要がある。
これに対して、本実施の形態に係るバッチ処理制御部10を備える推論処理装置1では、図11に示すように、バッチ処理制御部10が、1回の推論演算で処理されるバッチサイズBatchを設定し、設定されたバッチサイズに応じた入力データXをまとめて処理する。そのため、入力データXが、例えば、n個ある場合であっても、重みデータWをn/Batch回だけ推論演算部13に転送すればよい。Batch=nの場合は、重みデータWの推論演算部13への転送は1回だけで済む。したがって、推論処理装置1におけるバス帯域の負荷を低減することができる。
また、本実施の形態に係る推論処理装置1では、バッチ処理を行うことで比較的大きな行列計算を行うことができ、分割された、より小さい行列計算を実行するよりも計算速度は速く、推論演算をより高速化することができる。
図12は、重みデータWのデータサイズが30×30の場合のバッチ処理による本実施の形態の効果を示している。図12において、破線はバッチ処理を行わない場合、実線は本実施の形態に係るバッチ処理を行った場合それぞれにおけるバッチサイズと、推論演算の正規化された処理時間との関係を示している。図12からわかるように、本実施の形態に係るバッチ処理を行った場合には、バッチ処理を行わない場合と比較して処理時間が短縮されている。
以上説明したように、第1の実施の形態に係る推論処理装置1によれば、推論処理装置1全体のハードウェアリソースに対する推論演算部13が使用するハードウェアリソースに基づいて、1回のバッチ処理で扱う入力データXのバッチサイズを設定する。そのため、扱われるデータ量が多くなってもデータ転送におけるボトルネックを排除して、推論演算に要する処理時間を削減することができる。
[第2の実施の形態]
次に、本発明の第2の実施の形態について説明する。なお、以下の説明では、上述した第1の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
次に、本発明の第2の実施の形態について説明する。なお、以下の説明では、上述した第1の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
第1の実施の形態では、推論演算部13は、例えば、32ビットの浮動小数点型の入力データXおよび重みデータWの推論演算を実行する場合について説明した。これに対して第2の実施の形態では、推論演算部13に入力されるデータのビット表現をより低ビット精度のデータに変換してから推論演算を実行する。以下、第1の実施の形態と異なる構成を中心に説明する。
[推論処理装置の構成]
図13は、本実施の形態に係る推論処理装置1Aの構成を示すブロック図である。
推論処理装置1Aは、バッチ処理制御部10、メモリ制御部11、記憶部12、推論演算部13、およびデータタイプ変換部(データ変換部)14を備える。
図13は、本実施の形態に係る推論処理装置1Aの構成を示すブロック図である。
推論処理装置1Aは、バッチ処理制御部10、メモリ制御部11、記憶部12、推論演算部13、およびデータタイプ変換部(データ変換部)14を備える。
データタイプ変換部14は、推論演算部13に入力される入力データXおよび重みデータWのデータタイプを変換する。より詳細には、データタイプ変換部14は、メモリ制御部11によって記憶部12から読み出されて推論演算部13に転送される入力データXおよび重みデータWのデータタイプを、32ビットの浮動小数点型から、予め設定されたデータタイプ、例えば、8ビットや16ビットなど、より桁数を減らして精度を下げたデータ表現に変換する。データタイプ変換部14は、例えば、切り上げ、切り捨て、四捨五入などの丸め処理を行って小数点を含む入力データXおよび重みデータWを整数型へ変換することができる。
なお、データタイプ変換部14は、メモリ制御部11が記憶部12にアクセスして読み出した入力データXおよび重みデータWについて、転送される前にデータタイプを変換することができる。また、データタイプ変換部14は、元のデータタイプよりも桁数の低い低ビット精度とすることができれば、入力データXと重みデータWとをそれぞれ異なるビット表現のデータタイプに変換してもよい。
メモリ制御部11は、データタイプ変換部14によってデータタイプが変換され、よりビット精度が低くなった入力データX’および重みデータW’を推論演算部13に転送する。より詳細には、メモリ制御部11は、バッチ処理制御部10によって設定されたバッチサイズに応じた入力データX、および予め記憶部12に記憶されている重みデータWを記憶部12から読み出す。その後、読み出された入力データXおよび重みデータWは、データタイプ変換部14によってデータタイプが変換され、変換された入力データX’および重みデータW’が推論演算部13に転送される。
[推論処理装置の動作]
次に、上述した構成を有する推論処理装置1Aの動作について、図14のフローチャートを参照して説明する。以下の説明では、記憶部12には、予め学習が行われて構築されたニューラルネットワークの重みデータWが格納されているものとする。また、重みデータWと、センサ2から取得されて記憶部12に記憶されている入力データXとは、ともに32ビットの浮動小数点型のデータであるものとする。
次に、上述した構成を有する推論処理装置1Aの動作について、図14のフローチャートを参照して説明する。以下の説明では、記憶部12には、予め学習が行われて構築されたニューラルネットワークの重みデータWが格納されているものとする。また、重みデータWと、センサ2から取得されて記憶部12に記憶されている入力データXとは、ともに32ビットの浮動小数点型のデータであるものとする。
まず、図14に示すように、バッチ処理制御部10は、1回のバッチ処理で扱う入力データXのバッチサイズを設定する(ステップS10)。なお、バッチサイズの設定処理は、第1の実施の形態と同様である(図9)。
その後、メモリ制御部11は、バッチ処理制御部10によって設定されたバッチサイズに応じた入力データX、および重みデータWを記憶部12から読み出す(ステップS11)。次に、データタイプ変換部14は、メモリ制御部11が読み出した入力データXおよび重みデータWのデータタイプを変換する(ステップS12)。
より具体的には、データタイプ変換部14は、32ビットの浮動小数点型の入力データXおよび重みデータWを、より低ビット精度のデータ、例えば、8ビットの入力データX’および重みデータW’に変換する。データタイプが変換された入力データX’および重みデータW’は、メモリ制御部11によって推論演算部13に転送される。
その後、推論演算部13は、低ビット精度のデータに変換された入力データX’および重みデータW’に基づいて、ニューラルネットワークの演算をバッチ処理し、推論結果Yを求める(ステップS13)。より詳細には、行列演算部130において、入力データX’と重みデータW’との積和演算が行われる。具体的には、乗算器132が入力データX’と重みデータW’との乗算を行う。乗算結果は加算器133によって加算され、行列演算結果Aが求められる。行列演算結果Aに対しては、活性化関数演算部131により活性化関数が適用され、推論結果Yが出力される(ステップS14)。
上記処理によって推論処理装置1Aは、画像データや音声などの時系列データを入力データXとして、学習済みのニューラルネットワークを用いた入力データXの特徴の推論を行うことができる。
次に、本実施の形態に係る推論処理装置1Aにおけるデータの転送時間について、図15を用いて説明する。図15の上段に示すように、バス幅が32ビットの場合、32ビットの入力データXの送信において1つの32ビットデータしか転送することができない。一方、図15の下段に示すように、32ビットの入力データXが8ビットの入力データX’に変換された場合には、4つの8ビットデータを転送することができる。
このように、メモリ制御部11が記憶部12から入力データXおよび重みデータWを読み出して転送する際に、低ビット精度のデータに変換したデータを転送するので、転送時間を削減することができる。
以上説明したように、第2の実施の形態に係る推論処理装置1Aによれば、推論演算部13に入力される入力データXおよび重みデータWをより低ビット精度のデータに変換するので、キャッシュの使用率を向上させ、データバス帯域のボトルネックを減らすことができる。
また、推論処理装置1Aでは、低ビット精度の入力データX’および重みデータW’を用いてニューラルネットワークの演算を行うので、演算に必要な乗算器132および加算器133の数を削減することができる。その結果として、推論処理装置1Aは、より少ないハードウェアリソースによって実現でき、装置全体としての回路規模を小さくすることができる。
また、推論処理装置1Aでは、使用するハードウェアリソースを削減することができるため、消費電力および発熱を低減できる。
また、推論処理装置1Aでは、より低ビット精度の入力データX’および重みデータW’を用いてニューラルネットワークの演算を行うので、より高いクロック周波数で処理を行うことで、処理を高速化することができる。
また、推論処理装置1Aでは、32ビットよりも低ビット精度の入力データX’および重みデータW’を用いてニューラルネットワークの演算を行うので、32ビットで演算を行う場合と比較して、より多くの並列化やバッチ処理が可能となり、処理を高速化できる。
[第3の実施の形態]
次に、本発明の第3の実施の形態について説明する。なお、以下の説明では、上述した第1および第2の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
次に、本発明の第3の実施の形態について説明する。なお、以下の説明では、上述した第1および第2の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
第1および第2の実施の形態では、1つの推論演算部13によってニューラルネットワークの演算処理が行われる場合について説明した。これに対して、第3の実施の形態では、複数の推論演算部13a、13bを用いて、図6のサンプルコードの破線の枠60に示す推論演算を並列処理する。以下、第1および第2の実施の形態と異なる構成を中心に説明する。
図16に示すように、推論処理装置1Bは、バッチ処理制御部10、メモリ制御部11、記憶部12、および複数の推論演算部13a、13bを備える。
本実施の形態では、推論演算部13a、13bが例えばK個(Kは2以上かつBatch(バッチサイズ)以下の整数、但しBatchは2以上の場合。)設けられている。推論演算部13a、13bは、それぞれが備える行列演算部130において、メモリ制御部11によって転送された入力データXおよび重みデータWの行列演算を行い、行列演算結果Aをそれぞれ出力する。
さらに、複数の推論演算部13a、13bのそれぞれが備える活性化関数演算部131において、行列演算結果Aに対して活性化関数が適用されて、出力である推論結果Yが求められる。
より具体的には、設定されたバッチサイズに応じた入力データXがBatch個の場合、入力データXはBatch行N列となる。図6のサンプルコードにおける破線の枠60に示すように、設定されたバッチサイズに応じた入力データXのデータ数分の推論結果Yを求めるためにBatch回繰り返すことが必要な演算が、本実施の形態ではK並列で行われる。
以上説明したように、第3の実施の形態に係る推論処理装置1Bによれば、K個の推論演算部13a、13bが設けられ、Batch回繰り返すことが必要なニューラルネットワークの演算をK並列に行うので、繰り返し演算の回数が削減され、推論演算の処理を高速化できる。
[第4の実施の形態]
次に、本発明の第4の実施の形態について説明する。なお、以下の説明では、上述した第1から第3の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
次に、本発明の第4の実施の形態について説明する。なお、以下の説明では、上述した第1から第3の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
第1から第3の実施の形態では、推論演算部13が行列演算部130を1つだけ備え、行列の積和演算を行う場合について説明した。これに対して第4の実施の形態では、推論演算部13Cが複数の行列演算部130a、130bを備え、図6に示したサンプルコードの破線の枠61に示す行列の積和演算を並列に実行する。以下、第1から第3の実施の形態と異なる構成を中心に説明する。
図17に示すように、本実施の形態に係る推論演算部13Cは、複数の行列演算部130a、130b、および1つの活性化関数演算部131を備える。本実施の形態に係る推論処理装置1が備えるその他の構成は、図1に示す推論処理装置1と同様である。
推論演算部13Cは、K個(Kは2以上かつN以下の整数)の行列演算部130a、130bを備える。K個の行列演算部130a、130bは、入力データXと重みデータWとの行列演算をK並列で実行し、行列演算結果Aを出力する。前述したように、入力データXの成分がM個で、重みデータWのデータサイズがM×Nである場合に、これらの行列の積和演算をN回繰り返すことで、バッチサイズ(Batch)×Nのデータサイズを有する行列演算結果Aの1行分の計算を完了する。
例えば、図7Aおよび図7Bで説明したように、M=N=2、およびBatch=1であり、2個(K=2)の行列演算部130a、130bの場合を考える。行列演算部130a、130bのそれぞれには、M個の入力データXが入力される。例えば、行列演算部130aには、重みデータWの1列目の成分W11、W21が入力され、行列演算部130bには、重みデータWの2列目の成分W21、W22が入力される。メモリ制御部11は、行列演算部130a、130bの個数に応じて重みデータWの振り分けを制御することができる。
行列演算部130aは積和演算を行い、行列演算結果Aの成分a1を出力する。一方、行列演算部130bも同様に積和演算を行い、行列演算結果Aの成分a2を出力する。行列演算部130a、130bの演算結果は、活性化関数演算部131に入力されて、活性化関数にかけられ、推論結果Yが決定される。
以上説明したように、第4の実施の形態によれば、K個の行列演算部130a、130bが行列演算をK並列に行うので、行列演算結果Aの1行分の行列演算における繰り返しの計算回数を削減することができる。特に、上述した具体例のようにK=Nの場合、計算の繰り返しが不要となり、行列演算の処理時間を削減することができる。結果として、推論処理装置1の推論処理を高速化できる。
なお、第4の実施の形態に係る複数の行列演算部130a、130bは、第3の実施の形態と組み合わせてもよい。第3の実施の形態で説明した複数の推論演算部13a、13bのそれぞれが、複数の行列演算部130a、130bを備えることにより、推論演算をより高速化することができる。
[第5の実施の形態]
次に、本発明の第5の実施の形態について説明する。なお、以下の説明では、上述した第1から第4の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
次に、本発明の第5の実施の形態について説明する。なお、以下の説明では、上述した第1から第4の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
第1から第4の実施の形態では、行列演算部130が1つの乗算器132と加算器133とを備える場合について説明した。これに対して、第5の実施の形態では、行列演算部130Dが複数の乗算器132a、132bと加算器133a、133とを備え、図6のサンプルコードの破線の枠62で示す行列演算の内部処理を並列に行う。
図18に示すように、行列演算部130Dは、K個(Kは2以上かつM以下の整数)の乗算器132a、132bと加算器133a、133bとを備える。本実施の形態に係る推論処理装置1の他の構成は、第1の実施の形態と同様である(図1)。なお、以下においては、説明の簡単のため、M=3の場合を例に挙げて説明する。
行列演算部130Dは、入力データXと重みデータWとの積和演算を行って、行列演算結果Aの1行分の成分を計算する。行列演算部130Dは、K個の乗算器132a、132bおよび加算器133a、133bにおいて、積和演算をK並列で行う。行列演算では、M個の成分を有する入力データXとデータサイズがM×Nの重みデータWとの積和演算が行われる。
例えば、M=3の場合に、2個(K=2)の乗算器132a、132bおよび加算器133a、133bが設けられている場合を考える。なお、入力データXは[x1,x2,x3]で表される。また、重みデータWは、例えば、3×2(M×N)のデータサイズを有する場合を考える。重みデータWの第1列目は、W11,W21,W31で表される。また、行列演算結果Aは2つの成分を有し、A[a1,a2]で表される。
この場合、例えば、乗算器132aに入力データXの成分x1および重みデータWの成分W11が入力される。一方、乗算器132bには、入力データXの成分x2および重みデータWの成分W21、ならびに入力データXの成分x3および重みデータの成分W31が入力される。
乗算器132a、132bのそれぞれは、乗算結果を出力する。上記具体例においては、乗算器132aは、乗算結果x1W11を出力し、乗算器132bは、乗算結果x2W21と乗算結果x3W31を出力する。加算器133bは、乗算器132bの乗算結果x2W21と乗算結果x3W31とを加算する。加算器133aは、乗算器132aの乗算結果x1W11と加算器133bの加算結果x2W21+x3W31とを加算して、行列演算結果Aの成分a1を出力する。
以上説明したように、第5の実施の形態によれば、行列演算部130Dにおいて、K個の乗算器132a、132bが入力データXと重みデータWとの行列積をK並列で実行するので、行列演算結果Aの各成分を計算する際の繰り返しの計算回数を削減することができる。特に、K=Mの場合、1回の計算で行列演算結果Aの1成分を出力することができる。結果として、行列演算の処理時間を削減し、推論処理装置1における処理を高速化できる。
なお、第5の実施の形態は、第3および第4の実施の形態と組み合わせてもよい。例えば、第3の実施の形態の複数の推論演算部13a、13bそれぞれの行列演算部130が、本実施の形態に係る複数の乗算器132a、132bを備えることで、第3の実施の形態に係る構成のみを採用した場合と比較して、推論演算をより高速化することができる。
また、第4の実施の形態に係る複数の行列演算部130a、130bのそれぞれが本実施の形態に係る複数の乗算器132a、132bを備えることで、第4の実施の形態に係る構成のみを採用した場合と比較して行列演算をより高速化することができる。
第3から第5の実施の形態の構成をそれぞれ単独で採用した場合、例えば、バッチサイズBatch、推論結果Yの成分の数N、および入力データXの成分の数Mの関係が、Batch>B>Mであれば、第3の実施の形態に係る推論処理装置1Bにおいて最も処理が高速化できる。次いで、第4の実施の形態、第5の実施の形態の順に処理を高速化することができる。
なお、本実施の形態においてM=2の場合には、加算器133を1つ設ければよい。その場合においても、乗算処理を並列に実行するので、行列演算を高速化することができる。本実施の形態は特にMが4以上の場合により有効である。
[第6の実施の形態]
次に、本発明の第6の実施の形態について説明する。なお、以下の説明では、上述した第1から第5の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
次に、本発明の第6の実施の形態について説明する。なお、以下の説明では、上述した第1から第5の実施の形態と同じ構成については同一の符号を付し、その説明を省略する。
第1から第5の実施の形態では、重みデータWは予め記憶部12に記憶されている場合について説明した。これに対して、第6の実施の形態に係る推論処理装置1Eは、通信ネットワークNWを介して重みデータWを受信する無線通信部15を備える。
図19に示すように、第6の実施の形態に係る推論処理装置1Eは、バッチ処理制御部10、メモリ制御部11、記憶部12、推論演算部13、および無線通信部15を備える。
無線通信部15は、通信ネットワークNWを介して外部のクラウドサーバなどから、推論処理装置1Eで用いられるニューラルネットワークモデルの重みデータWを受信し、記憶部12に格納する。例えば、推論処理装置1Eで用いるニューラルネットワークモデルの重みデータWを再度学習して更新した場合など、無線通信部15は、更新された重みデータWを無線通信によりダウンロードし、記憶部12に記憶されている古い重みデータWを書き換える。
また、推論処理装置1Eにおいて、別のニューラルネットワークモデルを用いて推論処理を行うような場合に、無線通信部15は、外部のクラウドサーバなどから受信した新しい学習済みのニューラルネットワークの重みデータWを受信し、記憶部12に記憶させる。
このように、第6の実施の形態に係る推論処理装置1Eによれば、ニューラルネットワークモデルの重みデータWが書き換え可能であり、推論処理装置1Eにおいて最適な重みデータWを用いることができるので、入力データXの変動などにより推論精度が低下することを防止できる。
以上、本発明の推論処理装置および推論処理方法における実施の形態について説明したが、本発明は説明した実施の形態に限定されるものではなく、請求項に記載した発明の範囲において当業者が想定し得る各種の変形を行うことが可能である。
例えば、本発明の推論処理装置における推論演算部を除く各機能部は、コンピュータとプログラムによっても実現でき、プログラムを記録媒体に記録することも、ネットワークを通して提供することも可能である。
1…推論処理装置、2…センサ、10…バッチ処理制御部、11…メモリ制御部、12…記憶部、13…推論演算部、120…入力データ格納部、121…学習済みNN格納部、15…無線通信部、130…行列演算部、131…活性化関数演算部、132…乗算器、133…加算器、101…バス、102…プロセッサ、103…主記憶装置、104…通信インターフェース、105…補助記憶装置、106…入出力装置、107…表示装置。
Claims (8)
- 入力データを記憶する第1記憶部と、
ニューラルネットワークの重みを記憶する第2記憶部と、
前記入力データに関する情報に基づいて、バッチサイズを設定するバッチ処理制御部と、
設定された前記バッチサイズに応じた前記入力データを前記第1記憶部から読み出すメモリ制御部と、
前記バッチサイズに応じた前記入力データおよび前記重みを入力として、前記ニューラルネットワークの演算をバッチ処理して、前記入力データの特徴を推論する推論演算部と
を備える推論処理装置。 - 請求項1に記載の推論処理装置において、
前記バッチ処理制御部は、推論演算に用いられるハードウェアリソースに関する情報に基づいて、前記バッチサイズを設定することを特徴とする推論処理装置。 - 請求項1または請求項2に記載の推論処理装置において、
前記推論演算部は、
前記入力データと前記重みとの行列演算を行う行列演算部と、
前記行列演算部による行列演算結果に対して活性化関数を適用する活性化関数演算部と
を備え、
前記行列演算部は、
前記入力データと前記重みとを乗算する乗算器と、
前記乗算器による乗算結果を加算する加算器と
を有する
ことを特徴とする推論処理装置。 - 請求項3に記載の推論処理装置において、
前記行列演算部は、複数具備され、行列演算を並列に行うことを特徴とする推論処理装置。 - 請求項3または請求項4に記載の推論処理装置において、
前記行列演算部は、前記乗算器および前記加算器をそれぞれ複数具備し、乗算および加算を並列に行うことを特徴とする推論処理装置。 - 請求項1から5のいずれか1項に記載の推論処理装置において、
前記推論演算部に入力される前記入力データおよび前記重みのデータタイプを変換するデータ変換部をさらに備えることを特徴とする推論処理装置。 - 請求項1から6のいずれか1項に記載の推論処理装置において、
前記推論演算部は、複数具備され、推論演算を並列に行うことを特徴とする推論処理装置。 - 第1記憶部に記憶された入力データに関する情報に基づいて、バッチサイズを設定する第1ステップと、
設定された前記バッチサイズに応じた前記入力データを前記第1記憶部から読み出す第2ステップと、
前記バッチサイズに応じた前記入力データおよび第2記憶部に記憶されたニューラルネットワークの重みを入力として、前記ニューラルネットワークの演算をバッチ処理して、前記入力データの特徴を推論する第3ステップと
を備える推論処理方法。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US17/293,736 US20210406655A1 (en) | 2019-01-09 | 2019-12-25 | Inference processing device and inference processing method |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2019001590A JP7379821B2 (ja) | 2019-01-09 | 2019-01-09 | 推論処理装置および推論処理方法 |
| JP2019-001590 | 2019-01-09 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020145146A1 true WO2020145146A1 (ja) | 2020-07-16 |
Family
ID=71520421
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/JP2019/050832 Ceased WO2020145146A1 (ja) | 2019-01-09 | 2019-12-25 | 推論処理装置および推論処理方法 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US20210406655A1 (ja) |
| JP (1) | JP7379821B2 (ja) |
| WO (1) | WO2020145146A1 (ja) |
Families Citing this family (16)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11809908B2 (en) | 2020-07-07 | 2023-11-07 | SambaNova Systems, Inc. | Runtime virtualization of reconfigurable data flow resources |
| US20220051086A1 (en) * | 2020-08-17 | 2022-02-17 | Alibaba Group Holding Limited | Vector accelerator for artificial intelligence and machine learning |
| US11782729B2 (en) | 2020-08-18 | 2023-10-10 | SambaNova Systems, Inc. | Runtime patching of configuration files |
| US11392740B2 (en) | 2020-12-18 | 2022-07-19 | SambaNova Systems, Inc. | Dataflow function offload to reconfigurable processors |
| US11182221B1 (en) | 2020-12-18 | 2021-11-23 | SambaNova Systems, Inc. | Inter-node buffer-based streaming for reconfigurable processor-as-a-service (RPaaS) |
| US11237880B1 (en) | 2020-12-18 | 2022-02-01 | SambaNova Systems, Inc. | Dataflow all-reduce for reconfigurable processor systems |
| KR102883349B1 (ko) | 2021-01-25 | 2025-11-07 | 삼성전자주식회사 | 추론 태스크들을 병렬적으로 처리하는 가속기 및 이의 동작 방법 |
| US11782760B2 (en) | 2021-02-25 | 2023-10-10 | SambaNova Systems, Inc. | Time-multiplexed use of reconfigurable hardware |
| US11200096B1 (en) | 2021-03-26 | 2021-12-14 | SambaNova Systems, Inc. | Resource allocation for reconfigurable processors |
| US11544548B2 (en) * | 2021-05-24 | 2023-01-03 | Rebellions Inc. | Processing element and neural processing device including same |
| KR102590993B1 (ko) * | 2021-09-03 | 2023-10-19 | 한국전자기술연구원 | 적응형 배치 프로세싱 방법 및 시스템 |
| CN114118389B (zh) * | 2022-01-28 | 2022-05-10 | 深圳鲲云信息科技有限公司 | 神经网络数据处理方法、设备及存储介质 |
| US12210468B2 (en) | 2023-01-19 | 2025-01-28 | SambaNova Systems, Inc. | Data transfer between accessible memories of multiple processors incorporated in coarse-grained reconfigurable (CGR) architecture within heterogeneous processing system using one memory to memory transfer operation |
| US12380041B2 (en) | 2023-01-19 | 2025-08-05 | SambaNova Systems, Inc. | Method and apparatus for data transfer between accessible memories of multiple processors in a heterogeneous processing system using two memory to memory transfer operations |
| US12229057B2 (en) | 2023-01-19 | 2025-02-18 | SambaNova Systems, Inc. | Method and apparatus for selecting data access method in a heterogeneous processing system with multiple processors |
| CN118069720A (zh) * | 2024-01-31 | 2024-05-24 | 浙江大学计算机创新技术研究院 | 基于postgresql的AI数据库的批量处理方法 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017073000A1 (ja) * | 2015-10-29 | 2017-05-04 | 株式会社Preferred Networks | 情報処理装置及び情報処理方法 |
| WO2017185412A1 (zh) * | 2016-04-29 | 2017-11-02 | 北京中科寒武纪科技有限公司 | 一种支持较少位数定点数的神经网络运算的装置和方法 |
| JP2018173814A (ja) * | 2017-03-31 | 2018-11-08 | 富士通株式会社 | 画像処理装置、画像処理方法、画像処理プログラム、及び教師データ生成方法 |
Family Cites Families (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10019668B1 (en) | 2017-05-19 | 2018-07-10 | Google Llc | Scheduling neural network processing |
| US11580369B2 (en) * | 2017-10-23 | 2023-02-14 | Nec Corporation | Inference apparatus, convolution operation execution method, and program |
| JP6730740B2 (ja) * | 2017-12-25 | 2020-07-29 | 株式会社アクセル | 処理装置、処理方法、処理プログラム、及び暗号処理システム |
| US11755901B2 (en) * | 2017-12-28 | 2023-09-12 | Intel Corporation | Dynamic quantization of neural networks |
| US11461631B2 (en) * | 2018-03-22 | 2022-10-04 | Amazon Technologies, Inc. | Scheduling neural network computations based on memory capacity |
| US11087204B2 (en) * | 2018-04-20 | 2021-08-10 | International Business Machines Corporation | Resistive processing unit with multiple weight readers |
| US11568235B2 (en) * | 2018-11-19 | 2023-01-31 | International Business Machines Corporation | Data driven mixed precision learning for neural networks |
-
2019
- 2019-01-09 JP JP2019001590A patent/JP7379821B2/ja active Active
- 2019-12-25 WO PCT/JP2019/050832 patent/WO2020145146A1/ja not_active Ceased
- 2019-12-25 US US17/293,736 patent/US20210406655A1/en not_active Abandoned
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017073000A1 (ja) * | 2015-10-29 | 2017-05-04 | 株式会社Preferred Networks | 情報処理装置及び情報処理方法 |
| WO2017185412A1 (zh) * | 2016-04-29 | 2017-11-02 | 北京中科寒武纪科技有限公司 | 一种支持较少位数定点数的神经网络运算的装置和方法 |
| JP2018173814A (ja) * | 2017-03-31 | 2018-11-08 | 富士通株式会社 | 画像処理装置、画像処理方法、画像処理プログラム、及び教師データ生成方法 |
Non-Patent Citations (5)
| Title |
|---|
| IWAMURO, SHINYA; AONO, MASAKI: "Time Series Classification based on Image Encoding Considering Anisotropy", IEICE TECHNICAL REPORT, vol. 117, no. 210 (IBISML2017-28), 8 September 2017 (2017-09-08), pages 137 - 142, XP009522336, ISSN: 0913-5685 * |
| SANSHIN KIBUKI; IGARASHI OHHAMA; HIROKI; KIKUCHI RYO: "Designs and Implementations of Efficient and Accurate Secret Logistic Regression", PROCEEDINGS OF COMPUTER SECURITY SYMPOSIUM 2018, vol. 2018, no. 2, 15 October 2018 (2018-10-15), pages 1229 - 1236, XP009522747, ISSN: 1882-0840 * |
| SHIMJI TAKENAKA, SHIBATA SYUNSUKE ,TAGUCHI YUTA, TAKEDA HIROAKI, TERADA TORU, GOUDA YOUICH: "Highly Efficient Infrastructure for R&D by Utilizing Distributed Deep Learning on a Supercomputer", PANASONIC TECHNICAL JOURNAL, vol. 64, no. 1, 15 May 2018 (2018-05-15), pages 39 - 44, XP055723408 * |
| YURI NISHIKAWA, HITOSHI SATO, JUN OZAWA: "Performance Evaluation of Object Detection Algorithm YOLO using Distributed Deep Learning", vol. 2018-HPC-166, no. 12, 20 September 2018 (2018-09-20), JP, pages 1 - 6, XP009522367, ISSN: 2188-8841, Retrieved from the Internet <URL:http://id.nii.ac.jp/1001/00191331/> [retrieved on 20200221] * |
| YUYA WATANABE: "The judgment of hate speech videos by deep learning", PROCEEDINGS OF DEIM FORUM 2017, 31 March 2017 (2017-03-31), pages 1 - 7, XP055723398 * |
Also Published As
| Publication number | Publication date |
|---|---|
| JP7379821B2 (ja) | 2023-11-15 |
| JP2020112901A (ja) | 2020-07-27 |
| US20210406655A1 (en) | 2021-12-30 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2020145146A1 (ja) | 推論処理装置および推論処理方法 | |
| US12165045B2 (en) | Hardware implementation of a deep neural network with variable output data format | |
| KR102516092B1 (ko) | 신경망 프로세서의 벡터 컴퓨테이션 유닛 | |
| US12182687B2 (en) | Data representation for dynamic precision in neural network cores | |
| CN111931925B (zh) | 基于fpga的二值化神经网络的加速系统 | |
| TWI796286B (zh) | 一種機器學習系統的訓練方法和訓練系統 | |
| CN112119407B (zh) | 由补偿指令使能的低精度深度神经网络 | |
| US20240220572A1 (en) | Pipeline-parallel-dataflow artificial intelligence system for accelerating self-attention computations | |
| CN102087740A (zh) | 用于通用计算的纹理单元 | |
| JP7215572B2 (ja) | 推論処理装置および推論処理方法 | |
| CN111798263A (zh) | 一种交易趋势的预测方法和装置 | |
| TW202311984A (zh) | 用於具有不同的精度之按位元乘法之混合信號電路 | |
| CN114611685A (zh) | 神经网络模型中的特征处理方法、介质、设备和程序产品 | |
| US20250245286A1 (en) | In-memory matrix multiplication with binary complement inputs | |
| JP7226541B2 (ja) | 推論処理装置および推論処理方法 | |
| CN114491167B (zh) | 神经网络模型的运行方法、可读介质和电子设备 | |
| US20250355625A1 (en) | Efficient fixed-point digital logic hardware for high-precision computation | |
| CN111340182A (zh) | 一种输入特征逼近的低复杂度cnn训练方法与装置 | |
| CN119380744B (zh) | 一种音频数据处理方法、系统、设备及介质 | |
| CN114676827A (zh) | 模型加速方法、装置、集成电路和存储介质 | |
| KR102482728B1 (ko) | 비트 시리얼 연산 방법 및 컴퓨터 기록 매체 | |
| TWI805257B (zh) | 根據強化學習的預測來優化資源配置的方法 | |
| US20240361797A1 (en) | Special-Purpose Compute Hardware for Efficient Implementation of Programmable Look-Up-Tables | |
| US20250068895A1 (en) | Quantization method and apparatus for artificial neural network | |
| US20260079704A1 (en) | Accelerating a fully homomorphic encryption (fhe) operation with an on-chip systolic array |
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: 19908293 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19908293 Country of ref document: EP Kind code of ref document: A1 |