JP6973651B2 - Arithmetic optimizers, methods and programs - Google Patents
Arithmetic optimizers, methods and programs Download PDFInfo
- Publication number
- JP6973651B2 JP6973651B2 JP2020537921A JP2020537921A JP6973651B2 JP 6973651 B2 JP6973651 B2 JP 6973651B2 JP 2020537921 A JP2020537921 A JP 2020537921A JP 2020537921 A JP2020537921 A JP 2020537921A JP 6973651 B2 JP6973651 B2 JP 6973651B2
- Authority
- JP
- Japan
- Prior art keywords
- calculation
- arithmetic
- value
- explanatory variable
- application pattern
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR 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
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)
- Image Analysis (AREA)
Description
本発明は、例えば、ニューラルネットワーク等の判別モデルを用いた演算を最適化する演算最適化装置、演算最適化方法および演算最適化プログラムに関する。 The present invention relates to, for example, an arithmetic optimization device, an arithmetic optimization method, and an arithmetic optimization program for optimizing an arithmetic using a discrimination model such as a neural network.
与えられたデータに対する推論を、モデルを用いることによって行う場合がある。このようなモデルは、判別モデルと呼ばれる。例えば、画像データが与えられ、その画像データと、判別モデルとによって、その画像データが表わしている物(画像に写っている物)を推論する場合がある。 Inferences about given data may be made by using a model. Such a model is called a discriminant model. For example, image data may be given, and the image data and the discriminant model may infer what the image data represents (the object shown in the image).
判別モデルの例として、ニューラルネットワークが知られている。ニューラルネットワークでは、複数の層が結合されたモデルであり、それぞれの層は、1つ以上のユニット(ニューロン)で構成されている。ニューラルネットワークを用いて推論処理を行う場合、入力データを入力層に入力し、入力層側から出力層側に順方向に演算を行うことによって、入力データに関する推論結果が得られる。 A neural network is known as an example of a discrimination model. A neural network is a model in which a plurality of layers are connected, and each layer is composed of one or more units (neurons). When the inference process is performed using a neural network, the inference result regarding the input data can be obtained by inputting the input data to the input layer and performing the calculation in the forward direction from the input layer side to the output layer side.
ニューラルネットワークは、深層学習によって学習される。 Neural networks are learned by deep learning.
ニューラルネットワークを用いた演算を行うためのツールが、例えば、非特許文献1に記載されている。
A tool for performing an operation using a neural network is described in, for example, Non-Patent
ニューラルネットワークを用いた演算を行うための既存のツールには、ニューラルネットワークの全ての層の演算精度を一律に変えることができるものがある。例えば、ニューラルネットワークの全ての層の演算を、浮動小数点演算に設定したり、整数演算に設定したりすることができるツールがある。また、そのような設定は、ユーザ(人間)が行う。 Some existing tools for performing operations using neural networks can uniformly change the calculation accuracy of all layers of the neural network. For example, there are tools that can set operations on all layers of a neural network to floating-point operations or integer operations. Further, such a setting is made by a user (human).
前述のように、ニューラルネットワークを用いた演算を行うための既存のツールには、ニューラルネットワークの全ての層の演算精度を一律に変えることができるものがある。しかし、そのようなツールでは、個々の層の演算精度をそれぞれ個別に設定することができない。そのため、ニューラルネットワークを用いた演算を最適化することが困難であった。 As mentioned above, some existing tools for performing operations using neural networks can uniformly change the calculation accuracy of all layers of the neural network. However, with such a tool, the calculation accuracy of each layer cannot be set individually. Therefore, it has been difficult to optimize the calculation using the neural network.
例えば、ニューラルネットワークの全ての層の演算を浮動小数点演算に設定した場合には、高精度で演算を行えるが、消費電力等に関する効率は低下する。逆に、ニューラルネットワークの全ての層の演算を整数演算に設定した場合には、消費電力等に関する効率は向上するが、演算精度は低下する。 For example, when the calculation of all layers of the neural network is set to the floating-point calculation, the calculation can be performed with high accuracy, but the efficiency related to power consumption and the like is lowered. On the contrary, when the calculation of all layers of the neural network is set to the integer calculation, the efficiency regarding power consumption and the like is improved, but the calculation accuracy is lowered.
また、既存のツールでは、ニューラルネットワーク全体の演算精度を、浮動小数点演算にするか、整数演算にするかを、ユーザが判断しなければならなかった。 In addition, with existing tools, the user had to decide whether to use floating-point arithmetic or integer arithmetic for the calculation accuracy of the entire neural network.
そこで、本発明は、判別モデルを用いた演算を最適化できるように、判別モデルの各層における演算精度を自動的に定めることができる演算最適化装置、演算最適化方法および演算最適化プログラムを提供することを目的とする。 Therefore, the present invention provides a calculation optimization device, a calculation optimization method, and a calculation optimization program that can automatically determine the calculation accuracy in each layer of the discrimination model so that the calculation using the discrimination model can be optimized. The purpose is to do.
本発明による演算最適化装置は、1つ以上のユニットでそれぞれ構成された複数の層が結合された判別モデルを用いた演算で、第1の演算精度で演算を行う第1の演算回路をどの層に適用し、第1の演算精度よりも高い第2の演算精度で演算を行う第2の演算回路をどの層に適用するかを定めた情報である適用パターン毎に、所定の説明変数の値を取得する説明変数値取得手段と、所定の説明変数で表される目的関数の値を、適用パターン毎に計算する目的関数計算手段と、目的関数の値が最小となる適用パターンを決定する適用パターン決定手段とを備えることを特徴とする。 The calculation optimization device according to the present invention is a calculation using a discrimination model in which a plurality of layers composed of one or more units are connected, and which is a first calculation circuit that performs a calculation with the first calculation accuracy. A predetermined explanatory variable for each application pattern, which is information that defines to which layer the second arithmetic circuit, which is applied to the layer and performs the arithmetic with the second arithmetic accuracy higher than the first arithmetic accuracy, is applied. Explanatory variable to acquire the value Determine the value acquisition means, the objective function calculation means that calculates the value of the objective function represented by the predetermined explanatory variable for each application pattern, and the application pattern that minimizes the value of the objective function. It is characterized by providing means for determining an application pattern.
また、本発明による演算最適化方法は、1つ以上のユニットでそれぞれ構成された複数の層が結合された判別モデルを用いた演算で、第1の演算精度で演算を行う第1の演算回路をどの層に適用し、第1の演算精度よりも高い第2の演算精度で演算を行う第2の演算回路をどの層に適用するかを定めた情報である適用パターン毎に、所定の説明変数の値を取得し、所定の説明変数で表される目的関数の値を、適用パターン毎に計算し、目的関数の値が最小となる適用パターンを決定することを特徴とする。 Further, the arithmetic optimization method according to the present invention is an arithmetic using a discriminant model in which a plurality of layers composed of one or more units are combined, and the first arithmetic circuit performs the arithmetic with the first arithmetic accuracy. Is information on which layer the second arithmetic circuit is applied to, and the second arithmetic circuit that performs the arithmetic with the second arithmetic accuracy higher than the first arithmetic accuracy is applied to which layer. A predetermined explanation is given for each application pattern. It is characterized in that the value of a variable is acquired, the value of an objective function represented by a predetermined explanatory variable is calculated for each application pattern, and the application pattern in which the value of the objective function is minimized is determined.
また、本発明による演算最適化プログラムは、コンピュータに、1つ以上のユニットでそれぞれ構成された複数の層が結合された判別モデルを用いた演算で、第1の演算精度で演算を行う第1の演算回路をどの層に適用し、第1の演算精度よりも高い第2の演算精度で演算を行う第2の演算回路をどの層に適用するかを定めた情報である適用パターン毎に、所定の説明変数の値を取得する説明変数値取得処理、所定の説明変数で表される目的関数の値を、適用パターン毎に計算する目的関数計算処理、および、目的関数の値が最小となる適用パターンを決定する適用パターン決定処理を実行させることを特徴とする。 Further, the calculation optimization program according to the present invention is a first calculation using a discrimination model in which a plurality of layers composed of one or more units are connected to a computer, and the calculation is performed with the first calculation accuracy. For each application pattern, which is information that defines to which layer the second arithmetic circuit is applied and which layer the second arithmetic circuit is applied to, which performs arithmetic with a second arithmetic accuracy higher than that of the first arithmetic accuracy. The explanatory variable value acquisition process for acquiring the value of a predetermined explanatory variable, the objective function calculation process for calculating the value of the objective function represented by the predetermined explanatory variable for each application pattern, and the value of the objective function are minimized. It is characterized in that an application pattern determination process for determining an application pattern is executed.
本発明によれば、判別モデルを用いた演算を最適化できるように、判別モデルの各層における演算精度を自動的に定めることができる。 According to the present invention, the calculation accuracy in each layer of the discrimination model can be automatically determined so that the calculation using the discrimination model can be optimized.
本発明の演算最適化装置は、1つ以上のユニットでそれぞれ構成された複数の層が結合された判別モデルにおける各層の演算精度を決定する。このような判別モデルの例として、ニューラルネットワークがある。以下の説明では、判別モデルがニューラルネットワークである場合を例にして説明する。ただし、判別モデルは、ニューラルネットワークに限定されるわけではない。 The calculation optimization device of the present invention determines the calculation accuracy of each layer in a discrimination model in which a plurality of layers each composed of one or more units are combined. An example of such a discriminant model is a neural network. In the following description, the case where the discriminant model is a neural network will be described as an example. However, the discriminant model is not limited to the neural network.
また、以下の説明では、ニューラルネットワークを用いた処理として、与えられた入力データが示す内容を推論する処理を例にして説明する。例えば、画像データが与えられ、その画像データと、ニューラルネットワークとによって、その画像データが表わしている物(画像に写っている物)を推論する処理を例にして説明する。 Further, in the following description, as a process using a neural network, a process of inferring the content indicated by the given input data will be described as an example. For example, a process in which image data is given and an object represented by the image data (an object reflected in the image) is inferred by the image data and a neural network will be described as an example.
ただし、ニューラルネットワークを用いた処理は、上記の推論処理に限定されず、例えば、ニューラルネットワークの各層のパラメタ更新処理等もある。後述の実施形態では、本発明の演算最適化装置が、推論処理を行う場合におけるニューラルネットワークの各層の演算精度を決定する場合を例にして説明するが、上記のパラメタ更新処理等の他の処理も本発明に適用可能である。 However, the processing using the neural network is not limited to the above inference processing, and may include, for example, parameter updating processing for each layer of the neural network. In the embodiment described later, the case where the calculation optimization device of the present invention determines the calculation accuracy of each layer of the neural network in the case of performing inference processing will be described as an example, but other processing such as the above parameter update processing will be described. Is also applicable to the present invention.
図1は、ニューラルネットワークを用いた推論処理を示す模式図である。図1において、ニューラルネットワークにおけるニューロンに相当するユニット51が楕円で表されている。各層には、1つ以上のユニットが存在する。また、線分52(図中のユニット間を結ぶ線)は、ユニット間結合を表わす。また、矢印53(図中の右向きの太線矢印)は、推論処理を模式的に表している。なお、図1では、各ユニット51への入力が前段の層のユニットの出力となるフィードフォワード型のニューラルネットワークの例を示しているが、各ユニット51への入力はこれに限られない。例えば、時系列情報を保持している場合には、リカレント型のニューラルネットワークのように、各ユニット51への入力に、前の時刻における前段の層のユニットの出力を含めることも可能である。なお、そのような場合も、推論処理の方向は、入力層から出力層への向かう方向(順方向)であるとみなされる。このように入力層から所定の順番で行われる推論処理は「順伝搬」とも呼ばれる。以下の説明では、入力層を第0層と記し、出力層を第n層と記す。
FIG. 1 is a schematic diagram showing inference processing using a neural network. In FIG. 1, the
図2は、1つのユニット51に着目したときの当該ユニット51の入出力および他のユニットとの結合の例を示す説明図である。図2(a)は、1つのユニット51の入出力の例を示し、図2(b)は、2層に並べられたユニット51の間の結合の例を示す。図2(a)に示すように、1つのユニット51に対して4つの入力(x1〜x4)と1つの出力(z)があった場合に、当該ユニット51の動作は、例えば、式(1A)のように表される。ここで、f()は活性化関数を表わしている。FIG. 2 is an explanatory diagram showing an example of input / output of the
z=f(u) ・・・(1A)
ただし、u=a+w1x1+w2x2+w3x3+w4x4 ・・・(1B)z = f (u) ... (1A)
However, u = a + w 1 x 1 + w 2 x 2 + w 3 x 3 + w 4 x 4 ... (1B)
式(1B)において、aは切片、w1〜w4は各入力(x1〜x4)に対応した重み等のパラメタを表す。In the formula (1B), a represents an intercept, and w 1 to w 4 represent parameters such as weights corresponding to each input (x 1 to x 4).
一方、図2(b)に示すように、2層に並べられた層間で各ユニット51が結合されている場合、後段の層に着目すると、当該層(2層のうちの後段の層)内の各ユニットへの入力(それぞれx1〜x4)に対する各ユニット51の出力(z1〜z4)は、例えば、次のように表される。なお、iは同一層内のユニットの識別子(本例ではi=1〜3)である。On the other hand, as shown in FIG. 2B, when each
zi=f(ui) ・・・(2A)
ただし、ui=a+wi,1x1+wi,2x2+wi,3x3+wi,4x4
・・・(2B) z i = f (u i) ··· (2A)
However, u i = a + wi , 1 x 1 + wi , 2 x 2 + wi , 3 x 3 + wi , 4 x 4
... (2B)
以下では、式(2B)を単純化して、ui=Σwi,k*xkと記す場合がある。なお、切片aは省略した。なお、切片aを値1の定数項の係数(パラメタの1つ)とみなすことも可能である。ここで、kは、当該層における各ユニット51への入力の識別子を表わす。より具体的には、kは、その入力を行う他のユニットの識別子を表わしているということもできる。このとき当該層における各ユニット51への入力が前段の層の各ユニットの出力のみである場合には、上記の簡略式を、ui (L)=Σwi,k (L)*xk (L−1)と記すことも可能である。なお、Lは層の識別子を表わす。これらの式において、wi,kが、当該層(第L層)における各ユニットiのパラメタに相当する。このパラメタは、より具体的には、各ユニットiと他のユニットkとの結合(ユニット間結合)の重みに相当する。以下では、ユニットを特に区別せず、ユニットの出力値を決める関数(活性化関数)を簡略化して、z=Σw*xと記す場合がある。In the following, the equation (2B) may be simplified and described as u i = Σwi i, k * x k. The intercept a was omitted. It is also possible to regard the intercept a as a coefficient (one of the parameters) of the constant term having a value of 1. Here, k represents an identifier of an input to each
上記の例において、ある層の各ユニット51について、入力xから出力zを求める演算が、その層における推論処理に相当する。
In the above example, for each
本発明の実施形態を説明する前に、ニューラルネットワークの各層のうち、一部の層の演算を低精度で実行し、残りの層の演算を高精度で実行する処理装置の例について説明する。図3は、上記の処理装置の例を示す模式図である。処理装置18は、例えば、低精度演算回路5と、高精度演算回路6と、第1メモリ7と、第2メモリ8と、第3メモリ9とを備える。低精度演算回路5、高精度演算回路6、第1メモリ7、第2メモリ8および第3メモリ9は、例えば、バス10を介して接続される。
Before explaining the embodiment of the present invention, an example of a processing device that executes the calculation of a part of the layers of the neural network with low accuracy and the calculation of the remaining layers with high accuracy will be described. FIG. 3 is a schematic diagram showing an example of the above processing apparatus. The
低精度演算回路5は、推論処理において、ニューラルネットワークの各層のうち、一部の層の演算を第1の演算精度で実行する。
In the inference processing, the low-
第1メモリ7は、低精度演算回路5が演算を実行する際に使用するメモリであり、低精度演算回路5は、第1メモリ7に適宜アクセスしながら、演算を実行する。
The first memory 7 is a memory used when the low-
高精度演算回路6は、推論処理において、ニューラルネットワークの各層のうち、残りの層の演算を、第1の演算精度よりも高い第2の演算精度で実行する。 In the inference processing, the high-precision arithmetic circuit 6 executes the arithmetic of the remaining layers of each layer of the neural network with a second arithmetic accuracy higher than the first arithmetic accuracy.
第2メモリ8は、高精度演算回路6が演算を実行する際に使用するメモリであり、高精度演算回路6は、第2メモリ8に適宜アクセスしながら、演算を実行する。
The
なお、第1メモリ7および第2メモリ8は、異なるメモリで実現されも、単一のメモリで実現されていてもよい。第1メモリ7および第2メモリ8が単一のメモリで実現される場合には、その単一のメモリが、低精度演算回路5のアクセス領域と、高精度演算回路6のアクセス領域とに分けられていればよい。
The first memory 7 and the
また、第3メモリ9は、低精度演算回路5と高精度演算回路6がデータを授受する際に用いられるデータ授受用メモリである。なお、第3メモリ9が設けられていなくてもよい。すなわち、低精度演算回路5と高精度演算回路6が、第3メモリ9(データ授受用メモリ)を介さずに、通信によってデータを授受してもよい。
Further, the third memory 9 is a data transfer memory used when the low-
高精度演算回路6の演算精度(第2の演算精度)は、低精度演算回路5の演算精度(第1の演算精度)よりも高い。なお、演算に用いる数値データの値域の広さ・細かさの尺度(より具体的には、演算回路におけるビット幅および小数点の取り扱い等で定まる数値データの値域の広さ・細かさの尺度)を、「精度」または「演算精度」と呼ぶ。 The calculation accuracy of the high-precision calculation circuit 6 (second calculation accuracy) is higher than the calculation accuracy of the low-precision calculation circuit 5 (first calculation accuracy). In addition, the scale of the range and fineness of the numerical data used for the calculation (more specifically, the scale of the range and fineness of the numerical data determined by the handling of the bit width and the decimal point in the arithmetic circuit). , Called "precision" or "calculation precision".
以下、低精度演算回路5の演算精度が8ビットの整数演算であり、高精度演算回路6の演算精度が32ビットの浮動小数点演算である場合を例にして説明する。ただし、低精度演算回路5の演算精度および高精度演算回路6の演算精度は、この例に限定されず、高精度演算回路6の演算精度が、低精度演算回路5の演算精度よりも高ければよい。
Hereinafter, a case where the arithmetic precision of the low-
低精度演算回路5および高精度演算回路6は、例えば、GPU(Graphics Processing Unit)に実装される。
The low-
図4は、低精度演算回路5の一例を示す概略構成図である。図4に例示するように、低精度演算回路5は、例えば、複数のMAC(Multiplier-Accumulator)221を並列に接続した構成であってもよい。
FIG. 4 is a schematic configuration diagram showing an example of a low-
同様に、高精度演算回路6も、図4に例示するように、複数のMACを並列に接続した構成であってもよい。ただし、低精度演算回路5に設けられるMAC221の演算精度よりも、高精度演算回路6に設けられるMACの演算精度の方が高い。
Similarly, the high-precision arithmetic circuit 6 may also have a configuration in which a plurality of MACs are connected in parallel, as illustrated in FIG. However, the calculation accuracy of the MAC provided in the high-precision calculation circuit 6 is higher than the calculation accuracy of the
MACは、低精度演算回路5や高精度演算回路6に設けられる演算器の一例である。
The MAC is an example of an arithmetic unit provided in the low-
図5は、MAC221の構成例を示すブロック図である。MAC221は、乗算器234と、加算器235と、3つの入力を保持する記憶素子231〜233と、1つの出力を保持する記憶素子236とを備えていてもよい。図5に例示するMAC221は、3つの変数a,w,xを受け取ると、1つの出力変数z=a+w*xを計算する演算回路である。本例において、zがユニットの出力に相当し、a,wがパラメタに相当し、xがユニットの入力に相当する。MAC221は、3つの変数w,x,aをそれぞれ、記憶素子231,232,233を介して受け取る。計算されたzは、記憶素子236を介して外部に送られる。このような構成において、MAC221の演算精度は、乗算器234や加算器235のビット幅および小数点の取り扱い(浮動小数点か固定小数点か等)により決定される。例えば、低精度演算回路5に設けられるMAC221では、乗算器234および加算器235による演算が、低精度演算回路5の演算精度(例えば、8ビットの整数演算)に対応していればよい。
FIG. 5 is a block diagram showing a configuration example of MAC221. The
高精度演算回路6に設けられるMACも、図5に示す構成と同様に表すことができる。ただし、高精度演算回路6に設けられるMACでは、乗算器234および加算器235による演算が、高精度演算回路6の演算精度(例えば、32ビットの浮動小数点演算)に対応する。
The MAC provided in the high-precision arithmetic circuit 6 can also be represented in the same manner as the configuration shown in FIG. However, in the MAC provided in the high-precision arithmetic circuit 6, the arithmetic by the
なお、低精度演算回路5および高精度演算回路6の構成は、図4に例示する構成に限定されない。図4に示す構成とは異なる構成によって、低精度演算回路5および高精度演算回路6が実現されていてもよい。例えば、低精度演算回路5および高精度演算回路6は、MAC以外の演算器を備える構成であってもよい。
The configurations of the low-
図6は、ニューラルネットワークを用いた推論処理の処理経過の例を示すフローチャートである。 FIG. 6 is a flowchart showing an example of the processing progress of the inference processing using the neural network.
低精度演算回路5に入力データが与えられると(ステップS111)、低精度演算回路5は、ニューラルネットワークの第1層から第(k−1)層までの順伝搬を、第1の演算精度で行う(ステップS112)。すなわち、低精度演算回路5は、第1層から第(k−1)層までの各層に含まれる各ユニットの出力を計算する推論演算を、第1の演算精度で実行する。
When the input data is given to the low-precision arithmetic circuit 5 (step S111), the low-
次に、低精度演算回路5は、ステップS112の演算結果を第3メモリ9に保存する(ステップS113)。具体的には、低精度演算回路5は、第(k−1)層の各ユニットからの出力を、第3メモリ9に保存する。
Next, the low-
次に、低精度演算回路5は、高精度演算回路6は、ステップS112の演算結果(第(k−1)層の各ユニットからの出力)を、第3メモリ9から読み出す(ステップS114)。
Next, in the low-
ステップS113,S114において、低精度演算回路5および高精度演算回路6は、データ(ステップS112の演算結果。具体的には、第(k−1)層の各ユニットからの出力。)を、第3メモリ9を介して、授受していることになる。
In steps S113 and S114, the low-
なお、低精度演算回路5および高精度演算回路6は、第3メモリ9を介さずに、通信によって直接、データを授受してもよい。
The low-
ステップS114の後、高精度演算回路6は、ニューラルネットワークの第k層から第n層までの順伝搬を、第2の演算精度で行う(ステップS115)。すなわち、高精度演算回路6は、第k層から第n層までの各層に含まれる各ユニットの出力を計算する推論演算を、第2の計算精度で実行する。 After step S114, the high-precision arithmetic circuit 6 performs forward propagation from the kth layer to the nth layer of the neural network with the second arithmetic accuracy (step S115). That is, the high-precision calculation circuit 6 executes an inference operation for calculating the output of each unit included in each layer from the kth layer to the nth layer with the second calculation accuracy.
なお、図6に示す処理経過において、ニューラルネットワークの入力層を第0層とし、第n層が出力層であるものとする。また、上記の第(k−1)層は、入力層(第0層)よりも後段でかつ出力層(第n層)よりも前段の中間層であるものとする。すなわち、kは、0<k−1<nを満たす整数であるものとする。 In the processing process shown in FIG. 6, it is assumed that the input layer of the neural network is the 0th layer and the nth layer is the output layer. Further, it is assumed that the above-mentioned (k-1) layer is an intermediate layer after the input layer (0th layer) and before the output layer (nth layer). That is, k is an integer satisfying 0 <k-1 <n.
ステップS115で得られる第n層のユニットの出力が、推論結果を表わしているということができる。 It can be said that the output of the nth layer unit obtained in step S115 represents the inference result.
以下、本発明の実施形態を図面を参照して説明する。 Hereinafter, embodiments of the present invention will be described with reference to the drawings.
本実施形態では、本発明の演算最適化装置が、ニューラルネットワークにおける各層の演算精度を決定する場合を例にして説明する。また、前述のように、ニューラルネットワークを用いた処理として、与えられた入力データが示す内容を推論する処理を例にして説明する。例えば、画像データが与えられ、その画像データと、ニューラルネットワークとによって、その画像データが表わしている物(画像に写っている物)を推論する処理を例にして説明する。ただし、本発明は、ニューラルネットワークを用いた他の処理にも適用可能である。 In the present embodiment, the case where the calculation optimization device of the present invention determines the calculation accuracy of each layer in the neural network will be described as an example. Further, as described above, as a process using a neural network, a process of inferring the content indicated by the given input data will be described as an example. For example, a process in which image data is given and an object represented by the image data (an object reflected in the image) is inferred by the image data and a neural network will be described as an example. However, the present invention can also be applied to other processes using a neural network.
図7は、本発明の演算最適化装置の構成例を示すブロック図である。本発明の演算最適化装置は、判別モデル記憶部21と、データ記憶部22と、説明変数値取得部23と、目的関数記憶部24と、目的関数計算部25と、計算結果記憶部26と、適用パターン決定部27とを備える。
FIG. 7 is a block diagram showing a configuration example of the calculation optimization device of the present invention. The calculation optimization device of the present invention includes a discrimination
判別モデル記憶部21は、判別モデルとして、ニューラルネットワークを記憶する記憶装置である。
The discrimination
データ記憶部22は、ニューラルネットワークを用いた推論処理の対象なるデータ(例えば、画像に写っている物を推論対象とする画像データ)を記憶する記憶装置である。データ記憶部22は、推論対象となるデータを複数個(N個とする。)、記憶し、個々のデータに対応する推論結果の正解データも記憶する。例えば、データ記憶部22は、N個の画像データと、個々の画像データに対応する正解データ(実際に画像に写っている物を示すデータ)とを記憶する。
The
目的関数記憶部24は、所定の説明変数(以下、単に説明変数と記す。)で表される目的関数を記憶する。目的関数を表わす式は、予め定められる。本実施形態では、少なくとも、ニューラルネットワークを用いた推論処理における「推論精度」と「処理速度」とを、上記の説明変数として用いるものとする。以下の説明では、説明を簡単にするために、まず、「推論精度」と「処理速度」とを説明変数とする場合について説明する。目的関数が、「推論精度」および「処理速度」に加え、さらに他の説明変数によって表されてもよいが、この場合については、後述する。
The objective
ここで、「推論精度」とは、推論処理の演算結果(換言すれば、推論結果)の正確さである。 Here, the "inference accuracy" is the accuracy of the operation result (in other words, the inference result) of the inference process.
目的関数記憶部24は、目的関数として、例えば、以下の式(3)で表される関数を記憶する。
The objective
目的関数=「推論精度」×α+「処理速度」×β ・・・(3) Objective function = "inference accuracy" x α + "processing speed" x β ... (3)
「推論精度」および「処理速度」は、説明変数である。αは、「推論精度」の係数であり、βは、「処理速度」の係数である。αおよびβの値は、予め決定されている。本実施形態では、αおよびβがいずれも、正の値として定められている場合を例にして説明する。 "Inference accuracy" and "processing speed" are explanatory variables. α is a coefficient of “inference accuracy” and β is a coefficient of “processing speed”. The values of α and β are predetermined. In the present embodiment, the case where both α and β are defined as positive values will be described as an example.
説明変数値取得部23は、目的関数記憶部24に記憶されている目的関数において用いられている説明変数の値を取得する。本例では、ニューラルネットワークを用いた推論処理における「推論精度」および「処理速度」の値を取得する。
The explanatory variable
また、説明変数値取得部23は、予め、複数種類の適用パターンを記憶している。適用パターンとは、判別モデル(本実施形態では、ニューラルネットワーク)を用いた演算で、低精度演算回路5(図3参照)をニューラルネットワークのどの層に適用し、高精度演算回路6(図3参照)をニューラルネットワークのどの層に適用するのかを定めた情報である。なお、本実施形態では、第1層以降に低精度演算回路5を適用し、いずれかの層と層の間で、層に適用する回路を低精度演算回路5から高精度演算回路6に切り替えてもよいものとする。ただし、説明を簡単にするために、その切り替えは最大で1回である場合を例にして説明する。また、第1層以降の全ての層に高精度演算回路6を適用してもよいものとする。
Further, the explanatory variable
従って、本実施形態では、第1層から第p層までに低精度演算回路5を適用し、第p+1層から第q層までに高精度演算回路6を適用し、第q+1層から第n層(出力層)までに再び低精度演算回路5を適用するようなケースは、適用パターンから除外する。ただし、本発明において、このようなケースを適用パターンに含めてもよい。
Therefore, in the present embodiment, the low-
図8は、適用パターンの例を示す模式図である。図8に示す各矩形は、ニューラルネットワークの各層を表わしている。 FIG. 8 is a schematic diagram showing an example of an application pattern. Each rectangle shown in FIG. 8 represents each layer of the neural network.
図8に示す適用パターン1は、第1層から第n層までの全ての層に低精度演算回路5を適用することを定めている。換言すれば、適用パターン1は、第1層から第n層までの全ての層の演算を低精度演算回路5が実行することを定めている。
The
図8に示す適用パターン2は、第1層から第n−1層までの各層に低精度演算回路5を適用し、第n層に高精度演算回路6を適用することを定めている。換言すれば、適用パターン2は、第1層から第n−1層までの各層の演算を低精度演算回路5が実行し、第n層の演算を高精度演算回路6が実行することを定めている。
The
図8に示す適用パターン3は、第1層から第n−2層までの各層に低精度演算回路5を適用し、第n−1層および第n層に高精度演算回路6を適用することを定めている。
In the application pattern 3 shown in FIG. 8, the low-
図8に示す適用パターンX−1は、第1層に低精度演算回路5を適用し、第2層から第n層までの各層に高精度演算回路6を適用することを定めている。換言すれば、適用パターンX−1は、第1層の演算を低精度演算回路5が実行し、第2層から第n層までの各層の演算を高精度演算回路6が実行することを定めている。
The application pattern X-1 shown in FIG. 8 defines that the low-
図8に示す適用パターンXは、第1層から第n層までの全ての層に高精度演算回路6を適用することを定めている。換言すれば、適用パターンXは、第1層から第n層までの全ての層の演算を高精度演算回路6が実行することを定めている。 The application pattern X shown in FIG. 8 defines that the high-precision arithmetic circuit 6 is applied to all the layers from the first layer to the nth layer. In other words, the application pattern X defines that the high-precision arithmetic circuit 6 executes the arithmetic of all the layers from the first layer to the nth layer.
図8に例示するような種々の適用パターンは、予め決定されていて、説明変数値取得部23は、個々の適用パターンを予め記憶している。そして、説明変数値取得部23は、個々の適用パターン毎に、説明変数「推論精度」の値、および、説明変数「処理速度」の値を取得する。
Various application patterns as illustrated in FIG. 8 are predetermined, and the explanatory variable
適用パターンが異なれば、説明変数(本例では、「推論精度」および「処理速度」)の値も異なる。 Different application patterns have different values for the explanatory variables (in this example, "inference accuracy" and "processing speed").
説明変数値取得部23が説明変数(本例では、「推論精度」および「処理速度」)の値を取得する態様として、2つの態様がある。第1の態様は、説明変数値取得部23が、実際に存在する処理装置18(図3参照)に推論処理を実行させ、実測により「推論精度」および「処理速度」の値を取得する態様である。第2の態様は、説明変数値取得部23がシミュレーションによって「推論精度」および「処理速度」の値を取得する態様である。すなわち、第1の態様は、説明変数の値を実測により取得する態様であり、第2の態様は、説明変数の値をシミュレーションにより取得する態様である。
There are two modes in which the explanatory variable
説明変数値取得部23が実測により説明変数の値を取得する場合、演算最適化装置は、図9に示すように、処理装置18を備えていてもよい。処理装置18の構成や動作は、図3等を参照して既に説明しているので、ここでは説明を省略する。
When the explanatory variable
また、処理装置18がまだ設計段階であり、まだ実際に処理装置18が存在していない場合もあり得る。その場合には、図10に示すように、演算最適化装置は、設計情報記憶部19を備えていてもよい。設計情報記憶部19は、処理装置18の設計情報を記憶する記憶装置である。設計情報の例として、処理装置18内の低精度演算回路5に設けられる演算器(例えば、MAC)の数や、処理装置18内の高精度演算回路6に設けられる演算器(例えば、MAC)の数等が挙げられる。ただし、設計情報は、これらの例に限定されない。説明変数値取得部23は、設計情報記憶部19に記憶された設計情報に基づいて、説明変数の値をシミュレーションにより取得すればよい。
Further, it is possible that the
まず、説明変数値取得部23が実測により説明変数の値を取得する場合の動作について説明する。ここでは、図9に示すように、演算最適化装置が、処理装置18を備えている場合を例にして説明する。
First, the operation when the explanatory variable
説明変数値取得部23が「処理速度」の値を実測によって取得する動作を説明する。説明変数値取得部23は、処理装置18に対して適用パターンを指定する。そして、説明変数値取得部23は、判別モデル記憶部21に記憶されているニューラルネットワークと、データ記憶部22に記憶されているデータとを、処理装置18に入力し、処理装置18に推論処理を実行させ、処理装置18がそのデータに対する推論処理を行う際の処理速度を計測すればよい。この結果、説明変数値取得部23は、処理速度の値を取得する。また、このとき、処理装置18は、指定された適用パターンに応じた動作で、推論処理を実行する。
The operation of the explanatory variable
処理速度は、例えば、1つのデータに対する推論処理時間(換言すれば、1秒当たりに処理可能なデータ数の逆数)である。あるいは、説明変数値取得部23は、処理速度の値として、例えば、レイテンシまたはスループットの値を取得してもよい。この点は、シミュレーションによって処理速度の値を取得する場合においても同様である。
The processing speed is, for example, the inference processing time for one data (in other words, the reciprocal of the number of data that can be processed per second). Alternatively, the explanatory variable
なお、説明変数値取得部23は、1つのデータに関して、処理装置18に推論処理を実行させることで、処理速度の値を取得することができる。
The explanatory variable
説明変数値取得部23は、指定する適用パターンを順次、変更し、適用パターン毎に、実測によって処理速度の値を取得する。
The explanatory variable
説明変数値取得部23が「推論精度」の値を実測によって取得する動作を説明する。推論精度の値を実測によって取得する場合、説明変数値取得部23は、例えば、以下のように動作すればよい。説明変数値取得部23は、処理装置18に対して適用パターンを指定する。そして、説明変数値取得部23は、判別モデル記憶部21に記憶されているニューラルネットワークを処理装置18に入力する。また、説明変数値取得部23は、データ記憶部22に記憶されている複数個(N個とする。)のデータをそれぞれ、処理装置18に入力し、個々のデータ毎に、処理装置18に推論結果を導出させる。すなわち、説明変数値取得部23は、処理装置18にN回の推論処理を実行させる。このとき、処理装置18は、指定された適用パターンに応じた動作で、推論処理を実行する。この結果、N個の推論結果が得られる。説明変数値取得部23は、データ記憶部22に記憶されている正解データと、それぞれの推論結果とを照合し、N回の推論処理回数に対する、正解データが得られた推論処理回数の割合を算出し、さらにその割合の逆数を算出する。その割合の逆数が、推論精度の値に該当する。なお、説明変数値取得部23が推論精度の値を実測によって取得する動作は、上記の例に限定されない。
The operation of the explanatory variable
説明変数値取得部23は、指定する適用パターンを順次、変更し、適用パターン毎に、実測によって、推論精度の値を取得する。
The explanatory variable
次に、説明変数値取得部23がシミュレーションにより説明変数の値を取得する場合の動作について説明する。ここでは、図10に示すように、演算最適化装置が、設計情報記憶部19を備えている場合を例にして説明する。本例では、処理装置18内の低精度演算回路5(図3参照)に設けられる演算器(例えば、MAC)の数や、処理装置18内の高精度演算回路6(図3参照)に設けられる演算器(例えば、MAC)の数が、設計情報として設計情報記憶部19に記憶されているものとする。
Next, the operation when the explanatory variable
説明変数値取得部23が「処理速度」の値をシミュレーションによって取得する動作を説明する。本例では、説明変数値取得部23は、例えば、「処理速度」の値を求めるための関数(以下、処理速度関数と記す。)を予め保持する。処理速度関数は、予め定められている。処理速度関数は、例えば、低精度演算回路5に設けられる演算器の数、高精度演算回路6に設けられる演算器の数、低精度演算回路5が第1メモリ7にアクセスする場合のメモリアクセス量(メモリアクセス回数)、高精度演算回路6が第2メモリ8にアクセスする場合のメモリアクセス量(メモリアクセス回数)、および、低精度演算回路5と高精度演算回路6との間で授受されるデータ量(以下、データ授受量と記す場合がある。)を変数とする。以下、処理速度関数が、上記の各変数で表される場合を例にして説明する。ただし、処理速度関数で用いられる変数は、上記の例に限定されない。
The operation of the explanatory variable
なお、データ授受量は、例えば、授受されるデータの個数と、データ1個当たりのバイト数との積によって表される。この場合の単位は、例えば、バイトである。 The amount of data exchanged is represented by, for example, the product of the number of data exchanged and the number of bytes per data. The unit in this case is, for example, bytes.
説明変数値取得部23は、上記の各変数の値を処理速度関数に代入することによって、処理速度の値を計算すればよい。ここで、変数のうち、低精度演算回路5に設けられる演算器の数、高精度演算回路6に設けられる演算器の数は、設計情報で定められた値を用いればよい。低精度演算回路5が第1メモリ7にアクセスする場合のメモリアクセス量(メモリアクセス回数)、高精度演算回路6が第2メモリ8にアクセスする場合のメモリアクセス量(メモリアクセス回数)、および、低精度演算回路5と高精度演算回路6との間のデータ授受量に関しては、説明変数値取得部23が適用パターンを選択し、設計情報記憶部19に記憶された設計情報から定まる処理装置18の動作であって選択した適用パターンに応じた動作を模擬することによって、導出すればよい。説明変数値取得部23は、上記の演算器の数や、選択した適用パターンに基づいて導出したメモリアクセス量、低精度演算回路5と高精度演算回路6との間のデータ授受量を、処理速度関数に代入することによって、処理速度の値を計算すればよい。この結果、説明変数値取得部23は、シミュレーションに基づいて、処理速度の値を取得することができる。
The explanatory variable
説明変数値取得部23は、選択する適用パターンを順次、変更し、適用パターン毎に、シミュレーションに基づく処理速度の値を計算する。
The explanatory variable
説明変数値取得部23が「推論精度」の値をシミュレーションによって取得する動作を説明する。推論精度の値をシミュレーションによって取得する場合、説明変数値取得部23は、例えば、以下のように動作すればよい。説明変数値取得部23は、適用パターンを選択する。そして、説明変数値取得部23は、データ記憶部22に記憶されている複数個(本例では、N個)のデータ毎に、設計情報から定まる処理装置18の動作であって選択した適用パターンに応じた動作を模擬することによって、データに対する推論結果を導出する。この結果、N個の推論結果が得られる。説明変数値取得部23は、推論結果の数(N個)に対する、正解データと一致する推論結果の数の割合を算出し、さらにその割合の逆数を算出する。その割合の逆数が、推論精度の値に該当する。なお、説明変数値取得部23が推論精度の値をシミュレーションによって取得する動作は、上記の例に限定されない。
The operation of the explanatory variable
説明変数値取得部23は、指定する適用パターンを順次、変更し、適用パターン毎に、シミュレーションによって、推論精度の値を取得する。
The explanatory variable
本発明では、説明変数値取得部23は、説明変数の値を、実測によって取得してもよく、あるいは、シミュレーションによって取得してもよい。いずれの場合であっても、説明変数値取得部23は、適用パターン毎に説明変数(本例では、「推論精度」および「処理速度」)の値を取得する。
In the present invention, the explanatory variable
なお、上記の例のように、1つのデータに対する推論処理時間(換言すれば、1秒当たりに処理可能なデータ数の逆数)で処理速度を表わす場合、処理速度を示す値が小さい方が好ましい。同様に、N回の推論処理回数に対する、正解データが得られた推論処理回数の割合の逆数(換言すれば、推論結果の数(N個)に対する、正解データと一致する推論結果の数の割合の逆数)によって推論精度を表わす場合にも、推論精度を示す値が小さいほど好ましい。 When the processing speed is expressed by the inference processing time for one data (in other words, the reciprocal of the number of data that can be processed per second) as in the above example, it is preferable that the value indicating the processing speed is small. .. Similarly, the inverse of the ratio of the number of inference processes for which correct answer data was obtained to the number of inference processes of N times (in other words, the ratio of the number of inference results that match the correct answer data to the number of inference results (N)). Even when the inference accuracy is expressed by the inverse number of), the smaller the value indicating the inference accuracy, the more preferable.
目的関数計算部25は、説明変数値取得部23が適用パターン毎に算出した説明変数(本例では、「推論精度」および「処理速度」)の値を、目的関数を表わす式(本例では、前述の式(3))に代入することによって、目的関数の値を計算する。目的関数計算部25は、目的関数の値を計算する処理を、適用パターン毎に行う。
The objective
計算結果記憶部26は、適用パターン毎に計算された目的関数の値を記憶する記憶装置である。目的関数計算部25は、適用パターン毎に目的関数の値を計算し、適用パターン毎の目的関数の値を、計算結果記憶部26に記憶させる。
The calculation
前述のように、本例では、処理速度を示す値が小さい方が好ましく、同様に、推論精度を示す値が小さいほど好ましい。従って、式(3)に例示するように表される目的関数の値が小さいほど好ましい。従って、目的関数の値が最小となる適用パターンが最も好ましい適用パターン(すなわち、最適な適用パターン)であると言える。 As described above, in this example, it is preferable that the value indicating the processing speed is small, and similarly, it is preferable that the value indicating the inference accuracy is small. Therefore, it is preferable that the value of the objective function represented by the equation (3) is smaller. Therefore, it can be said that the application pattern in which the value of the objective function is the minimum is the most preferable application pattern (that is, the optimum application pattern).
適用パターン決定部27は、計算結果記憶部26に記憶された適用パターン毎の目的関数の値を参照し、目的関数の値が最小となる適用パターンを決定する。前述のように、目的関数の値が最小となる適用パターンは、最適な適用パターンである。
The application
ここで、適用パターンは、判別モデル(本実施形態では、ニューラルネットワーク)を用いた演算で、低精度演算回路5(図3参照)をニューラルネットワークのどの層に適用し、高精度演算回路6(図3参照)をニューラルネットワークのどの層に適用するのかを定めた情報である。従って、適用パターンが決定されることで、ニューラルネットワークを用いた演算を最適化することができる。そして、ニューラルネットワークの個々の層に、低精度演算回路5および高精度演算回路6のどちらを適用するのかが決定されるので、ニューラルネットワークの各層の演算精度を、第1の演算精度(例えば、低精度演算回路5による8ビットの整数演算)とするのか、第2の演算精度(例えば、高精度演算回路6による32ビットの浮動小数点演算)とするのかを決定することができる。
Here, the application pattern is an operation using a discrimination model (in this embodiment, a neural network), in which the low-precision arithmetic circuit 5 (see FIG. 3) is applied to which layer of the neural network, and the high-precision arithmetic circuit 6 (in this embodiment) (neural network). This is information that defines to which layer of the neural network (see FIG. 3) is applied. Therefore, by determining the application pattern, it is possible to optimize the calculation using the neural network. Then, since it is determined whether the low-
説明変数値取得部23、目的関数計算部25および適用パターン決定部27は、例えば、演算最適化プログラムに従って動作するコンピュータのCPU(Central Processing Unit )によって実現される。この場合、CPUが、プログラム記憶装置等のプログラム記録媒体から演算最適化プログラムを読み込む。そして、CPUは、その演算最適化プログラムに従って、説明変数値取得部23、目的関数計算部25および適用パターン決定部27として動作すればよい。
The explanatory variable
次に、本発明の実施形態の処理経過の例を説明する。図11は、本発明の実施形態の演算最適化装置の処理経過の例を示すフローチャートである。なお、ここでは、目的関数記憶部24が前述の式(3)で表される目的関数を記憶し、説明変数値取得部23が説明変数の値として、「推論精度」の値および「処理速度」の値を取得する場合を例にして説明する。また、既に説明した事項については、適宜、説明を省略する。
Next, an example of the processing process of the embodiment of the present invention will be described. FIG. 11 is a flowchart showing an example of the processing progress of the calculation optimization device according to the embodiment of the present invention. Here, the objective
まず、説明変数値取得部23は、予め記憶している複数の適用パターンの中から、未選択の適用パターンを1つ選択する(ステップS1)。
First, the explanatory variable
次に、説明変数値取得部23は、ステップS1で選択した適用パターンのもとでの推論処理の動作における説明変数の値を取得する(ステップS2)。本例では、説明変数値取得部23は、ステップS1で選択した適用パターンのもとでの動作における、「推論精度」の値、および、「処理速度」の値をそれぞれ取得する。
Next, the explanatory variable
説明変数値取得部23は、実測によって説明変数の値を取得してもよく、あるいは、シミュレーションによって説明変数の値を取得してもよい。実測により「推論精度」の値や「処理速度」の値を取得する動作や、シミュレーションにより「推論精度」の値や「処理速度」の値を取得する動作については、既に説明したので、ここでは説明を省略する。
The explanatory variable
ステップS2の後、目的関数計算部25は、選択された適用パターンに関してステップS2で取得された説明変数の値(本例では、「推論精度」の値、および、「処理速度」の値)を、目的関数を表わす式(本例では、前述の式(3))に代入することによって、目的関数の値を計算する(ステップS3)。そして、目的関数計算部25は、ステップS1で選択された適用パターンと、目的関数の値とを対応付けて、計算結果記憶部26に記憶させる。
After step S2, the objective
次に、説明変数値取得部23は、予め記憶している全ての適用パターンがステップS1で選択済みになっているか否かを判定する(ステップS4)。
Next, the explanatory variable
未選択の適用パターンが存在する場合には(ステップS4のNo)、演算最適化装置は、ステップS1以降の処理を繰り返す。 If there is an unselected application pattern (No in step S4), the arithmetic optimization device repeats the processes after step S1.
全ての適用パターンが選択済みとなっている場合には(ステップS4のYes)、適用パターン決定部27は、計算結果記憶部26に記憶された適用パターン毎の目的関数の値を参照し、目的関数の値が最小となる適用パターンを決定する(ステップS5)。ステップS5で処理を終了する。
When all the application patterns are selected (Yes in step S4), the application
既に説明したように、適用パターンが決定されることで、ニューラルネットワークを用いた演算を最適化することができる。そして、ニューラルネットワークの個々の層に、低精度演算回路5および高精度演算回路6のどちらを適用するのかが決定されるので、ニューラルネットワークの各層の演算精度を、第1の演算精度(例えば、低精度演算回路5による8ビットの整数演算)とするのか、第2の演算精度(例えば、高精度演算回路6による32ビットの浮動小数点演算)とするのかを決定することができる。
As described above, by determining the application pattern, it is possible to optimize the operation using the neural network. Then, since it is determined whether the low-
また、本実施形態では、上記のステップS1〜S5の処理によって、適用パターンを決定するので、自動的に適用パターンを決定することができる。従って、ニューラルネットワークの各層の演算精度を、第1の演算精度とするのか、第2の演算精度とするのかを自動的に決定することができる。 Further, in the present embodiment, since the application pattern is determined by the above steps S1 to S5, the application pattern can be automatically determined. Therefore, it is possible to automatically determine whether the calculation accuracy of each layer of the neural network is the first calculation accuracy or the second calculation accuracy.
次に、本発明の実施形態の変形例として、目的関数を、「推論精度」および「処理速度」に加えさらに他の説明変数によって表した場合を説明する。なお、以下に示す変形例の説明では、既に説明した事項については、適宜、説明を省略する。 Next, as a modification of the embodiment of the present invention, a case where the objective function is represented by other explanatory variables in addition to "inference accuracy" and "processing speed" will be described. In the description of the modification shown below, the description of the matters already described will be omitted as appropriate.
目的関数は、「推論精度」および「処理速度」に加えて、さらに、「低精度演算回路5と高精度演算回路6との間で授受されるデータ量」も説明変数として、表されてもよい。以下、「低精度演算回路5と高精度演算回路6との間で授受されるデータ量」を、単に、データ授受量と記す。既に説明したように、データ授受量は、例えば、授受されるデータの個数と、データ1個当たりのバイト数との積によって表される。
In addition to "inference accuracy" and "processing speed", the objective function may also be represented by "the amount of data exchanged between the low-
本例では、目的関数記憶部24は、目的関数として、例えば、以下の式(4)で表される関数を記憶すればよい。
In this example, the objective
目的関数=「推論精度」×α+「処理速度」×β+「データ授受量」×γ
・・・(4)Objective function = "inference accuracy" x α + "processing speed" x β + "data transfer amount" x γ
... (4)
γは、「データ授受量」の係数であり、予め決定されている。本例では、γが正の値として定められている場合を例にして説明する。 γ is a coefficient of “data transfer amount” and is predetermined. In this example, the case where γ is defined as a positive value will be described as an example.
本変形例では、説明変数値取得部23は、「推論精度」および「処理速度」の他に、「データ授受量」の値も適用パターン毎に取得する。
In this modification, the explanatory variable
説明変数値取得部23が「データ授受量」の値を実測によって取得する動作を説明する。説明変数値取得部23は、処理装置18に対して適用パターンを指定する。そして、説明変数値取得部23は、判別モデル記憶部21に記憶されているニューラルネットワークと、データ記憶部22に記憶されているデータとを、処理装置18に入力し、処理装置18に推論処理を実行させ、処理装置18がそのデータに対する推論処理を行う際のデータ授受量を計測すればよい、この結果、説明変数値取得部23は、データ授受量の値を取得する。また、このとき、処理装置18は、指定された適用パターンに応じた動作で、推論処理を実行する。なお、説明変数値取得部23は、1つのデータに関して、処理装置18に推論処理を実行させることで、データ授受量の値を取得することができる。
The operation of the explanatory variable
説明変数値取得部23は、指定する適用パターンを順次、変更し、適用パターン毎に、実測によってデータ授受量の値を取得する。
The explanatory variable
説明変数値取得部23が「データ授受量」の値をシミュレーションによって取得する動作を説明する。説明変数値取得部23は、適用パターンを選択し、設計情報記憶部19に記憶された設計情報から定まる処理装置18の動作であって選択した適用パターンに応じた動作を模擬することによって、データ授受量の値を導出すればよい。なお、説明変数値取得部23は、1つのデータに関して、処理装置18の動作を模擬することで、データ授受量の値を導出することができる。
The operation of the explanatory variable
説明変数値取得部23は、選択する適用パターンを順次、変更し、適用パターン毎に、シミュレーションによってデータ授受量の値を導出する。
The explanatory variable
本変形例では、目的関数計算部25は、「推論精度」の値、「処理速度」の値、および、「データ授受量」の値を式(4)に代入することによって、適用パターン毎に目的関数の値を計算すればよい。
In this modification, the objective
その他の点に関しては、上記の実施形態と同様である。 Other points are the same as those in the above embodiment.
本変形例によれば、「データ授受量」も加味して、ニューラルネットワークの各層の演算精度を、第1の演算精度とするのか、第2の演算精度とするのかを決定することができる。 According to this modification, it is possible to determine whether the calculation accuracy of each layer of the neural network is the first calculation accuracy or the second calculation accuracy in consideration of the “data transfer amount”.
また、目的関数は、「推論精度」および「処理速度」に加えて、さらに、「処理装置18の回路規模(以下、単に回路規模と記す。)」を説明変数として、表されてもよい。 Further, the objective function may be expressed using "the circuit scale of the processing device 18 (hereinafter, simply referred to as the circuit scale)" as an explanatory variable in addition to the "inference accuracy" and the "processing speed".
本例では、目的関数記憶部24は、目的関数として、例えば、以下の式(5)で表される関数を記憶すればよい。
In this example, the objective
目的関数=「推論精度」×α+「処理速度」×β+「回路規模」×δ
・・・(5)Objective function = "inference accuracy" x α + "processing speed" x β + "circuit scale" x δ
... (5)
δは、「回路規模」の係数であり、予め決定されている。本例では、δが正の値として定められている場合を例にして説明する。 δ is a coefficient of “circuit scale” and is predetermined. In this example, the case where δ is defined as a positive value will be described as an example.
以下の説明では、低精度演算回路5に含まれる演算器(例えば、MAC)、および、高精度演算回路6に含まれる演算器(例えば、MAC)の個数を、低精度演算回路5に含まれる演算器、または、高精度演算回路6に含まれる演算器を基準として表した値を、「回路規模」とする場合を例にして説明する。本例では、低精度演算回路5に含まれる演算器を基準とするものとして説明する。低精度演算回路5に含まれる演算器を基準とする場合、高精度演算回路6に含まれる演算器の個数を、低精度演算回路5に含まれる演算器の何個分に相当するかという値に変換して表わす。また、高精度演算回路6に含まれる1個の演算器が、低精度演算回路5に含まれる演算器何個分に相当するかは、高精度演算回路6に含まれる1個の演算器の占有面積が、低精度演算回路5に含まれる演算器何個分の占有面積に相当するかによって求めればよい。以下、説明を簡単にするために、高精度演算回路6に含まれる1個の演算器が、低精度演算回路5に含まれる演算器J個分に相当するものとして説明する。
In the following description, the number of arithmetic units (for example, MAC) included in the low-
本変形例では、説明変数値取得部23は、「推論精度」および「処理速度」の他に、「回路規模」の値も取得する。
In this modification, the explanatory variable
説明変数値取得部23が「回路規模」の値を実測によって取得する動作を説明する。処理装置18が存在する場合には、その処理装置18内の低精度演算回路5に含まれる演算器の個数、高精度演算回路6に含まれる演算器の個数、および、高精度演算回路6に含まれる1個の演算器が、低精度演算回路5に含まれる演算器何個分に相当するかという情報は、既知の情報である。説明変数値取得部23は、例えば、この既知の情報を、予め記憶しているものとする。また、説明を簡単にするために、高精度演算回路6に含まれる1個の演算器が、低精度演算回路5に含まれる演算器J個分に相当するものとして説明する。
The operation of the explanatory variable
この場合、説明変数値取得部23は、以下に示す式(6)の計算によって、「回路規模」の値を計算すればよい。
In this case, the explanatory variable
回路規模=「低精度演算回路5に含まれる演算器の個数」+
「高精度演算回路6に含まれる演算器の個数」×J
・・・(6)Circuit scale = "Number of arithmetic units included in low-
"Number of arithmetic units included in high-precision arithmetic circuit 6" x J
... (6)
なお、上記の例では、回路規模の値は、適用パターンに依存しないので、説明変数値取得部23は、回路規模の値を、各適用パターンで共通の値として算出してよい。
In the above example, since the value of the circuit scale does not depend on the application pattern, the explanatory variable
説明変数値取得部23が「回路規模」の値をシミュレーションによって取得する動作を説明する。この場合、設計情報記憶部19(図10参照)が記憶する設計情報に、低精度演算回路5に含まれる演算器の個数の設計値、高精度演算回路6に含まれる演算器の個数の設計値、および、高精度演算回路6に含まれる1個の演算器が、低精度演算回路5に含まれる演算器何個分に相当するかという設計値を含めておけばよい。本例においても、高精度演算回路6に含まれる1個の演算器が、低精度演算回路5に含まれる演算器J個分に相当するものとして説明する。
The operation in which the explanatory variable
この場合、説明変数値取得部23は、以下に示す式(7)の計算によって、「回路規模」の値を計算すればよい。
In this case, the explanatory variable
回路規模=「低精度演算回路5に含まれる演算器の個数の設計値」+
「高精度演算回路6に含まれる演算器の個数の設計値」×J
・・・(7)Circuit scale = "Design value of the number of arithmetic units included in the low-
"Design value of the number of arithmetic units included in the high-precision arithmetic circuit 6" x J
... (7)
なお、上記の例では、回路規模の値は、適用パターンに依存しないので、説明変数値取得部23は、回路規模の値を、各適用パターンで共通の値として算出してよい。
In the above example, since the value of the circuit scale does not depend on the application pattern, the explanatory variable
また、シミュレーションによって「回路規模」の値を取得する場合、説明変数値取得部23は、演算器の個数を低精度演算回路5に含まれる演算器等を基準として表した値とは異なる値で求めてもよい。例えば、説明変数値取得部23は、「回路規模」の値を求めるための関数(以下、回路規模関数と記す。)によって、回路規模の値を計算してもよい。この場合、説明変数値取得部23は、回路規模関数を予め保持する。また、回路規模関数は、予め定められている。回路規模関数は、例えば、低精度演算回路5に設けられる演算器の数、高精度演算回路6に設けられる演算器の数、低精度演算回路5がアクセスする第1メモリ7(図3参照)のメモリサイズ、高精度演算回路6がアクセスする第2メモリ8(図3参照)のメモリサイズ、および、データ授受量(低精度演算回路5と高精度演算回路6との間で授受されるデータ量)を変数とする。以下、回路規模関数が、上記の各変数で表される場合を例にして説明する。ただし、回路規模関数で用いられる変数は、上記の例に限定されない。第1メモリ7のメモリサイズ、および、第2メモリ8のメモリサイズは、設計情報として設計情報記憶部19に記憶させておけばよい。
Further, when the value of "circuit scale" is acquired by simulation, the explanatory variable
説明変数値取得部23は、上記の各変数の値を回路規模関数に代入することによって、回路規模の値を計算すればよい。ここで、変数のうち、低精度演算回路5に設けられる演算器の数、高精度演算回路6に設けられる演算器の数、第1メモリ7のメモリサイズ、および、第2メモリ8のメモリサイズは、設計情報で定められた値を用いればよい。データ授受量に関しては、説明変数値取得部23が適用パターンを選択し、設計情報記憶部19に記憶された設計情報から定まる処理装置18の動作であって選択した適用パターンに応じた動作を模擬することによって、導出すればよい。説明変数値取得部23は、上記の演算器の数やメモリサイズ、および、選択した適用パターンに基づいて導出したデータ授受量を回路規模関数に代入することによって、回路規模の値を計算すればよい。また、この場合、説明変数値取得部23は、選択する適用パターンを順次、変更し、適用パターン毎に、シミュレーションに基づく回路規模の値を計算する。
The explanatory variable
本変形例では、目的関数計算部25は、「推論精度」の値、「処理速度」の値、および、「回路規模」の値を式(5)に代入することによって、適用パターン毎に目的関数の値を計算すればよい。
In this modification, the objective
その他の点に関しては、上記の実施形態と同様である。 Other points are the same as those in the above embodiment.
本変形例によれば、「回路規模」も加味して、ニューラルネットワークの各層の演算精度を、第1の演算精度とするのか、第2の演算精度とするのかを決定することができる。 According to this modification, it is possible to determine whether the calculation accuracy of each layer of the neural network is the first calculation accuracy or the second calculation accuracy in consideration of the “circuit scale”.
また、目的関数は、「推論精度」および「処理速度」に加えて、さらに、「処理装置18の消費電力(以下、単に消費電力と記す。)」を説明変数として、表されてもよい。 Further, the objective function may be expressed with "power consumption of the processing device 18 (hereinafter, simply referred to as power consumption)" as an explanatory variable in addition to "inference accuracy" and "processing speed".
本例では、目的関数記憶部24は、目的関数として、例えば、以下の式(8)で表される関数を記憶すればよい。
In this example, the objective
目的関数=「推論精度」×α+「処理速度」×β+「消費電力」×ε
・・・(8)Objective function = "inference accuracy" x α + "processing speed" x β + "power consumption" x ε
... (8)
εは、「消費電力」の係数であり、予め決定されている。本例では、εが正の値として定められている場合を例にして説明する。 ε is a coefficient of "power consumption" and is predetermined. In this example, the case where ε is defined as a positive value will be described as an example.
本変形例では、説明変数値取得部23は、「推論精度」および「処理速度」の他に、「消費電力」の値も適用パターン毎に取得する。
In this modification, the explanatory variable
説明変数値取得部23が「消費電力」の値を実測によって取得する動作を説明する。説明変数値取得部23は、処理装置18に対して適用パターンを指定する。そして、説明変数値取得部23は、判別モデル記憶部21に記憶されているニューラルネットワークと、データ記憶部22に記憶されているデータとを、処理装置18に入力し、処理装置18に推論処理を実行させ、処理装置18がそのデータに対する推論処理を行う際の消費電力を計測すればよい。この結果、説明変数値取得部23は、消費電力の値を取得する。また、このとき、処理装置18は、指定された適用パターンに応じた動作で、推論処理を実行する。なお、説明変数値取得部23は、1つのデータに関して、処理装置18に推論処理を実行させることで、消費電力の値を取得することができる。
The operation of the explanatory variable
説明変数値取得部23は、指定する適用パターンを順次、変更し、適用パターン毎に、実測によって消費電力の値を取得する。
The explanatory variable
説明変数値取得部23が「消費電力」の値をシミュレーションによって取得する動作を説明する。「消費電力」の値をシミュレーションによって導出する場合、設計段階で定められている、消費電力値導出に必要なデータを、設計情報記憶部19に記憶される設計情報に含めておく。説明変数値取得部23は、適用パターンを選択し、設計情報記憶部19に記憶された設計情報から定まる処理装置18の動作であって選択した適用パターンに応じた動作を模擬することによって、消費電力の値を導出すればよい。なお、説明変数値取得部23は、1つのデータに関して、処理装置18の動作を模擬することで、消費電力の値を導出することができる。
The operation of the explanatory variable
説明変数値取得部23は、選択する適用パターンを順次、変更し、適用パターン毎に、シミュレーションによって消費電力の値を導出する。
The explanatory variable
本変形例では、目的関数計算部25は、「推論精度」の値、「処理速度」の値、および、「消費電力」の値を式(8)に代入することによって、適用パターン毎に目的関数の値を計算すればよい。
In this modification, the objective
その他の点に関しては、上記の実施形態と同様である。 Other points are the same as those in the above embodiment.
本変形例によれば、「消費電力」も加味して、ニューラルネットワークの各層の演算精度を、第1の演算精度とするのか、第2の演算精度とするのかを決定することができる。 According to this modification, it is possible to determine whether the calculation accuracy of each layer of the neural network is the first calculation accuracy or the second calculation accuracy in consideration of "power consumption".
上記の各変形例では、目的関数が、「推論精度」および「処理速度」に加えて、さらに、「データ授受量」、「回路規模」および「消費電力」のいずれかを説明変数として表される場合を説明した。目的関数は、「推論精度」および「処理速度」に加えて、さらに、「データ授受量」、「回路規模」および「消費電力」のうちの任意の1つ以上の説明変数によって表されていてもよい。 In each of the above variants, the objective function is represented in addition to "inference accuracy" and "processing speed", with any of "data transfer amount", "circuit scale", and "power consumption" as explanatory variables. I explained the case. The objective function is represented by any one or more explanatory variables of "data transfer amount", "circuit scale" and "power consumption" in addition to "inference accuracy" and "processing speed". May be good.
目的関数が、「推論精度」、「処理速度」、「データ授受量」、「回路規模」および「消費電力」を説明変数として表されていてもよい。この場合、目的関数記憶部24は、目的関数として、例えば、以下の式(9)で表される関数を記憶すればよい。
The objective function may be expressed with "inference accuracy", "processing speed", "data transfer amount", "circuit scale", and "power consumption" as explanatory variables. In this case, the objective
目的関数=「推論精度」×α+「処理速度」×β+「データ授受量」×γ
+「回路規模」×δ+「消費電力」×ε
・・・(9)Objective function = "inference accuracy" x α + "processing speed" x β + "data transfer amount" x γ
+ "Circuit scale" x δ + "Power consumption" x ε
... (9)
この場合、説明変数値取得部23は、実測により、または、シミュレーションにより、各説明変数(「推論精度」、「処理速度」、「データ授受量」、「回路規模」および「消費電力」)の値を、適用パターン毎に取得すればよい。
In this case, the explanatory variable
また、目的関数計算部25は、説明変数値取得部23によって取得された各説明変数の値を式(9)に代入することによって、適用パターン毎に目的関数の値を計算すればよい。
Further, the objective
この場合、「データ授受量」、「回路規模」および「消費電力」も加味して、ニューラルネットワークの各層の演算精度を、第1の演算精度とするのか、第2の演算精度とするのかを決定することができる。 In this case, whether the calculation accuracy of each layer of the neural network is the first calculation accuracy or the second calculation accuracy in consideration of "data transfer amount", "circuit scale", and "power consumption". Can be decided.
なお、式(9)において、「データ授受量」×γの項が含まれていなくてもよい。この場合、説明変数値取得部23は、「データ授受量」の値を取得しなくてよい。
It should be noted that the term “data transfer amount” × γ may not be included in the equation (9). In this case, the explanatory variable
また、式(9)において、「回路規模」×δの項が含まれていなくてもよい。この場合、説明変数値取得部23は、「回路規模」の値を取得しなくてよい。
Further, the term “circuit scale” × δ may not be included in the equation (9). In this case, the explanatory variable
また、式(9)において、「消費電力」×εの項が設けられていなくてもよい。この場合、説明変数値取得部23は、「消費電力」の値を取得しなくてよい。
Further, in the equation (9), the term “power consumption” × ε may not be provided. In this case, the explanatory variable
図12は、本発明の実施形態またはその変形例に係るコンピュータの構成例を示す概略ブロック図である。コンピュータ1000は、CPU1001と、主記憶装置1002と、補助記憶装置1003と、インタフェース1004とを備える。
FIG. 12 is a schematic block diagram showing a configuration example of a computer according to an embodiment of the present invention or a modification thereof. The
本発明の演算最適化装置は、コンピュータ1000に実装される。演算最適化装置の動作は、演算最適化プログラムの形式で補助記憶装置1003に記憶されている。CPU1001は、その演算最適化プログラムを補助記憶装置1003から読み出して主記憶装置1002に展開し、その演算最適化プログラムに従って、上記の実施形態やその変形例で説明した処理を実行する。
The arithmetic optimization device of the present invention is mounted on the
補助記憶装置1003は、一時的でない有形の媒体の例である。一時的でない有形の媒体の他の例として、インタフェース1004を介して接続される磁気ディスク、光磁気ディスク、CD−ROM(Compact Disk Read Only Memory )、DVD−ROM(Digital Versatile Disk Read Only Memory )、半導体メモリ等が挙げられる。また、プログラムが通信回線によってコンピュータ1000に配信される場合、配信を受けたコンピュータ1000がそのプログラムを主記憶装置1002に展開し、上記の処理を実行してもよい。
また、プログラムは、前述の処理の一部を実現するためのものであってもよい。さらに、プログラムは、補助記憶装置1003に既に記憶されている他のプログラムとの組み合わせで前述の処理を実現する差分プログラムであってもよい。
Further, the program may be for realizing a part of the above-mentioned processing. Further, the program may be a difference program that realizes the above-mentioned processing in combination with another program already stored in the
また、各構成要素の一部または全部は、汎用または専用の回路(circuitry )、プロセッサ等やこれらの組み合わせによって実現されてもよい。これらは、単一のチップによって構成されてもよいし、バスを介して接続される複数のチップによって構成されてもよい。各構成要素の一部または全部は、上述した回路等とプログラムとの組み合わせによって実現されてもよい。 Further, a part or all of each component may be realized by a general-purpose or dedicated circuitry, a processor, or a combination thereof. These may be composed of a single chip or may be composed of a plurality of chips connected via a bus. A part or all of each component may be realized by the combination of the circuit or the like and the program described above.
各構成要素の一部または全部が複数の情報処理装置や回路等により実現される場合には、複数の情報処理装置や回路等は集中配置されてもよいし、分散配置されてもよい。例えば、情報処理装置や回路等は、クライアントアンドサーバシステム、クラウドコンピューティングシステム等、各々が通信ネットワークを介して接続される形態として実現されてもよい。 When a part or all of each component is realized by a plurality of information processing devices and circuits, the plurality of information processing devices and circuits may be centrally arranged or distributed. For example, the information processing device, the circuit, and the like may be realized as a form in which each is connected via a communication network, such as a client-and-server system and a cloud computing system.
次に、本発明の概要について説明する。図13は、本発明の演算最適化装置の概要を示すブロック図である。本発明の演算最適化装置は、説明変数値取得手段73と、目的関数計算手段75と、適用パターン決定手段77とを備える。 Next, the outline of the present invention will be described. FIG. 13 is a block diagram showing an outline of the calculation optimization device of the present invention. The arithmetic optimization apparatus of the present invention includes explanatory variable value acquisition means 73, objective function calculation means 75, and application pattern determination means 77.
説明変数値取得手段73(例えば、説明変数値取得部23)は、1つ以上のユニットでそれぞれ構成された複数の層が結合された判別モデル(例えば、ニューラルネットワーク)を用いた演算で、第1の演算精度で演算を行う第1の演算回路(例えば、低精度演算回路5)をどの層に適用し、第1の演算精度よりも高い第2の演算精度で演算を行う第2の演算回路(例えば、高精度演算回路6)をどの層に適用するかを定めた情報である適用パターン毎に、所定の説明変数の値を取得する。 The explanatory variable value acquisition means 73 (for example, the explanatory variable value acquisition unit 23) is an operation using a discrimination model (for example, a neural network) in which a plurality of layers each composed of one or more units are connected. A second calculation in which the first calculation circuit (for example, the low-precision calculation circuit 5) that performs the calculation with the calculation accuracy of 1 is applied to which layer, and the calculation is performed with the second calculation accuracy higher than the first calculation accuracy. The value of a predetermined explanatory variable is acquired for each application pattern, which is information that defines to which layer the circuit (for example, the high-precision arithmetic circuit 6) is applied.
目的関数計算手段75(例えば、目的関数計算部25)は、所定の説明変数で表される目的関数の値を、適用パターン毎に計算する。 The objective function calculation means 75 (for example, the objective function calculation unit 25) calculates the value of the objective function represented by a predetermined explanatory variable for each application pattern.
適用パターン決定手段77(例えば、適用パターン決定部27)は、目的関数の値が最小となる適用パターンを決定する。 The application pattern determination means 77 (for example, the application pattern determination unit 27) determines the application pattern that minimizes the value of the objective function.
そのような構成によって、判別モデルを用いた演算を最適化できるように、判別モデルの各層における演算精度を自動的に定めることができる。 With such a configuration, the calculation accuracy in each layer of the discrimination model can be automatically determined so that the calculation using the discrimination model can be optimized.
目的関数は、少なくとも、判別モデルを用いた演算の処理速度、および、演算結果の正確さを所定の説明変数として表されていてもよい。 The objective function may at least represent the processing speed of the operation using the discriminant model and the accuracy of the operation result as predetermined explanatory variables.
目的関数は、第1の演算回路と第2の演算回路との間で授受されるデータ量を所定の説明変数として表されていてもよい。 The objective function may represent the amount of data exchanged between the first arithmetic circuit and the second arithmetic circuit as a predetermined explanatory variable.
目的関数は、判別モデルを用いた演算を行う回路の回路規模を所定の説明変数として表されていてもよい。 The objective function may be expressed as a predetermined explanatory variable of the circuit scale of the circuit that performs the calculation using the discrimination model.
目的関数は、判別モデルを用いた演算での消費電力を所定の説明変数として表されていてもよい。 The objective function may express the power consumption in the calculation using the discriminant model as a predetermined explanatory variable.
説明変数値取得手段73が、所定の説明変数の値を実測により取得する構成であってもよい。 The explanatory variable value acquisition means 73 may be configured to acquire the value of a predetermined explanatory variable by actual measurement.
説明変数値取得手段73が、所定の説明変数の値をシミュレーションにより取得する構成であってもよい。 The explanatory variable value acquisition means 73 may be configured to acquire the value of a predetermined explanatory variable by simulation.
以上、実施形態を参照して本願発明を説明したが、本願発明は上記の実施形態に限定されるものではない。本願発明の構成や詳細には、本願発明のスコープ内で当業者が理解し得る様々な変更をすることができる。 Although the invention of the present application has been described above with reference to the embodiments, the invention of the present application is not limited to the above-described embodiment. Various changes that can be understood by those skilled in the art can be made within the scope of the present invention in terms of the configuration and details of the present invention.
本発明は、例えば、ニューラルネットワーク等の判別モデルを用いた演算を最適化する演算最適化装置に好適に適用される。 The present invention is suitably applied to, for example, an operation optimization device that optimizes an operation using a discrimination model such as a neural network.
5 低精度演算回路
6 高精度演算回路
7 第1メモリ
8 第2メモリ
9 第3メモリ
18 処理装置
19 設計情報記憶部
21 判別モデル記憶部
22 データ記憶部
23 説明変数値取得部
24 目的関数記憶部
25 目的関数計算部
26 計算結果記憶部
27 適用パターン決定部5 Low-precision arithmetic circuit 6 High-precision arithmetic circuit 7
Claims (9)
前記所定の説明変数で表される目的関数の値を、適用パターン毎に計算する目的関数計算手段と、
目的関数の値が最小となる適用パターンを決定する適用パターン決定手段とを備える
ことを特徴とする演算最適化装置。In the calculation using the discrimination model in which a plurality of layers each composed of one or more units are combined, the first calculation circuit that performs the calculation with the first calculation accuracy is applied to which layer, and the first Explanatory variable value acquisition to acquire the value of a predetermined explanatory variable for each application pattern, which is information that defines to which layer the second arithmetic circuit that performs arithmetic with a second arithmetic accuracy higher than the arithmetic accuracy is applied. Means and
An objective function calculation means for calculating the value of the objective function represented by the predetermined explanatory variable for each application pattern,
An arithmetic optimization device including an application pattern determining means for determining an application pattern that minimizes the value of an objective function.
請求項1に記載の演算最適化装置。The calculation optimization device according to claim 1, wherein the objective function is at least the processing speed of the calculation using the discrimination model and the accuracy of the calculation result as predetermined explanatory variables.
請求項2に記載の演算最適化装置。The arithmetic optimization device according to claim 2, wherein the objective function represents the amount of data exchanged between the first arithmetic circuit and the second arithmetic circuit as a predetermined explanatory variable.
請求項2または請求項3に記載の演算最適化装置。The operation optimization device according to claim 2 or 3, wherein the objective function represents the circuit scale of a circuit that performs an operation using a discrimination model as a predetermined explanatory variable.
請求項2から請求項4のうちのいずれか1項に記載の演算最適化装置。The calculation optimization device according to any one of claims 2 to 4, wherein the objective function represents the power consumption in the calculation using the discrimination model as a predetermined explanatory variable.
請求項1から請求項5のうちのいずれか1項に記載の演算最適化装置。The arithmetic optimization device according to any one of claims 1 to 5, wherein the explanatory variable value acquisition means acquires the value of a predetermined explanatory variable by actual measurement.
請求項1から請求項5のうちのいずれか1項に記載の演算最適化装置。The arithmetic optimization device according to any one of claims 1 to 5, wherein the explanatory variable value acquisition means acquires the value of a predetermined explanatory variable by simulation.
前記所定の説明変数で表される目的関数の値を、適用パターン毎に計算し、
目的関数の値が最小となる適用パターンを決定する
ことを特徴とする演算最適化方法。In the calculation using a discrimination model in which a plurality of layers each composed of one or more units are combined, the first calculation circuit that performs the calculation with the first calculation accuracy is applied to which layer, and the first The value of a predetermined explanatory variable is acquired for each application pattern, which is information that defines to which layer the second arithmetic circuit that performs the arithmetic with the second arithmetic accuracy higher than the arithmetic accuracy is applied.
The value of the objective function represented by the predetermined explanatory variable is calculated for each application pattern, and the value is calculated.
An arithmetic optimization method characterized by determining the application pattern that minimizes the value of the objective function.
1つ以上のユニットでそれぞれ構成された複数の層が結合された判別モデルを用いた演算で、第1の演算精度で演算を行う第1の演算回路をどの層に適用し、前記第1の演算精度よりも高い第2の演算精度で演算を行う第2の演算回路をどの層に適用するかを定めた情報である適用パターン毎に、所定の説明変数の値を取得する説明変数値取得処理、
前記所定の説明変数で表される目的関数の値を、適用パターン毎に計算する目的関数計算処理、および、
目的関数の値が最小となる適用パターンを決定する適用パターン決定処理
を実行させるための演算最適化プログラム。On the computer
In the calculation using the discrimination model in which a plurality of layers each composed of one or more units are combined, the first calculation circuit that performs the calculation with the first calculation accuracy is applied to which layer, and the first Explanatory variable value acquisition to acquire the value of a predetermined explanatory variable for each application pattern, which is information that defines to which layer the second arithmetic circuit that performs arithmetic with a second arithmetic accuracy higher than the arithmetic accuracy is applied. process,
Objective function calculation processing that calculates the value of the objective function represented by the predetermined explanatory variable for each application pattern, and
An arithmetic optimization program for executing the application pattern determination process that determines the application pattern that minimizes the value of the objective function.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/JP2018/030769 WO2020039493A1 (en) | 2018-08-21 | 2018-08-21 | Computation optimization device, method, and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JPWO2020039493A1 JPWO2020039493A1 (en) | 2021-04-30 |
JP6973651B2 true JP6973651B2 (en) | 2021-12-01 |
Family
ID=69592083
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2020537921A Active JP6973651B2 (en) | 2018-08-21 | 2018-08-21 | Arithmetic optimizers, methods and programs |
Country Status (2)
Country | Link |
---|---|
JP (1) | JP6973651B2 (en) |
WO (1) | WO2020039493A1 (en) |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB201607713D0 (en) * | 2016-05-03 | 2016-06-15 | Imagination Tech Ltd | Convolutional neural network |
US10621486B2 (en) * | 2016-08-12 | 2020-04-14 | Beijing Deephi Intelligent Technology Co., Ltd. | Method for optimizing an artificial neural network (ANN) |
-
2018
- 2018-08-21 JP JP2020537921A patent/JP6973651B2/en active Active
- 2018-08-21 WO PCT/JP2018/030769 patent/WO2020039493A1/en active Application Filing
Also Published As
Publication number | Publication date |
---|---|
WO2020039493A1 (en) | 2020-02-27 |
JPWO2020039493A1 (en) | 2021-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10963787B2 (en) | Systems and methods for generation of sparse code for convolutional neural networks | |
US20190370647A1 (en) | Artificial intelligence analysis and explanation utilizing hardware measures of attention | |
US10540145B2 (en) | Method and processing apparatus for performing arithmetic operation | |
US20190095796A1 (en) | Methods and arrangements to determine physical resource assignments | |
JP2019145111A (en) | Model calculation unit for calculating function model based on data, controller, and method | |
Rothmann et al. | A survey of domain-specific architectures for reinforcement learning | |
JP6991983B2 (en) | How and systems to train machine learning systems | |
JP2021532437A (en) | Improving machine learning models to improve locality | |
CN112513886A (en) | Information processing method, information processing apparatus, and information processing program | |
JP7068242B2 (en) | Learning equipment, learning methods and programs | |
Neumann et al. | Quantum reinforcement learning: Comparing quantum annealing and gate-based quantum computing with classical deep reinforcement learning | |
Hamanaka et al. | An exploration of state-of-the-art automation frameworks for FPGA-based DNN acceleration | |
JP6973651B2 (en) | Arithmetic optimizers, methods and programs | |
US20200089729A1 (en) | Optimization problem arithmetic method and optimization problem arithmetic apparatus | |
WO2021054990A1 (en) | Systems and methods for generation of sparse code for convolutional neural networks | |
JP7042870B2 (en) | Methods, devices, devices and computer-readable storage media performed by computing devices | |
JP7107797B2 (en) | Information processing method and information processing system | |
JP2022034897A (en) | Information processing device, machine learning method and machine learning program | |
US10929177B2 (en) | Managing resources for multiple trial distributed processing tasks | |
Manca et al. | Recurrent solutions to dynamics inverse problems: a validation of MP regression | |
KR20200090061A (en) | Method and apparatus for artificial neural network | |
KR20150064673A (en) | Method and device for determining a gradient of a data-based function model | |
Nozdrzykowski et al. | Testing the significance of parameters of models estimating execution time of parallel program loops according to the Open MPI Standard | |
JP2020184268A (en) | Arithmetic processing unit, arithmetic processing program, and arithmetic processing method | |
WO2022260171A1 (en) | Estimation device and model generation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20201020 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20211005 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20211018 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6973651 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |