WO2024014002A1 - 推論処理装置、推論処理方法、及び推論処理プログラム - Google Patents

推論処理装置、推論処理方法、及び推論処理プログラム Download PDF

Info

Publication number
WO2024014002A1
WO2024014002A1 PCT/JP2022/027940 JP2022027940W WO2024014002A1 WO 2024014002 A1 WO2024014002 A1 WO 2024014002A1 JP 2022027940 W JP2022027940 W JP 2022027940W WO 2024014002 A1 WO2024014002 A1 WO 2024014002A1
Authority
WO
WIPO (PCT)
Prior art keywords
convolution
sublayer
unit
result
addition
Prior art date
Application number
PCT/JP2022/027940
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 PCT/JP2022/027940 priority Critical patent/WO2024014002A1/ja
Publication of WO2024014002A1 publication Critical patent/WO2024014002A1/ja

Links

Classifications

    • 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

Definitions

  • the disclosed technology relates to an inference processing device, an inference processing method, and an inference processing program that perform convolution processing in a neural network.
  • a network model is composed of multiple layers, and a convolutional layer performs convolution processing.
  • the input feature map output from the previous layer, etc., and kernel data, which is a weighting coefficient, are input.
  • a bias is added to the product-sum operation of the input feature map and the kernel data, and an activation function process is performed to obtain an output feature map as an output.
  • the network model may be divided and processed. Specifically, by dividing the network model, the kernel data is divided, and each of the divided kernel data can be loaded onto the memory at the same time.
  • Non-Patent Document 1 discloses a technique in which the feature map of each layer is divided into two in the channel direction and learning is performed by operating two pieces of hardware in parallel.
  • the divided network model and kernel data may be processed in parallel by separate hardware, or may be processed sequentially by the same hardware. For example, when executing CNN inference processing sequentially on the same hardware, divide the network model into n pieces in the input channel direction, store only one kernel data among the n pieces in memory, and If the convolution process is executed sequentially using software, the size of the kernel data that must be stored simultaneously in memory can be reduced to 1/n compared to the case where the network model is not divided.
  • the hardware that executes CNN inference processing often has a multi-stage memory configuration consisting of high-speed, expensive, and low-capacity memory and slow, inexpensive, and large-capacity memory.
  • an LSI Large Scale Integration
  • an SRAM Static Random Access Memory
  • a low-speed, inexpensive, and large-capacity external memory such as a DRAM (Dynamic Random Access Memory) is often included externally to the LSI or the like.
  • the size of the internal memory can be reduced by storing all kernel data in the external memory and reading only the 1/n size kernel data required for the current process from the external memory as appropriate. I can do it.
  • the disclosed technology has been developed in view of the above points, and provides an inference processing device and an inference processing method that can perform general-purpose convolution processing while suppressing increases in hardware resources and processing time. , and an inference processing program.
  • a first aspect of the present disclosure is an inference processing device that includes a dividing unit that divides a layer of a convolutional neural network into a plurality of sublayers in a channel direction, and outputs a convolution result by performing convolution processing for each sublayer.
  • a convolution unit and an adder for adding a bias to the convolution result each time the convolution process is executed, adding an intermediate value obtained by cumulatively adding the convolution results up to the previous sublayer to the convolution result.
  • an activation unit that inputs the addition result obtained by adding the convolution result of the last sublayer in which the convolution process was last performed to the activation function.
  • a second aspect of the present disclosure is an inference processing method, in which a dividing unit divides a layer of a convolutional neural network into a plurality of sublayers in the channel direction, and a convolution unit performs convolution processing for each sublayer.
  • the adder outputs the convolution result, and the adder adds a bias to the convolution result each time the convolution process is executed.
  • the addition result is output by adding it to the convolution result, and the activation unit inputs the addition result obtained by adding the convolution result of the last sublayer in which the convolution process was last performed to the activation function.
  • a third aspect of the present disclosure is an inference processing program that causes a computer to function as each part of the inference processing device of the first aspect.
  • FIG. 1 is a schematic diagram showing an example of a hardware configuration of an inference processing device according to an embodiment
  • FIG. 1 is a block diagram illustrating an example of a functional configuration of an inference processing device according to an embodiment.
  • FIG. FIG. 2 is a schematic diagram illustrating an example of the flow of convolution processing performed on each sublayer when one layer is divided into three sublayers according to the embodiment.
  • FIG. 2 is a schematic diagram illustrating an example of the flow of processing in which convolution results are added by a bias adder according to the embodiment.
  • FIG. 3 is a schematic diagram showing an example of a function for inputting addition results according to the embodiment.
  • FIG. 3 is a schematic diagram illustrating an example of the flow of processing in which addition results are added by a bias adder according to the embodiment.
  • FIG. 1 is a schematic diagram showing an example of a hardware configuration of an inference processing device according to an embodiment
  • FIG. 1 is a block diagram illustrating an example of a functional configuration of an inference processing device according to
  • FIG. 2 is a schematic diagram for explaining an example of bit precision according to the embodiment.
  • FIG. 2 is a schematic diagram illustrating an example of setting of undivided layers according to the embodiment.
  • FIG. 3 is a schematic diagram illustrating an example of the settings of divided layers according to the embodiment.
  • 7 is a flowchart illustrating an example of inference processing in the inference processing device according to the embodiment.
  • FIG. 2 is a schematic diagram illustrating an example of processing performed in the conventional technology when data for 32 channels can be stored in the internal memory.
  • the inference processing device 10 includes an LSI 20 and an external memory 30. Each configuration is communicably connected to each other via a bus 19.
  • the external memory 30 serving as a storage unit is an external memory of the LSI 20, and a DRAM is applied, for example.
  • the LSI 20 includes a CPU (Central Processing Unit) 21, a ROM (Read Only Memory) 22, an internal memory 23, a convolution arithmetic unit 24, a bias adder 25, and an activation arithmetic unit 26.
  • CPU Central Processing Unit
  • ROM Read Only Memory
  • the CPU 21 is a central processing unit that executes various programs and controls various parts. That is, the CPU 21 reads a program from the ROM 22 and executes the program using the internal memory 23 as a work area. The CPU 21 controls each of the above components and performs various arithmetic operations according to programs stored in the ROM 22.
  • the ROM 22 stores an inference processing program.
  • the inference processing program may be one program, or may be a program group composed of a plurality of programs or modules.
  • the ROM 22 stores various programs and various data.
  • the internal memory 23 temporarily stores programs or data as a work area. For example, SRAM is applied as the internal memory 23.
  • the convolution computing unit 24 is a computing unit that executes convolution processing.
  • the bias adder 25 is an adder that adds a bias to the convolution result.
  • the activation computing unit 26 is a computing unit that applies an activation function to an input value.
  • the inference processing device 10 includes a division section 101, a convolution section 102, an addition section 103, and an activation section 104.
  • Each functional configuration is realized by the CPU 21 reading out the inference processing program stored in the ROM 22, loading it into the internal memory 23, and executing it.
  • the dividing unit 101 divides the layer of the convolutional neural network into a plurality of sublayers in the channel direction. Specifically, dividing section 101 divides the layer stored in external memory 30 into a plurality of sublayers in the channel direction. The dividing unit 101 divides the layer by using the number of input channels that can be stored in the internal memory 23 as one unit. For example, if the capacity of the internal memory 23 is 4MByte, a certain layer has 3x3 kernels, 2048 input channels, and 1024 output channels, and the precision of the layer is 8bit, the kernel data is 3*3*2048*1024* Since 8 bits is 18MByte, the dividing unit 101 divides it into five or more sublayers in 18/4.
  • dividing section 101 suppresses the number of input channels per sublayer to 455 or less. Then, the dividing unit 101 passes one divided sublayer to the convolution unit 102.
  • the convolution unit 102 outputs convolution results by performing convolution processing for each sublayer passed from the division unit 101. Specifically, the convolution unit 102 stores one sublayer read from the external memory 30 in the internal memory 23, and causes the convolution calculator 24 to perform convolution processing on the stored sublayer. Then, the convolution unit 102 passes the convolution result (that is, the feature map that is an intermediate output output from the sublayer) to the addition unit 103.
  • FIG. 3 shows the flow of convolution processing performed on each sublayer when one layer is divided into three sublayers.
  • the sublayer that performs convolution processing first is referred to as the first sublayer
  • the sublayer that performs convolution processing last is referred to as the last sublayer
  • sublayers other than the first sublayer and the last sublayer are referred to as intermediate sublayers.
  • the convolution unit 102 reads sublayer 0 as the first sublayer from the external memory 30 and stores it in the internal memory 23. Then, the convolution unit 102 executes convolution processing on the sublayer 0 using the convolution arithmetic unit 24, and passes the result to the bias adder 25. Further, the convolution unit 102 reads sublayer 1 as an intermediate sublayer from the external memory 30 and stores it in the internal memory 23. Then, the convolution unit 102 executes convolution processing on the sublayer 1 using the convolution arithmetic unit 24, and transfers the result to the bias adder 25. Further, the convolution unit 102 reads sublayer 2 as the last sublayer from the external memory 30 and stores it in the internal memory 23.
  • the convolution unit 102 executes convolution processing on the sublayer 2 using the convolution arithmetic unit 24, and transfers the result to the bias adder 25. Note that when the dividing unit 101 divides one layer into five sublayers, there is one first sublayer, three middle sublayers, and one last sublayer.
  • the sublayer read out from the external memory 30 by the convolution unit 102 will be referred to as the current sublayer.
  • the sublayer read out from the external memory 30 by the convolution unit 102 immediately before the current sublayer is referred to as the immediately preceding sublayer.
  • the addition unit 103 calculates the addition result by adding the intermediate value obtained by cumulatively adding the convolution results up to the previous sub-layer to the convolution result using the bias adder 25. Output. Specifically, when the convolution result of the first sublayer is received, the addition unit 103 adds the bias read from the external memory 30 to the convolution result of the first sublayer using the bias adder 25 . Then, the addition unit 103 passes the addition result of the convolution result of the first sublayer and the bias to the activation unit 104.
  • the addition unit 103 adds the convolution result of the current sublayer to the addition result up to the immediately preceding sublayer stored in the external memory 30. Add the results.
  • the addition result up to the immediately preceding sublayer is an intermediate value obtained by cumulatively adding convolution results up to the immediately previous sublayer as addition results stored in the external memory 30 by the activation unit 104, which will be described later.
  • the addition unit 103 passes the addition result of the addition result up to the immediately preceding sublayer and the convolution result of the current sublayer to the activation unit 104.
  • the addition unit 103 sets the addition result up to the immediately preceding sublayer by overwriting the location where the bias is originally set in the bias adder 25. This is because the bias only needs to be added once, so if the bias can be added to the convolution result of the first sublayer, there is no need to add the bias from the second sublayer onwards. By performing addition between sublayers using the existing bias adder 25, convolution results can be obtained without adding hardware resources.
  • FIG. 4 shows the flow of processing in which the convolution results are added by the bias adder 25.
  • the addition unit 103 uses the bias adder 25 to add the bias read from the external memory 30 to the convolution result of the first sublayer. Then, the adding unit 103 uses the bias adder 25 to add the addition result up to the immediately preceding sublayer read from the external memory 30 to the convolution result of the intermediate sublayer. Further, the addition unit 103 uses the bias adder 25 to add the addition results up to the immediately preceding sublayer read from the external memory 30 to the convolution result of the last sublayer.
  • the activation unit 104 When the activation unit 104 receives the addition result obtained by adding the convolution results of the last sublayer, the activation unit 104 inputs the addition result to an activation function (for example, a relu function, etc.), and stores the calculated feature map in the external memory 30.
  • an activation function for example, a relu function, etc.
  • the feature map output by the activation unit 104 will be referred to as an output feature map (ofmap).
  • FIG. 5 shows a function that inputs the addition result.
  • the activation unit 104 converts the value obtained by adding the convolution result of the first sublayer and the bias into a linear function with a proportional constant of 1 and an intercept of 0 using the activation arithmetic unit 26. and store the addition result in the external memory 30. Then, the activation unit 104 inputs the value obtained by adding the convolution result of the intermediate sublayer and the addition result up to the immediately preceding sublayer to the linear function in the activation arithmetic unit 26, and stores the addition result in the external memory 30. overwrite.
  • the activation unit 104 inputs the value obtained by adding the convolution result of the last sublayer and the addition result up to the immediately preceding sublayer to the activation function in the activation arithmetic unit 26 to obtain the calculated final output feature.
  • the map is stored in external memory 30.
  • FIG. 6 shows the flow of processing in which the addition results are added by the bias adder 25.
  • the activation unit 104 receives the addition result obtained by adding the convolution results of the first sublayer or the addition result obtained by adding the convolution results of the intermediate sublayer, the activation unit 104 stores the addition result as it is in the external memory. 30.
  • the addition unit 103 uses the bias adder 25 to add the addition result read from the external memory 30 to the convolution result of the intermediate sublayer or the convolution result of the last sublayer.
  • the activation unit 104 inputs the addition result obtained by adding the convolution results of the last sublayer to the activation function, and stores the final output feature map in the external memory 30.
  • the addition unit 103 uses the bit precision of the addition result to be output, and the activation unit 104 adds the convolution result of the last sublayer.
  • the bit precision is higher than that of the value calculated by inputting the activation function to the addition result.
  • the addition unit 103 outputs the bit precision as input from the convolution unit 102.
  • the activation unit 104 changes the bit precision of the addition result stored in the external memory 30 to the addition result obtained by adding the convolution results of the last sublayer. The bit precision is higher than that of the value calculated by inputting the activation function.
  • the activation unit 104 outputs the bit precision as input from the addition unit 103.
  • the activation unit 104 stores the addition result input from the addition unit 103 in the external memory 30 instead of the actual output feature map until the addition result obtained by adding the convolution results of the last sublayer is input. This is because if the bit precision of the output of sublayers other than the last sublayer is made the same as the bit precision of the output of the last sublayer, the calculation precision will be lower than when the layers are not divided. Thereby, there is no need to change bit precision at the expense of calculation precision, and it is possible to reduce the amount of data transferred to the external memory 30.
  • the inference processing device 10 holds the intermediate result of the convolution process as 16 bits or more instead of 8 bits. This is because if the inference processing device 10 reduces 16 bits to 8 bits each time one convolution is performed and then cumulatively adds the 8 bits as is, the calculation accuracy will be greatly degraded. Then, after the cumulative addition is completed (or even later, after adding the bias or inputting it to the activation function), the inference processing device 10 reduces the intermediate result of the convolution process to the bit precision of the output feature map. Specifically, in the example described above, the inference processing device 10 reduces the intermediate result of the convolution process from 16 bits to 8 bits.
  • FIG. 7 shows a schematic diagram for explaining bit accuracy.
  • the addition unit 103 outputs the addition result obtained by adding the convolution result of the first sublayer and the addition result obtained by adding the convolution result of the intermediate sublayer from the bias adder 25 with the bit precision unchanged. It is delivered to the activation arithmetic unit 26. Then, the activation unit 104 transfers the addition result obtained by adding the convolution results of the first sublayer and the convolution result of the intermediate sublayer from the activation arithmetic unit 26 to the external memory 30 with the bit precision unchanged. I remember it. Then, the addition unit 103 adds the addition result of the immediately preceding sublayer stored by the activation unit 104 with the bit precision unchanged, to the convolution result of the last sublayer.
  • FIG. 8 shows an example of settings for layer 0 and layer 1 that are not divided.
  • FIG. 9 shows an example of settings for layer 0 and sublayer 0, sublayer 1, and sublayer 2 that are divided from layer 1.
  • Sublayer 0 is the first sublayer
  • sublayer 1 is the middle sublayer
  • sublayer 2 is the last sublayer.
  • functions, biases, and the like are set in each sublayer similarly to undivided layers. Therefore, the CNN hardware can treat the sublayers as one layer and process them in a general-purpose manner. This makes it possible to perform general-purpose convolution processing while suppressing increases in hardware resources and processing time.
  • sublayer 0, sublayer 1, and sublayer 2 are all set as 1000 input channels. Set. Note that in the example shown in FIG. 9, the input channels are equally divided into three, but the invention is not limited to this example. The number of input channels for one sublayer does not need to be divided evenly as long as the data size can be stored in the internal memory 23.
  • kernel data as shown in Figure 8, if kernel 1 is set in layer 1 before division, as shown in Figure 9, for sublayer 0, the input channel of the first 1/3 of kernel 1 is set. For sublayer 1, the corresponding data is set to the middle 1/3 input channel of kernel 1, and for sublayer 2, the data corresponding to the last 1/3 input channel of kernel 1 is set. .
  • bias 1 is set for layer 1 before division, as shown in Figure 9, bias 1, which is the actual bias, is set for sublayer 0, and bias 1 is set for sublayer 1, as shown in Figure 9.
  • the addition results up to sublayer 0 are set, and for sublayer 2, the addition results up to sublayer 1 are set.
  • the address of the relevant data on the external memory 30 may be designated as the read address.
  • bit precision of the output feature map if b2 is set for layer 1 before division, as shown in FIG. 8, then b2 is also set for sublayer 2, as shown in FIG. Then, b_tmp is set in sublayer 0 and sublayer 1. b_tmp is set to the precision during convolution processing, rather than the precision of the original output feature map, in order to suppress deterioration in calculation precision.
  • FIG. 10 is a flowchart showing the flow of inference processing by the inference processing device 10. Inference processing is performed by the CPU 21 reading out the inference processing program from the ROM 22, loading it onto the internal memory 23, and executing it.
  • step S100 the CPU 21, as the dividing unit 101, divides the layer into a plurality of sublayers in the channel direction.
  • step S101 the CPU 21, as the convolution unit 102, outputs a convolution result by executing a convolution process on the received one sublayer.
  • step S102 the CPU 21, as the addition unit 103, determines whether the output convolution result is the convolution result of the first sublayer. If the output convolution result is the first sublayer (step S102: YES), the CPU 21 moves to step S103. On the other hand, if the output convolution result is not the first sublayer (step S102: NO), the CPU 21 moves to step S104.
  • step S103 the CPU 21, as the addition unit 103, adds a bias to the output convolution result of the first sublayer.
  • step S104 the CPU 21, as the addition unit 103, adds the addition result to the output convolution results of sublayers other than the first sublayer.
  • step S105 the CPU 21, as the activation unit 104, determines whether the output addition result is an addition result obtained by adding the convolution result of the last sublayer.
  • step S105: YES the CPU 21 moves to step S106.
  • step S105: NO the CPU 21 moves to step S108.
  • step S106 the CPU 21, as the activation unit 104, inputs the addition result obtained by adding the convolution results of the last sublayer to the activation function.
  • step S107 the CPU 21, as the activation unit 104, stores the final output feature map in the external memory 30, and ends this inference process.
  • step S108 the CPU 21, as the activation unit 104, inputs the received addition result into a linear function with a proportionality constant of 1 and an intercept of 0.
  • step S109 the CPU 21, as the activation unit 104, stores the addition result in the external memory 30, and returns to step S101.
  • FIG. 11 shows the processing performed in the prior art when data for 32 channels can be stored in the internal memory.
  • kernel data is divided into 32 input channels and sequentially read into internal memory to perform convolution processing.
  • the convolution result is then stored in external memory.
  • the inference processing device 10 divides a layer into a plurality of sublayers and calculates the final calculation result using an existing calculation circuit, thereby reducing hardware resources and processing time. It is possible to perform general-purpose convolution processing while suppressing the increase.
  • various processes that the CPU reads and executes software (programs) in the above embodiments may be executed by various processors other than the CPU.
  • the processor in this case is a PLD (Programmable Logic Device) whose circuit configuration can be changed after manufacturing, such as an FPGA (Field-Programmable Gate Array), and an ASIC (Application Specific Intel).
  • FPGA Field-Programmable Gate Array
  • ASIC Application Specific Intel
  • An example is a dedicated electric circuit that is a processor having a specially designed circuit configuration.
  • the inference processing may be executed by one of these various processors, or by a combination of two or more processors of the same type or different types (for example, multiple FPGAs, a combination of a CPU and an FPGA, etc.). ) can also be executed.
  • the hardware structure of these various processors is, more specifically, an electric circuit that is a combination of circuit elements such as semiconductor elements.
  • the inference program is stored (installed) in the ROM 22 in advance, but the present invention is not limited to this.
  • the program can be installed on CD-ROM (Compact Disk Read Only Memory), DVD-ROM (Digital Versatile Disk Read Only Memory), and USB (Universal Serial Bus) stored in a non-transitory storage medium such as memory It may be provided in the form of Further, the program may be downloaded from an external device via a network.
  • a reasoning device memory and at least one processor connected to the memory; including;
  • the processor includes: Divide the convolutional neural network layer into multiple sublayers in the channel direction, outputting a convolution result by executing convolution processing for each sublayer, Each time the convolution process is executed, an adder for adding a bias to the convolution result calculates the addition result by adding an intermediate value obtained by cumulatively adding the convolution results up to the previous sublayer to the convolution result. output, inputting the addition result obtained by adding the convolution result of the last sublayer on which the convolution process was finally performed to an activation function;
  • An inference device configured as follows.
  • a non-transitory storage medium storing a program executable by a computer to perform inference processing,
  • the inference processing is Divide the convolutional neural network layer into multiple sublayers in the channel direction, outputting a convolution result by executing convolution processing for each sublayer,
  • an adder for adding a bias to the convolution result calculates the addition result by adding an intermediate value obtained by cumulatively adding the convolution results up to the previous sublayer to the convolution result. output, inputting the addition result obtained by adding the convolution result of the last sublayer on which the convolution process was finally performed to an activation function;
  • Non-transitory storage medium Non-transitory storage medium.

Landscapes

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

Abstract

推論処理装置は、畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割する分割部と、サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力する畳み込み部と、畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの畳み込み結果を累積加算した中間値を畳み込み結果に加算することで加算結果を出力する加算部と、最後に畳み込み処理が実行された最後のサブレイヤの畳み込み結果を加算した加算結果を活性化関数に入力する活性化部と、を備える。

Description

推論処理装置、推論処理方法、及び推論処理プログラム
 開示の技術は、ニューラルネットワークにおける畳み込み処理を行う推論処理装置、推論処理方法、及び推論処理プログラムに関する。
 CNN(Convolutional Neural Network)において、ネットワークモデルは複数のレイヤで構成され、畳み込み層(Convolutional Layer)で畳み込み処理を行う。畳み込み処理では、前のレイヤなどで出力された入力特徴マップと、重み係数であるカーネルデータとを入力とする。そして、畳み込み処理では、入力特徴マップとカーネルデータとで積和演算したものにバイアスを加算し、活性化関数処理を行うことで、出力特徴マップを出力として取得する。
 CNNの推論処理又は学習処理を行う場合において、ネットワークモデルのカーネルデータのデータサイズが相対的に大きい場合、一度に全てのカーネルデータを計算機又は専用ハードウェアのメモリ上に載せることができないことがある。そこで、ネットワークモデルを分割して処理することがある。具体的に、ネットワークモデルを分割することで、カーネルデータを分割し、分割されたそれぞれのカーネルデータを一度にメモリ上に載せることができるようにする。
 例えば、非特許文献1では、各レイヤの特徴マップをチャネル方向に2分割し、2台のハードウェアを並列に動作させて学習を行う技術が開示されている。分割されたネットワークモデル及びカーネルデータは、別々のハードウェアで並列に処理してもよいし、同一のハードウェアで順番に処理してもよい。例えば、同一のハードウェアで順番にCNNの推論処理を実行する場合、ネットワークモデルを入力チャネル方向にn個に分割し、n個のうち1個のカーネルデータのみをメモリに格納し、同一のハードウェアで順番に畳み込み処理を実行すれば、メモリに同時に格納する必要のあるカーネルデータのサイズは、ネットワークモデルを分割しない場合に比較して1/nですむ。
 ここで、CNNの推論処理を実行するハードウェアは、高速、高価、かつ低容量のメモリと、低速、安価、かつ大容量のメモリとで構成された、複数段階のメモリ構成を取ることが多い。例えば専用ハードウェアの場合、LSI(Large Scale Integration)等の内部にSRAM(Static Random Access Memory)等の高速、高価、かつ低容量の内部メモリを含む事が多い。また、LSI等の外部にDRAM(Dynamic Random Access Memory)等の低速、安価、かつ大容量の外部メモリを含む事が多い。この場合、外部メモリに全てのカーネルデータを記憶し、内部メモリに現在の処理で必要となる1/nのサイズのカーネルデータだけを適宜外部メモリから読み出すことで、内部メモリのサイズを低減することができる。
Krizhevsky, Alex; Sutskever, Ilya; Hinton, Geoffrey E. (2017-05-24). "ImageNet classification with deep convolutional neural networks". Communications of the ACM 60 (6): 84-90. doi:10.1145/3065386. ISSN 0001-0782.
 しかし、ネットワークモデルを入力チャネルで複数に分割し、同一のハードウェアで順番に畳み込み層の推論処理をする場合、分割した個数分の畳み込み結果を最終的に統合するための加算回路を追加する必要がある。また、全ての入力チャネルが加算された畳み込み結果に対して活性化関数を適用する必要もある。また、一度外部メモリに記憶されている分割した個数分の畳み込み結果を、最後に再び読み込んでから加算回路において加算処理を行うため、処理時間が増加する可能性がある。
 開示の技術は、上記の点に鑑みてなされたものであり、ハードウェア資源及び処理時間の増加を抑えつつ、汎用的に対応可能な畳み込み処理を行うことができる、推論処理装置、推論処理方法、及び推論処理プログラムを提供することを目的とする。
 本開示の第1態様は、推論処理装置であって、畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割する分割部と、前記サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力する畳み込み部と、前記畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの前記畳み込み結果を累積加算した中間値を前記畳み込み結果に加算することで加算結果を出力する加算部と、最後に前記畳み込み処理が実行された最後のサブレイヤの前記畳み込み結果を加算した前記加算結果を活性化関数に入力する活性化部と、を含む。
 本開示の第2態様は、推論処理方法であって、分割部が、畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割し、畳み込み部が、前記サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力し、加算部が、前記畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの前記畳み込み結果を累積加算した中間値を前記畳み込み結果に加算することで加算結果を出力し、活性化部が、最後に前記畳み込み処理が実行された最後のサブレイヤの前記畳み込み結果を加算した前記加算結果を活性化関数に入力する。
 本開示の第3態様は、推論処理プログラムであって、コンピュータを、上記第1態様の推論処理装置の各部として機能させるためのプログラムである。
 開示の技術によれば、ハードウェア資源及び処理時間の増加を抑えつつ、汎用的に対応可能な畳み込み処理を行うことができる。
実施形態に係る推論処理装置のハードウェア構成の一例を示す模式図である。 実施形態に係る推論処理装置の機能構成の一例を示すブロック図である。 実施形態に係る1つのレイヤから3つのサブレイヤに分割した場合に、各サブレイヤに実行する畳み込み処理の流れの一例を示す模式図である。 実施形態に係る畳み込み結果をバイアス用加算器で加算する処理の流れの一例を示す模式図である。 実施形態に係る加算結果を入力する関数の一例を示す模式図である。 実施形態に係る加算結果をバイアス用加算器で加算する処理の流れの一例を示す模式図である。 実施形態に係るビット精度の一例について説明するための模式図である。 実施形態に係る分割されていないレイヤの設定の一例を示すための模式図である。 実施形態に係る分割されているレイヤの設定の一例を示すための模式図である。 実施形態に係る推論処理装置における推論処理の一例を示すフローチャートである。 内部メモリに32チャネル分のデータが格納できる場合に、従来技術で実行される処理の一例を示すための模式図である。
 以下、開示の技術の実施形態の一例を、図面を参照しつつ説明する。なお、各図面において同一又は等価な構成要素及び部分には同一の参照符号を付与している。また、図面の寸法比率は、説明の都合上誇張されており、実際の比率とは異なる場合がある。
 まず、本実施形態に係る推論処理装置10のハードウェア構成を説明する。図1に示すように、推論処理装置10は、LSI20、及び外部メモリ30を有する。各構成は、バス19を介して相互に通信可能に接続されている。
 記憶部としての外部メモリ30は、LSI20の外部メモリであり、例えばDRAMが適用される。
 LSI20はCPU(Central Processing Unit)21、ROM(Read Only Memory)22、内部メモリ23、畳み込み用演算器24、バイアス用加算器25、及び活性化用演算器26を有する。
 CPU21は、中央演算処理ユニットであり、各種プログラムを実行したり、各部を制御したりする。すなわち、CPU21は、ROM22からプログラムを読み出し、内部メモリ23を作業領域としてプログラムを実行する。CPU21は、ROM22に記憶されているプログラムに従って、上記各構成の制御及び各種の演算処理を行う。本実施形態では、ROM22には、推論処理プログラムが格納されている。推論処理プログラムは、1つのプログラムであってもよいし、複数のプログラム又はモジュールで構成されるプログラム群であってもよい。
 ROM22は、各種プログラム及び各種データを格納する。内部メモリ23は、作業領域として一時的にプログラム又はデータを記憶する。例えば内部メモリ23として、SRAMが適用される。
 畳み込み用演算器24は、畳み込み処理を実行する演算器である。バイアス用加算器25は、畳み込み結果にバイアスを加算する加算器である。活性化用演算器26は、入力値に活性化関数を適用する演算器である。
 次に、推論処理装置10の機能構成について説明する。図2に示すように、推論処理装置10は、分割部101、畳み込み部102、加算部103、及び活性化部104を備えている。各機能構成は、CPU21がROM22に記憶された推論処理プログラムを読み出し、内部メモリ23に展開して実行することにより実現される。
 分割部101は、畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割する。具体的に、分割部101は、外部メモリ30に記憶されたレイヤをチャネル方向で複数のサブレイヤに分割する。分割部101は、内部メモリ23に記憶できる範囲の入力チャネル数を1単位として、レイヤを分割する。例えば、内部メモリ23の容量が4MByteで、あるレイヤが3×3カーネル、2048入力チャネル、及び1024出力チャネルで、当該レイヤの精度が8bitである場合、カーネルデータは3*3*2048*1024*8bitで18MByteとなるので、分割部101は、18/4で5つ以上のサブレイヤに分割する。そして、(4*8bit*1024*1024)/(3*3*1024*8bit)は455であるため、分割部101は、1つのサブレイヤあたりの入力チャネル数を455以下に抑える。そして、分割部101は、分割した1つのサブレイヤを畳み込み部102に受け渡す。
 畳み込み部102は、分割部101から受け渡されたサブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力する。具体的に、畳み込み部102は、外部メモリ30から読み出した1つのサブレイヤを内部メモリ23に格納し、当該格納したサブレイヤに畳み込み用演算器24で畳み込み処理を実行する。そして、畳み込み部102は、畳み込み結果(すなわち、サブレイヤから出力される中間出力である特徴マップ)を加算部103に受け渡す。
 図3に、1つのレイヤから3つのサブレイヤに分割した場合に、各サブレイヤに実行する畳み込み処理の流れを示す。以下では、最初に畳み込み処理を実行するサブレイヤを最初のサブレイヤといい、最後に畳み込み処理を実行するサブレイヤを最後のサブレイヤといい、最初のサブレイヤと最後のサブレイヤ以外のサブレイヤを中間のサブレイヤという。
 図3に示すように、畳み込み部102は、外部メモリ30から最初のサブレイヤとしてのサブレイヤ0を読み出し、内部メモリ23に格納する。そして、畳み込み部102は、サブレイヤ0に畳み込み用演算器24で畳み込み処理を実行し、バイアス用加算器25に受け渡す。また、畳み込み部102は、外部メモリ30から中間のサブレイヤとしてのサブレイヤ1を読み出し、内部メモリ23に格納する。そして、畳み込み部102は、サブレイヤ1に畳み込み用演算器24で畳み込み処理を実行し、バイアス用加算器25に受け渡す。また、畳み込み部102は、外部メモリ30から最後のサブレイヤとしてのサブレイヤ2を読み出し、内部メモリ23に格納する。そして、畳み込み部102は、サブレイヤ2に畳み込み用演算器24で畳み込み処理を実行し、バイアス用加算器25に受け渡す。なお、分割部101が1つのレイヤを5つのサブレイヤに分割した場合、最初のサブレイヤは1つで、中間のサブレイヤは3つで、最後のサブレイヤは1つとなる。
 以下では、畳み込み部102が外部メモリ30から読み出したサブレイヤを現サブレイヤという。そして、現サブレイヤの1つ前に畳み込み部102が外部メモリ30から読み出したサブレイヤを直前サブレイヤという。
 加算部103は、畳み込み部102で畳み込み処理が実行される都度、バイアス用加算器25で、1つ前のサブレイヤまでの畳み込み結果を累積加算した中間値を畳み込み結果に加算することで加算結果を出力する。具体的に、加算部103は、最初のサブレイヤの畳み込み結果が受け渡されると、当該最初のサブレイヤの畳み込み結果に外部メモリ30から読み出したバイアスを、バイアス用加算器25で加算する。そして、加算部103は、当該最初のサブレイヤの畳み込み結果とバイアスとの加算結果を活性化部104に受け渡す。
 そして、2番目に畳み込み処理が実行された2番目のサブレイヤの畳み込み結果が受け渡されてからは、加算部103は、外部メモリ30に記憶された直前サブレイヤまでの加算結果に、現サブレイヤの畳み込み結果を加算する。直前サブレイヤまでの加算結果とは、後述する活性化部104が外部メモリ30に記憶した加算結果としての1つ前のサブレイヤまでの畳み込み結果を累積加算した中間値である。そして、加算部103は、直前サブレイヤまでの加算結果と現サブレイヤの畳み込み結果との加算結果を活性化部104に受け渡す。具体的に、加算部103は、バイアス用加算器25において本来バイアスが設定される場所に上書きする形で、直前サブレイヤまでの加算結果を設定する。バイアスは1回だけ加算できればよいので、最初のサブレイヤの畳み込み結果にバイアスを加算できれば、2番目のサブレイヤ以降では、バイアスを加算する必要はないからである。サブレイヤ同士の加算を既存のバイアス用加算器25で行うことで、ハードウェア資源を追加せずに畳み込み結果を得ることができる。
 図4に、畳み込み結果をバイアス用加算器25で加算する処理の流れを示す。図4に示すように、加算部103は、最初のサブレイヤの畳み込み結果に外部メモリ30から読み出したバイアスを、バイアス用加算器25で加算する。そして、加算部103は、中間のサブレイヤの畳み込み結果に、外部メモリ30から読み出した直前サブレイヤまでの加算結果を、バイアス用加算器25で加算する。また、加算部103は、最後のサブレイヤの畳み込み結果に対しても、外部メモリ30から読み出した直前サブレイヤまでの加算結果を、バイアス用加算器25で加算する。
 活性化部104は、最後のサブレイヤの畳み込み結果を加算した加算結果が受け渡されると、当該加算結果を活性化関数(例えば、relu関数等)に入力し、算出した特徴マップを外部メモリ30に記憶する。以下では、活性化部104が出力した特徴マップを出力特徴マップ(ofmap:Output Feature Map)という。
 また、活性化部104は、最後のサブレイヤの畳み込み結果を加算した加算結果が加算部103から受け渡されるまでは、活性化関数を適用せず、受け渡された加算結果を比例定数が1で切片が0の1次関数(Y=X)に入力する。これにより、活性化部104は、実質的に加算結果を活性化関数に入力せずに、加算部103から受け渡された加算結果をそのまま外部メモリ30に記憶する。
 図5に、加算結果を入力する関数を示す。図5に示すように、活性化部104は、活性化用演算器26で、最初のサブレイヤの畳み込み結果とバイアスとが加算された値を、比例定数が1で切片が0の1次関数に入力し、加算結果を外部メモリ30に記憶する。そして、活性化部104は、活性化用演算器26で、中間のサブレイヤの畳み込み結果と直前サブレイヤまでの加算結果とが加算された値を上記1次関数に入力し、加算結果を外部メモリ30に上書きする。そして、活性化部104は、活性化用演算器26で、最後のサブレイヤの畳み込み結果と直前サブレイヤまでの加算結果とが加算された値を活性化関数に入力し、算出した最終的な出力特徴マップを外部メモリ30に記憶する。
 図6に、加算結果をバイアス用加算器25で加算する処理の流れを示す。図6に示すように、活性化部104は、最初のサブレイヤの畳み込み結果を加算した加算結果、又は中間のサブレイヤの畳み込み結果を加算した加算結果が受け渡されると、当該加算結果をそのまま外部メモリ30に記憶する。そして、加算部103は、中間のサブレイヤの畳み込み結果又は最後のサブレイヤの畳み込み結果に、外部メモリ30から読み出した加算結果を、バイアス用加算器25で加算する。そして、活性化部104は、最後のサブレイヤの畳み込み結果を加算した加算結果を活性化関数に入力し、最終的な出力特徴マップを外部メモリ30に記憶する。
 次に、各サブレイヤのビット精度について説明する。
 本実施形態では、加算部103は、最後のサブレイヤの畳み込み結果が畳み込み部102から入力されるまでは、出力する加算結果のビット精度を、活性化部104が最後のサブレイヤの畳み込み結果を加算した加算結果に活性化関数を入力して算出する値のビット精度より高くしている。具体的に、加算部103は、畳み込み部102から入力されたまままのビット精度で出力する。また、活性化部104は、最後のサブレイヤの畳み込み結果を加算した加算結果が入力されるまでは、外部メモリ30に記憶する加算結果のビット精度を、最後のサブレイヤの畳み込み結果を加算した加算結果に活性化関数を入力して算出する値のビット精度より高くしている。具体的に、活性化部104は、加算部103から入力されたままのビット精度で出力する。活性化部104は、最後のサブレイヤの畳み込み結果を加算した加算結果が入力されるまでは、実際の出力特徴マップではなく、加算部103から入力された加算結果を外部メモリ30に記憶する。最後のサブレイヤ以外のサブレイヤの出力のビット精度を、最後のサブレイヤの出力のビット精度と同一にしてしまうと、レイヤを分割しない場合と比べて、演算精度が低下するからである。これにより、演算精度を犠牲にしてビット精度を変更する必要がなく、外部メモリ30への転送データを削減することが可能となる。
 例えば、入力特徴マップが8bitで、カーネルデータが8bitの場合、そのまま乗算すると16bitになるため、推論処理装置10は畳み込み処理の中間結果を8bitではなく16bit以上で保持する。推論処理装置10が1回の畳み込みのたびに16bitを8bitに落とした上で8bitのまま累積加算すると、演算精度が大きく劣化するためである。そして、推論処理装置10は、累積加算が終わった後(もしくは更に後の、バイアスの加算後又は活性化関数への入力後)、畳み込み処理の中間結果を出力特徴マップのビット精度まで落とす。具体的に、上述した例では、推論処理装置10は畳み込み処理の中間結果を16bitから8bitまで落とす。
 図7に、ビット精度について説明するための模式図を示す。図7に示すように、加算部103は、最初のサブレイヤの畳み込み結果を加算した加算結果と中間のサブレイヤの畳み込み結果を加算した加算結果については、ビット精度をそのままにしてバイアス用加算器25から活性化用演算器26に受け渡している。そして、活性化部104は、最初のサブレイヤの畳み込み結果を加算した加算結果と中間のサブレイヤの畳み込み結果を加算した加算結果については、ビット精度をそのままにして活性化用演算器26から外部メモリ30に記憶している。そして、加算部103は、最後のサブレイヤの畳み込み結果に対して、活性化部104によってビット精度をそのままにして記憶された直前サブレイヤの加算結果を加算する。
 次に、各サブレイヤに設定された設定について説明する。
 図8に分割されてないレイヤ0及びレイヤ1の設定の例を示す。そして、図9にレイヤ0、及び、レイヤ1から分割されたサブレイヤ0とサブレイヤ1とサブレイヤ2との設定の例を示す。サブレイヤ0は最初のサブレイヤで、サブレイヤ1は中間のサブレイヤで、サブレイヤ2は最後のサブレイヤである。図9に示す通り、各サブレイヤには、分割されてないレイヤと同様に、関数及びバイアス等が設定されている。したがって、CNN用のハードウェアは、サブレイヤを1つのレイヤのようにみなして汎用的に処理できる。これにより、ハードウェア資源や処理時間の増加を抑えながらも、汎用的に対応可能な畳み込み処理を行うことが可能となる。
 入力チャネル数については、図8に示すように、分割前のレイヤ1に3000入力チャネルとして設定されている場合、図9に示すように、サブレイヤ0、サブレイヤ1、サブレイヤ2は全て1000入力チャネルとして設定される。なお、図9に示す例では、入力チャネルが3つに均等に分割されているが、この例に限られない。1つのサブレイヤの入力チャネル数は、内部メモリ23に記憶できるデータサイズであれば均等に分割されていなくてもよい。
 カーネルデータについては、図8に示すように、分割前のレイヤ1にカーネル1が設定されている場合、図9に示すように、サブレイヤ0についてはカーネル1のうち先頭1/3の入力チャネルに相当するデータが、サブレイヤ1についてはカーネル1のうち中間1/3の入力チャネルに相当するデータが、サブレイヤ2についてはカーネル1のうち末尾1/3の入力チャネルに相当するデータが設定されている。
 バイアスについては、図8に示すように、分割前のレイヤ1にバイアス1が設定されている場合、図9に示すように、サブレイヤ0については実際のバイアスであるバイアス1が、サブレイヤ1についてはサブレイヤ0までの加算結果が、サブレイヤ2についてはサブレイヤ1までの加算結果が設定されている。なお、実際の推論処理装置10への設定としては、外部メモリ30上の該当するデータのアドレスを、リードアドレスとして指定すればよい。
 活性化用演算器26に設定する関数は、図8に示すように、分割前のレイヤ1に活性化関数としてのY=f1(x)が設定されている場合、図9に示すように、サブレイヤ0及びサブレイヤ1についてはY=Xの一次関数が設定され、サブレイヤ2については活性化関数としてのY=f1(x)が設定される。
 出力特徴マップのビット精度は、図8に示すように、分割前のレイヤ1にb2が設定されている場合、図9に示すように、サブレイヤ2についてもb2が設定される。そして、サブレイヤ0及びサブレイヤ1にはb_tmpが設定される。b_tmpは、演算精度の劣化を抑えるため、本来の出力特徴マップの精度ではなく畳み込み処理中の精度に設定されている。
 次に、本実施形態に係る推論処理装置10の作用について説明する。
 図10は、推論処理装置10による推論処理の流れを示すフローチャートである。CPU21がROM22から推論処理プログラムを読み出して、内部メモリ23に展開して実行することにより、推論処理が行なわれる。
 ステップS100で、CPU21は、分割部101として、レイヤをチャネル方向で複数のサブレイヤに分割する。
 ステップS101で、CPU21は、畳み込み部102として、受け渡された1つのサブレイヤに畳み込み処理を実行することで畳み込み結果を出力する。
 ステップS102で、CPU21は、加算部103として、出力された畳み込み結果が最初のサブレイヤの畳み込み結果であるか否かを判定する。CPU21は、出力された畳み込み結果が最初のサブレイヤである場合(ステップS102:YES)、ステップS103に移行する。一方、CPU21は、出力された畳み込み結果が最初のサブレイヤでない場合(ステップS102:NO)、ステップS104に移行する。
 ステップS103で、CPU21は、加算部103として、出力された最初のサブレイヤの畳み込み結果にバイアスを加算する。
 ステップS104で、CPU21は、加算部103として、出力された最初のサブレイヤ以外のサブレイヤの畳み込み結果に加算結果を加算する。
 ステップS105で、CPU21は、活性化部104として、出力された加算結果が最後のサブレイヤの畳み込み結果を加算した加算結果であるか否かを判定する。CPU21は、出力された加算結果が最後のサブレイヤの畳み込み結果を加算した加算結果である場合(ステップS105:YES)、ステップS106に移行する。一方、CPU21は、出力された加算結果が最後のサブレイヤの畳み込み結果を加算した加算結果でない場合(ステップS105:NO)、ステップS108に移行する。
 ステップS106で、CPU21は、活性化部104として、最後のサブレイヤの畳み込み結果を加算した加算結果を活性化関数に入力する。
 ステップS107で、CPU21は、活性化部104として、最終的な出力特徴マップを外部メモリ30に記憶し、本推論処理を終了する。
 ステップS108で、CPU21は、活性化部104として、受け渡された加算結果を比例定数が1で切片が0の1次関数に入力する。
 ステップS109で、CPU21は、活性化部104として、加算結果を外部メモリ30に記憶し、ステップS101に戻る。
 次に、本実施形態に係る推論処理装置10の効果について説明する。
 図11に、内部メモリに32チャネル分のデータが格納できる場合に、従来技術で実行される処理を示す。図11に示すように、従来技術においては、カーネルデータを入力チャネルで32チャネルずつに分割して順番に内部メモリに読み込んで畳み込み処理を実行する。そして、畳み込み結果は外部メモリに記憶される。この場合、外部メモリに記憶された32個の畳み込み結果をハードウェア内部に読み出したうえで、32個の畳み込み結果を最終的に統合する必要がある。したがって、畳み込み結果を統合するための加算回路をハードウェア内部に追加する必要がある。また、最終的な出力特徴マップを得るためには、全ての入力チャネルが加算された畳み込み結果に対して活性化関数を適用する必要もある。さらに、処理時間が増加する可能性がある。
 この課題に対し、本実施形態に係る推論処理装置10では、レイヤを複数のサブレイヤに分割し、既存の演算回路を用いて最終的な演算結果を算出することで、ハードウェア資源及び処理時間の増加を抑えつつ、汎用的に対応可能な畳み込み処理を行うことができる。
<変形例>
 なお、本開示は、上述した実施形態に限定されるものではなく、この開示の要旨を逸脱しない範囲内で様々な変形や応用が可能である。
 また、上記実施形態でCPUがソフトウェア(プログラム)を読み込んで実行した各種処理を、CPU以外の各種のプロセッサが実行してもよい。この場合のプロセッサとしては、FPGA(Field-Programmable Gate Array)等の製造後に回路構成を変更可能なPLD(Programmable Logic Device)、及びASIC(Application Specific Integrated Circuit)等の特定の処理を実行させるために専用に設計された回路構成を有するプロセッサである専用電気回路等が例示される。また、推論処理を、これらの各種のプロセッサのうちの1つで実行してもよいし、同種又は異種の2つ以上のプロセッサの組み合わせ(例えば、複数のFPGA、及びCPUとFPGAとの組み合わせ等)で実行してもよい。また、これらの各種のプロセッサのハードウェア的な構造は、より具体的には、半導体素子等の回路素子を組み合わせた電気回路である。
 また、上記実施形態では、推論プログラムがROM22に予め記憶(インストール)されている態様を説明したが、これに限定されない。プログラムは、CD-ROM(Compact Disk Read Only Memory)、DVD-ROM(Digital Versatile Disk Read Only Memory)、及びUSB(Universal Serial Bus)メモリ等の非一時的(non-transitory)記憶媒体に記憶された形態で提供されてもよい。また、プログラムは、ネットワークを介して外部装置からダウンロードされる形態としてもよい。
 以上の実施形態に関し、更に以下の付記を開示する。
 (付記項1)
 推論装置であって、
 メモリと、
 前記メモリに接続された少なくとも1つのプロセッサと、
 を含み、
 前記プロセッサは、
 畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割し、
 前記サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力し、
 前記畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの前記畳み込み結果を累積加算した中間値を前記畳み込み結果に加算することで加算結果を出力し、
 最後に前記畳み込み処理が実行された最後のサブレイヤの前記畳み込み結果を加算した前記加算結果を活性化関数に入力する、
 ように構成される推論装置。
 (付記項2)
 推論処理を実行するようにコンピュータによって実行可能なプログラムを記憶した非一時的記憶媒体であって、
 前記推論処理は、
 畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割し、
 前記サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力し、
 前記畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの前記畳み込み結果を累積加算した中間値を前記畳み込み結果に加算することで加算結果を出力し、
 最後に前記畳み込み処理が実行された最後のサブレイヤの前記畳み込み結果を加算した前記加算結果を活性化関数に入力する、
 非一時的記憶媒体。
10   推論処理装置
19   バス
20   LSI
21   CPU
22   ROM
23   内部メモリ
24   畳み込み用演算器
25   バイアス用加算器
26   活性化用演算器
30   外部メモリ
101 分割部
102 畳み込み部
103 加算部
104 活性化部
 

Claims (8)

  1.  畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割する分割部と、
     前記サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力する畳み込み部と、
     前記畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの前記畳み込み結果を累積加算した中間値を前記畳み込み結果に加算することで加算結果を出力する加算部と、
     最後に前記畳み込み処理が実行された最後のサブレイヤの前記畳み込み結果を加算した前記加算結果を活性化関数に入力する活性化部と、
     を備える推論処理装置。
  2.  前記活性化部は、前記最後のサブレイヤの前記畳み込み結果を加算した前記加算結果が前記加算部から入力されるまでは、前記活性化関数を適用せず、入力された前記加算結果をそのまま記憶部に記憶する、請求項1に記載の推論処理装置。
  3.  前記加算部は、最初に前記畳み込み処理が実行された最初のサブレイヤについては、前記加算器により前記バイアスを前記畳み込み結果に加算し、2番目に前記畳み込み処理が実行された2番目のサブレイヤの前記畳み込み結果が前記畳み込み部から入力されてからは、前記加算器により、前記記憶部から読み出した前記加算結果を前記畳み込み結果に加算する、請求項2に記載の推論処理装置。
  4.  前記活性化部は、前記最後のサブレイヤの前記畳み込み結果を加算した前記加算結果が前記加算部から入力されるまでは、入力された前記加算結果を比例定数が1で切片が0の1次関数に入力する、請求項2に記載の推論処理装置。
  5.  前記加算部は、前記最後のサブレイヤの前記畳み込み結果が前記畳み込み部から入力されるまでは、出力する前記加算結果のビット精度を、前記活性化部が前記最後のサブレイヤの前記畳み込み結果を加算した前記加算結果に前記活性化関数を入力して算出する値のビット精度より高くする、請求項1に記載の推論処理装置。
  6.  前記活性化部は、前記最後のサブレイヤの前記畳み込み結果を加算した前記加算結果が入力されるまでは、前記記憶部に記憶する前記加算結果のビット精度を、前記最後のサブレイヤの前記畳み込み結果を加算した前記加算結果に前記活性化関数を入力して算出する値のビット精度より高くする、請求項2に記載の推論処理装置。
  7.  分割部が、畳み込みニューラルネットワークのレイヤをチャネル方向で複数のサブレイヤに分割し、
     畳み込み部が、前記サブレイヤ毎に畳み込み処理を実行することで畳み込み結果を出力し、
     加算部が、前記畳み込み処理が実行される都度、畳み込み結果にバイアスを加算するための加算器で、1つ前のサブレイヤまでの前記畳み込み結果を累積加算した中間値を前記畳み込み結果に加算することで加算結果を出力し、
     活性化部が、最後に前記畳み込み処理が実行された最後のサブレイヤの前記畳み込み結果を加算した前記加算結果を活性化関数に入力する、
     推論処理方法。
  8.  コンピュータを、請求項1に記載の推論処理装置の各部として機能させるための推論処理プログラム。
PCT/JP2022/027940 2022-07-15 2022-07-15 推論処理装置、推論処理方法、及び推論処理プログラム WO2024014002A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2022/027940 WO2024014002A1 (ja) 2022-07-15 2022-07-15 推論処理装置、推論処理方法、及び推論処理プログラム

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2022/027940 WO2024014002A1 (ja) 2022-07-15 2022-07-15 推論処理装置、推論処理方法、及び推論処理プログラム

Publications (1)

Publication Number Publication Date
WO2024014002A1 true WO2024014002A1 (ja) 2024-01-18

Family

ID=89536362

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2022/027940 WO2024014002A1 (ja) 2022-07-15 2022-07-15 推論処理装置、推論処理方法、及び推論処理プログラム

Country Status (1)

Country Link
WO (1) WO2024014002A1 (ja)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019082859A1 (ja) * 2017-10-23 2019-05-02 日本電気株式会社 推論装置、畳み込み演算実行方法及びプログラム
JP2019082996A (ja) * 2017-10-31 2019-05-30 ナンジン ホライゾン ロボティクス テクノロジー カンパニー リミテッドNanjing Horizon Robotics Technology Co., Ltd. 畳み込みニューラルネットワークにおいて演算を実行する方法および装置並びに非一時的な記憶媒体

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019082859A1 (ja) * 2017-10-23 2019-05-02 日本電気株式会社 推論装置、畳み込み演算実行方法及びプログラム
JP2019082996A (ja) * 2017-10-31 2019-05-30 ナンジン ホライゾン ロボティクス テクノロジー カンパニー リミテッドNanjing Horizon Robotics Technology Co., Ltd. 畳み込みニューラルネットワークにおいて演算を実行する方法および装置並びに非一時的な記憶媒体

Similar Documents

Publication Publication Date Title
US20220043886A1 (en) Hardware Implementation of Convolutional Layer of Deep Neural Network
JP7348971B2 (ja) 畳み込みニューラルネットワークハードウエア構成
US20230195831A1 (en) Methods and systems for implementing a convolution transpose layer of a neural network
EP3460726A1 (en) Hardware implementation of a deep neural network with variable output data format
CN114816331B (zh) 具有时钟选通的用于执行矩阵乘法的硬件单元
US10790830B1 (en) Fused memory and arithmetic circuit
US20220253716A1 (en) Neural network comprising matrix multiplication
US11768658B2 (en) Look ahead normaliser
WO2024014002A1 (ja) 推論処理装置、推論処理方法、及び推論処理プログラム
US20220171602A1 (en) Integrated circuit for constant multiplication and device including the same
GB2554167A (en) Approximating functions
US20230162013A1 (en) Semiconductor device
US10761847B2 (en) Linear feedback shift register for a reconfigurable logic unit
US20230021204A1 (en) Neural network comprising matrix multiplication
CN113344170A (zh) 神经网络权重矩阵调整方法、写入控制方法以及相关装置
US20230083597A1 (en) Configurable nonlinear activation function circuits
CN111860838B (zh) 一种神经网络的全连接层计算方法和装置
CN111325339A (zh) 人工智能处理器执行学习任务的方法及相关产品
KR102482728B1 (ko) 비트 시리얼 연산 방법 및 컴퓨터 기록 매체
US20230273972A1 (en) Processor instruction set architecture for machine learning with low bit precision weights
US12034446B2 (en) Fused memory and arithmetic circuit
US20230409287A1 (en) Accumulator hardware
WO2022259427A1 (ja) 画像処理装置、画像処理方法、及び画像処理プログラム
US20240235556A1 (en) Fused memory and arithmetic circuit
WO2023189191A1 (ja) 固定小数点積和演算装置

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: 22951208

Country of ref document: EP

Kind code of ref document: A1