JP7350214B2 - Inference device, inference method, and inference program - Google Patents
Inference device, inference method, and inference program Download PDFInfo
- Publication number
- JP7350214B2 JP7350214B2 JP2023508251A JP2023508251A JP7350214B2 JP 7350214 B2 JP7350214 B2 JP 7350214B2 JP 2023508251 A JP2023508251 A JP 2023508251A JP 2023508251 A JP2023508251 A JP 2023508251A JP 7350214 B2 JP7350214 B2 JP 7350214B2
- Authority
- JP
- Japan
- Prior art keywords
- quantization
- inference
- quantized
- data
- feature data
- 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
- G06N20/00—Machine learning
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Medical Informatics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Artificial Intelligence (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Description
本開示は、推論装置、推論方法、及び、推論プログラムに関する。 The present disclosure relates to an inference device, an inference method, and an inference program.
ディープラーニングの推論環境を組込機器等のリソース制約がある装置に搭載する場合、ディープラーニングに関する演算を軽量化する必要がある。軽量化する手法の一つとして、浮動小数点演算を固定小数点演算又は整数演算に置き換える技術がある。当該技術は、一般的に量子化と呼ばれる。特許文献1は、推論を高速化するための量子化を比較的高い精度で実施するために統計的手法を用いてデータ分布を推定する技術を開示している。 When installing a deep learning inference environment on a device with resource constraints such as an embedded device, it is necessary to reduce the weight of deep learning calculations. One method for reducing the weight is to replace floating point operations with fixed point operations or integer operations. This technique is commonly called quantization. Patent Document 1 discloses a technique of estimating data distribution using a statistical method in order to perform quantization with relatively high accuracy to speed up inference.
特許文献1が開示する技術によれば、量子化において、学習用データセット等を用いた場合においてオーバーフローが発生しないよう、推論に関する演算のパラメータ等が調整される。しかしながら、学習用データセット等があらゆる推論用データを網羅することはできない。そのため、特許文献1が開示する技術によれば、どのような推論用データを用いた場合であってもオーバーフローが発生しないことを保証することはできず、推論用データによってはオーバーフローが発生し得るという課題がある。ここで、推論用データは機密情報であることもあるため、ある推論用データを用いて推論を実行した際にオーバーフローが発生した場合であっても、発生したオーバーフローを当該ある推論用データを用いて解析することができるとは限らない。 According to the technology disclosed in Patent Document 1, in quantization, parameters of calculations related to inference are adjusted so that overflow does not occur when a learning data set or the like is used. However, the training data set etc. cannot cover all inference data. Therefore, according to the technology disclosed in Patent Document 1, it cannot be guaranteed that overflow will not occur no matter what kind of inference data is used, and overflow may occur depending on the inference data. There is a problem. Here, since the inference data may be confidential information, even if an overflow occurs when inference is performed using a certain inference data, the overflow that has occurred can be handled using the inference data. It is not always possible to analyze the
本開示は、ある推論用データを用いて推論を実行した際にオーバーフローが発生した場合において、発生したオーバーフローを解析するためのデータであって当該ある推論用データとは異なるデータを取得することを目的とする。 The present disclosure provides a method for acquiring data for analyzing the overflow that is different from the certain inference data when an overflow occurs when inference is performed using certain inference data. purpose.
本開示に係る推論装置は、
推論用データを用いて機械学習の手法に基づいた少なくとも1回の量子化演算を実行する量子化推論部と、
前記推論用データを用いて前記少なくとも1回の量子化演算それぞれに対応する少なくとも1回の非量子化演算の少なくともいずれかを実行する非量子化推論部と
を備える推論装置であって、
前記少なくとも1回の量子化演算それぞれは、前記少なくとも1回の量子化演算それぞれの特徴を示す少なくとも1つの量子化特徴データそれぞれに応じた演算であり、
前記少なくとも1回の非量子化演算それぞれは、前記少なくとも1回の非量子化演算それぞれの特徴を示す少なくとも1つの非量子化特徴データそれぞれに応じた演算であり、
前記推論装置は、さらに、
前記少なくとも1回の量子化演算の少なくともいずれかにおいてオーバーフローが発生した場合に、オーバーフローが発生した量子化演算の各々に対応する量子化特徴データと、オーバーフローが発生した量子化演算の各々に対応する非量子化演算に対応する非量子化特徴データとを抽出するデータ抽出部
を備える。
The inference device according to the present disclosure includes:
a quantization inference unit that performs at least one quantization operation based on a machine learning method using the inference data;
An inference device comprising: a non-quantization inference unit that executes at least one of at least one non-quantization operation corresponding to each of the at least one quantization operation using the inference data,
Each of the at least one quantization operation is an operation corresponding to at least one quantization feature data indicating a characteristic of each of the at least one quantization operation,
Each of the at least one non-quantized operation is an operation according to each of at least one non-quantized feature data indicating the characteristics of each of the at least one non-quantized operation,
The inference device further includes:
When an overflow occurs in at least one of the at least one quantization operation, quantization feature data corresponding to each quantization operation in which an overflow occurred, and quantization feature data corresponding to each quantization operation in which an overflow occurred. The apparatus includes a data extraction unit that extracts non-quantized feature data corresponding to non-quantized operations.
本開示によれば、機械学習の手法に基づいた推論においてオーバーフローが発生した場合に、データ抽出部が、発生したオーバーフローに関係のある量子化特徴データと非量子化特徴データとを抽出する。ここで、量子化特徴データと非量子化特徴データとの各々は推論用データとは異なるデータである。そのため、本開示によれば、ある推論用データを用いて推論を実行した際にオーバーフローが発生した場合において、発生したオーバーフローを解析するためのデータであって当該ある推論用データとは異なるデータを取得することができる。 According to the present disclosure, when an overflow occurs in inference based on a machine learning method , the data extraction unit extracts quantized feature data and non-quantized feature data related to the overflow that has occurred. . Here, each of the quantized feature data and the non-quantized feature data is data different from the inference data. Therefore, according to the present disclosure, when an overflow occurs when inference is performed using certain inference data, data for analyzing the overflow that has occurred and which is different from the certain inference data is used. can be obtained.
実施の形態の説明及び図面において、同じ要素及び対応する要素には同じ符号を付している。同じ符号が付された要素の説明は、適宜に省略又は簡略化する。図中の矢印はデータの流れ又は処理の流れを主に示している。また、「部」を、「回路」、「工程」、「手順」、「処理」又は「サーキットリー」に適宜読み替えてもよい。 In the description of the embodiments and the drawings, the same elements and corresponding elements are denoted by the same reference numerals. Descriptions of elements labeled with the same reference numerals will be omitted or simplified as appropriate. Arrows in the figure mainly indicate the flow of data or processing. Furthermore, "unit" may be read as "circuit," "process," "procedure," "process," or "circuitry" as appropriate.
実施の形態1.
以下、本実施の形態について、図面を参照しながら詳細に説明する。Embodiment 1.
Hereinafter, this embodiment will be described in detail with reference to the drawings.
***構成の説明***
図1は、本実施の形態に係る推論装置100の構成例を示している。推論装置100は、本図に示すように、量子化推論部110と、非量子化推論部120と、データ抽出部130とを備える。
推論装置100は、典型的には組込みシステムの一部である。なお、推論装置100が推論プロセス管理部を備え、推論プロセス管理部が量子化推論部110と非量子化推論部120とを制御する構成であってもよい。***Explanation of configuration***
FIG. 1 shows a configuration example of an
量子化推論部110は、量子化推論プロセスを実行する、即ち、機械学習の手法に基づいた少なくとも1回の量子化演算を実行する。少なくとも1回の量子化演算それぞれは、少なくとも1つの量子化特徴データそれぞれに応じた演算である。少なくとも1つの量子化特徴データそれぞれは、少なくとも1回の量子化演算それぞれの特徴を示しており、また、少なくとも1回の量子化演算それぞれに対応するパラメータを含んでもよい。また、量子化推論部110は推論用データを用いる。推論用データは推論を実行する際に学習済モデルに入力されるデータである。
量子化推論プロセスは量子化済推論プロセスとも呼ばれる。量子化推論プロセスにおいて量子化アルゴリズムが実行される。量子化アルゴリズムは量子化推論アルゴリズムとも呼ばれる。また、量子化推論部110は、量子化推論プロセスにおいてオーバーフロー等が発生した場合に、発生したオーバーフロー等に関する情報を記録する。The
The quantized inference process is also called the quantized inference process. A quantization algorithm is executed in the quantization inference process. Quantization algorithms are also called quantization inference algorithms. Furthermore, when an overflow or the like occurs in the quantization inference process, the
非量子化推論部120は、非量子化推論プロセスを実行する、即ち、少なくとも1回の量子化演算それぞれに対応する少なくとも1回の非量子化演算の少なくともいずれかを実行する。少なくとも1回の量子化演算と、少なくとも1回の非量子化演算とは、同一の機械学習の手法に基づいた演算である。機械学習の手法がニューラルネットワークである場合において、各量子化演算と各非量子化演算とはニューラルネットワークの各レイヤの演算である。少なくとも1回の非量子化演算それぞれは、少なくとも1つの非量子化特徴データそれぞれに応じた演算である。少なくとも1つの非量子化特徴データそれぞれは、少なくとも1回の非量子化演算それぞれの特徴を示しており、また、少なくとも1回の非量子化演算それぞれに対応するパラメータを含んでもよい。非量子化推論部120は推論用データと後述の退避データとを用いる。
非量子化推論プロセスは未量子化推論プロセスとも呼ばれる。非量子化推論プロセスにおいて非量子化アルゴリズムが実行される。非量子化アルゴリズムは非量子化推論アルゴリズムとも呼ばれる。非量子化アルゴリズムは学習用のデータを用いて学習を実行した結果得られたアルゴリズムである。量子化アルゴリズムと、非量子化アルゴリズムとは基本的には同じである。量子化アルゴリズムは、非量子化アルゴリズムを、量子化に対応するよう適宜変更したものである。量子化は、典型的には浮動小数点演算を固定小数点演算又は整数演算に置き換えることである。また、量子化アルゴリズムと、非量子化アルゴリズムとの各々を、推論装置100が生成してもよく、他の装置が生成してもよい。また、非量子化推論部120は、量子化推論プロセスにおいてオーバーフローが発生した際に用いられた入力データ等に応じて演算を実行する。The non-quantized
A non-quantized inference process is also called an unquantized inference process. A non-quantized algorithm is executed in the non-quantized inference process. Non-quantized algorithms are also called non-quantized inference algorithms. The non-quantized algorithm is an algorithm obtained as a result of learning using learning data. The quantization algorithm and the non-quantization algorithm are basically the same. The quantization algorithm is a non-quantization algorithm modified as appropriate to support quantization. Quantization typically involves replacing floating point operations with fixed point or integer operations. Further, each of the quantization algorithm and the non-quantization algorithm may be generated by the
データ抽出部130は、量子化推論プロセスにおいてオーバーフローが発生した場合に、量子化推論プロセスと非量子化推論プロセスとから退避データを抽出する。退避データは、量子化推論プロセスにおけるオーバーフローを解析する際に用いられるデータであり、具体例として、入力データと特徴データとから成る。入力データは、少なくとも1回の量子化演算の各々と少なくとも1回の非量子化演算の各々とを実行する際に入力されるデータである。特徴データは、量子化演算において活用されるデータである。特徴データは、量子化特徴データと非量子化特徴データとの総称であり、少なくとも1回の量子化演算と少なくとも1回の非量子化演算との各々の演算ごとに存在し、具体例として演算における入力データの振れ幅を表す。入力データの振れ幅は、入力データとして想定されるデータが示す値の最小値から最大値までの範囲である。データ抽出部130は、少なくとも1回の量子化演算の少なくともいずれかにおいてオーバーフローが発生した場合に、オーバーフローが発生した量子化演算の各々に対応する量子化特徴データと、オーバーフローが発生した量子化演算の各々に対応する非量子化演算に対応する非量子化特徴データとを抽出する。
機械学習の手法がディープラーニングである場合において、データ抽出部130は、量子化特徴データとしてオーバーフローが発生した量子化演算に対応するレイヤについてのパラメータを示すデータを抽出してもよく、非量子化特徴データとしてオーバーフローが発生した量子化演算に対応する非量子化演算に対応するレイヤについてのパラメータを示すデータを抽出してもよい。
The
When the machine learning method is deep learning , the
図2は、推論装置100が実行する各プロセスの優先度を示している。本図に示すように、量子化推論プロセスの優先度は、非量子化推論プロセスの優先度よりも高い。また、量子化推論プロセスの優先度よりも優先度が低く、かつ、非量子化推論プロセスの優先度よりも優先度が高いプロセスがあってもよい。なお、他プロセスという表記を挟む丸括弧は、他プロセスがあってもなくてもよいことを示している。
FIG. 2 shows the priority of each process executed by the
図3は、本実施の形態に係る推論装置100のハードウェア構成例を示している。推論装置100は、コンピュータから成る。推論装置100は、複数のコンピュータから成ってもよい。
FIG. 3 shows an example of the hardware configuration of the
推論装置100は、本図に示すように、プロセッサ11と、メモリ12と、補助記憶装置13と、入出力IF(Interface)14と、通信装置15等のハードウェアを備えるコンピュータである。これらのハードウェアは、信号線19を介して適宜接続されている。
As shown in the figure, the
プロセッサ11は、演算処理を行うIC(Integrated Circuit)であり、かつ、コンピュータが備えるハードウェアを制御する。プロセッサ11は、具体例として、CPU(Central Processing Unit)、DSP(Digital Signal Processor)、又はGPU(Graphics Processing Unit)である。
推論装置100は、プロセッサ11を代替する複数のプロセッサを備えてもよい。複数のプロセッサは、プロセッサ11の役割を分担する。The
The
メモリ12は、典型的には、揮発性の記憶装置である。メモリ12は、主記憶装置又はメインメモリとも呼ばれる。メモリ12は、具体例として、RAM(Random Access Memory)である。メモリ12に記憶されたデータは、必要に応じて補助記憶装置13に保存される。
補助記憶装置13は、典型的には、不揮発性の記憶装置である。補助記憶装置13は、具体例として、ROM(Read Only Memory)、HDD(Hard Disk Drive)、又はフラッシュメモリである。補助記憶装置13に記憶されたデータは、必要に応じてメモリ12にロードされる。
メモリ12及び補助記憶装置13は一体的に構成されていてもよい。The
The
入出力IF14は、入力装置及び出力装置が接続されるポートである。入出力IF14は、具体例として、USB(Universal Serial Bus)端子である。入力装置は、具体例として、カメラ、キーボード及びマウスである。出力装置は、具体例として、ディスプレイである。 The input/output IF 14 is a port to which an input device and an output device are connected. The input/output IF 14 is, for example, a USB (Universal Serial Bus) terminal. Specific examples of input devices include a camera, a keyboard, and a mouse. A specific example of the output device is a display.
通信装置15は、レシーバ及びトランスミッタである。通信装置15は、具体例として、通信チップ又はNIC(Network Interface Card)である。
推論装置100の各部は、他の装置等と通信する際に、通信装置15を適宜用いてもよい。推論装置100の各部は、入出力IF14を介してデータを受け付けてもよく、また、通信装置15を介してデータを受け付けてもよい。
Each part of the
補助記憶装置13は、推論プログラムを記憶している。推論プログラムは、推論装置100が備える各部の機能をコンピュータに実現させるプログラムである。推論プログラムは、メモリ12にロードされて、プロセッサ11によって実行される。推論装置100が備える各部の機能は、ソフトウェアにより実現される。
また、補助記憶装置13は、OS(Operating System)を記憶している。OSの少なくとも一部は、メモリ12にロードされて、プロセッサ11によって実行される。つまり、プロセッサ11は、OSを実行しながら、推論プログラムを実行する。The
Further, the
推論プログラムを実行する際に用いられるデータと、推論プログラムを実行することによって得られるデータと等は、記憶装置に適宜記憶される。推論装置100の各部は、適宜記憶装置を利用する。記憶装置は、具体例として、メモリ12と、補助記憶装置13と、プロセッサ11内のレジスタと、プロセッサ11内のキャッシュメモリとの少なくとも1つから成る。なお、データと情報とは、同等の意味を有することもある。記憶装置は、コンピュータと独立したものであってもよい。
メモリ12及び補助記憶装置13の機能は、他の記憶装置によって実現されてもよい。Data used when executing the inference program, data obtained by executing the inference program, etc. are appropriately stored in the storage device. Each part of the
The functions of the
推論プログラムは、コンピュータが読み取り可能な不揮発性の記録媒体に記録されていてもよい。不揮発性の記録媒体は、具体例として、光ディスク又はフラッシュメモリである。推論プログラムは、プログラムプロダクトとして提供されてもよい。 The inference program may be recorded on a computer-readable non-volatile recording medium. Specific examples of the nonvolatile recording medium include an optical disk or a flash memory. The reasoning program may be provided as a program product.
***動作の説明***
推論装置100の動作手順は、推論方法に相当する。また、推論装置100の動作を実現するプログラムは、推論プログラムに相当する。***Operation explanation***
The operation procedure of the
図4は、推論装置100の動作の一例を示すフローチャートである。また、図5は、推論装置100の動作の一例を模式的に説明する図である。図5において、平行四辺形は、出力データを除いて演算において用いられるデータを表現している。図4及び図5を参照して推論装置100の動作を説明する。なお、本実施の形態は、量子化したデータを用いることもできる機械学習の手法に対して適用することができるが、説明の便宜上、推論装置100の動作の説明において機械学習の手法はディープラーニングとする。
FIG. 4 is a flowchart illustrating an example of the operation of the
(ステップS101)
量子化推論部110の量子化推論プロセスが起動される。(Step S101)
The quantization inference process of the
(ステップS102)
推論を開始する指示がある場合、推論装置100はステップS103に進む。それ以外の場合、推論装置100は本ステップの処理を再度実行する。(Step S102)
If there is an instruction to start inference, the
(ステップS103)
量子化推論部110は、推論用データを用いて推論処理を開始する。推論用データは、推論を開始する指示と併せて推論装置100が受け取ったデータであってもよい。(Step S103)
The
(ステップS104)
量子化推論部110は、対象レイヤについてのレイヤ演算を実行する。ここで、レイヤはディープラーニングにおけるレイヤであり、ステップS104からステップS106から成るループ処理においてレイヤ演算を初めて実行する場合に先頭のレイヤを対象レイヤとし、それ以外の場合に1回前に実行したレイヤ演算における対象レイヤの次のレイヤを対象レイヤとする。
図5における演算がレイヤ演算に相当する。また、量子化推論部110は、演算の直下に示されている太い矢印の左側に示されているデータを入力データとしてレイヤ演算を実行し、当該矢印の右側に示されているデータを出力する。(Step S104)
The
The calculations in FIG. 5 correspond to layer calculations. Further, the
(ステップS105)
量子化推論部110は、ステップS104の処理においてオーバーフローが発生したか否かを確認する。オーバーフローが発生したか否かを確認する方法は、具体例として、CPUのフラグを参照する方法、演算に関係する変数を演算の前後に確認する方法、又は、FPGA等の独自の回路により確認する方法である。
オーバーフローが発生した場合、推論装置100はステップS109に進む。それ以外の場合、推論装置100はステップS106に進む。(Step S105)
The
If an overflow occurs, the
(ステップS106)
全てのレイヤ演算が終了した場合、推論装置100はステップS107に進む。それ以外の場合、推論装置100はステップS104に進む。(Step S106)
When all layer calculations are completed, the
(ステップS107)
量子化推論部110は、推論を指示した者に推論の結果を適宜通知する。(Step S107)
The
(ステップS108)
少なくともいずれかのレイヤ演算においてオーバーフローが発生した場合、推論装置100はステップS111に進む。それ以外の場合、推論装置100はステップS102に戻る。(Step S108)
If an overflow occurs in at least one of the layer calculations, the
(ステップS109)
データ抽出部130は、対象レイヤに対応する退避データを退避する。具体例として、データ抽出部130は、対象レイヤについてのデータを抽出し、抽出したデータを退避データとして退避する。対象レイヤについてのデータは、具体例として、対象レイヤに対する入力データと、対象レイヤにおける変数データと、対象レイヤにおける特徴データとである。ただし、対象レイヤが先頭のレイヤである場合、データ抽出部130は、入力データが推論用データであるため、退避データとして入力データを抽出しない。なお、データ抽出部130は推論用データを退避してもよい。ここで、推論用データは先頭のレイヤに入力されるデータである。
図5は、対象レイヤに対応する退避データとして、オーバーフローが発生した対象レイヤについてのデータと、対象レイヤの1つ前のレイヤについてのデータとをデータ抽出部130が退避する様子を示している。なお、データ抽出部130が退避するデータは、対象レイヤについてのデータのみであってもよく、対象レイヤから対象レイヤのn(nは自然数)個前のレイヤまでの各々のレイヤについてのデータであってもよい。(Step S109)
The
FIG. 5 shows how the
(ステップS110)
量子化推論部110は、飽和演算を実行し、その後、ステップS106に進む。(Step S110)
The
(ステップS111)
非量子化推論部120の非量子化推論プロセスが起動される。
以下、推論装置100は、ステップS102以降の処理と、ステップS121以降の処理とを並列に実行する。(Step S111)
The non-quantized inference process of the
Hereinafter, the
(ステップS121)
非量子化推論部120は、推論用データを用いて非量子化推論プロセスを実行する。
なお、図5において、非量子化推論部120が非量子化推論プロセスを最後まで実行することによって出力データを出力しているが、非量子化推論部120は、量子化推論プロセスにおいてオーバーフローが発生したレイヤに対応するレイヤまでのレイヤ演算を実行すれば十分である。(Step S121)
The
Note that in FIG. 5, the
(ステップS122)
データ抽出部130は、退避データとして、オーバーフローが発生したレイヤに対応するレイヤについてのデータを抽出する。ここで、データ抽出部130は、量子化推論プロセスにおいて退避したデータに対応するレイヤと同一のレイヤについてのデータを退避する。具体例として、図5に示すように、データ抽出部130が量子化推論プロセスにおいてオーバーフローが発生したレイヤと当該レイヤの1つ前のレイヤとの各々についてのデータを退避した場合、データ抽出部130は、オーバーフローが発生したレイヤに対応するレイヤとオーバーフローが発生したレイヤの1つ前のレイヤとの各々に対応する非量子化推論プロセスのレイヤについてのデータを退避データとして退避する。
データ抽出部130が退避した量子化推論プロセスにおけるデータと非量子化推論プロセスにおけるデータとは推論装置100の外部に出力されてもよい。エンジニア等は、出力されたデータを入手し、入手したデータに基づいて量子化推論プロセスのパラメータを再設定してもよく、入手したデータに基づいてソースコード内の量子化推論プロセスに関するパラメータを変更してもよい。(Step S122)
The
The data in the quantized inference process and the data in the non-quantized inference process saved by the
(ステップS123)
非量子化推論部120の非量子化推論プロセスは終了される。(Step S123)
The non-quantization inference process of the
***実施の形態1の効果の説明***
以上のように、本実施の形態によれば、推論用データが機密情報である場合であっても、推論用データを抽出せず、オーバーフローが発生した演算に関するデータのみを抽出する。ここで、オーバーフローが発生した演算に関するデータは、推論用データに存在する機密性が排除されたデータである。そのため、本実施の形態によれば、推論環境における精度を維持しつつ、機密性を保持したまま量子化演算において発生したオーバーフローを解析することができる。そのため、本実施の形態によれば、発生したオーバーフローに対処するための学習済モデルの改良に必要なデータを取得することができる。
また、本実施の形態によれば、学習用データ等のみならず、実際の推論用データに基づいて量子化を伴う機械学習におけるパラメータ等を調整することができる。***Explanation of effects of Embodiment 1***
As described above, according to the present embodiment, even if the inference data is confidential information, the inference data is not extracted, but only the data related to the operation in which the overflow occurred. Here, the data related to the operation in which the overflow has occurred is data from which the confidentiality that exists in the inference data has been eliminated. Therefore, according to the present embodiment, it is possible to analyze an overflow that occurs in a quantization operation while maintaining accuracy in the inference environment and maintaining confidentiality. Therefore, according to the present embodiment, it is possible to obtain data necessary for improving the trained model to deal with the overflow that has occurred.
Furthermore, according to the present embodiment, parameters and the like in machine learning involving quantization can be adjusted based not only on learning data and the like but also on actual inference data.
***他の構成***
<変形例1>
量子化推論部110は、オーバーフローが発生した場合に推論を途中で打ち切ってもよい。具体例として、量子化推論部110は、少なくとも1回の量子化演算のいずれかにおいてオーバーフローが発生した場合に、オーバーフローが発生した演算よりも後の演算を実行しない。***Other configurations***
<Modification 1>
The
<変形例2>
図6は、本変形例に係る推論装置100のハードウェア構成例を示している。本変形例に係る推論装置100は、本図に示すように、オフロードデバイス16を備える。
量子化推論プロセスは、オフロードデバイス16によって実行されてもよい。オフロードデバイス16は具体例として、GPU又はFPGAである。本変形例において、非量子化推論プロセスはプロセッサ11で実行されていてもよく、このとき、プロセッサ11とオフロードデバイス16との間で適宜通信が実行される。<Modification 2>
FIG. 6 shows an example of the hardware configuration of the
The quantization inference process may be performed by
<変形例3>
図7は、本変形例に係る推論装置100のハードウェア構成例を示している。
推論装置100は、プロセッサ11、プロセッサ11とメモリ12、プロセッサ11と補助記憶装置13、あるいはプロセッサ11とメモリ12と補助記憶装置13に代えて、処理回路18を備える。
処理回路18は、推論装置100が備える各部の少なくとも一部を実現するハードウェアである。
処理回路18は、専用のハードウェアであってもよく、また、メモリ12に格納されるプログラムを実行するプロセッサであってもよい。<Modification 3>
FIG. 7 shows an example of the hardware configuration of the
The
The
Processing
処理回路18が専用のハードウェアである場合、処理回路18は、具体例として、単一回路、複合回路、プログラム化したプロセッサ、並列プログラム化したプロセッサ、ASIC(ASICはApplication Specific Integrated Circuit)、FPGA(Field Programmable Gate Array)又はこれらの組み合わせである。
推論装置100は、処理回路18を代替する複数の処理回路を備えてもよい。複数の処理回路は、処理回路18の役割を分担する。When the
The
推論装置100において、一部の機能が専用のハードウェアによって実現されて、残りの機能がソフトウェア又はファームウェアによって実現されてもよい。
In the
処理回路18は、具体例として、ハードウェア、ソフトウェア、ファームウェア、又はこれらの組み合わせにより実現される。
プロセッサ11とメモリ12と補助記憶装置13と処理回路18とを、総称して「プロセッシングサーキットリー」という。つまり、推論装置100の各機能構成要素の機能は、プロセッシングサーキットリーにより実現される。
他の実施の形態に係る推論装置100についても、本変形例と同様の構成であってもよい。The
The
The
実施の形態2.
以下、主に前述した実施の形態と異なる点について、図面を参照しながら説明する。Embodiment 2.
Hereinafter, differences from the embodiments described above will be mainly described with reference to the drawings.
***構成の説明***
図8は、本実施の形態に係る推論装置100の構成例を示している。推論装置100は、本図に示すように再量子化部140を備える。
再量子化部140は、データ抽出部130が抽出したデータに基づいて量子化アルゴリズムを変更することにより再量子化アルゴリズムを生成する。ここで、再量子化アルゴリズムは、再量子化部140によって変更された量子化アルゴリズムである。また、再量子化部140は、再量子化を実行するタイミングを管理する。再量子化は、再量子化アルゴリズムを変更することであり、量子化アルゴリズムを再量子化アルゴリズムに置き換えることを含んでもよい。再量子化部140は、データ抽出部130によって抽出された量子化特徴データと非量子化特徴データとに基づいて、抽出された量子化特徴データに対応する量子化演算である対象演算においてオーバーフローが発生しないよう、対象演算に対応する量子化特徴データを変更する。
本実施の形態に係る量子化推論部110は、再量子化部140が生成した再量子化アルゴリズムを適宜利用し、変更された量子化特徴データに応じた量子化演算を実行する。また、量子化推論部110は、再量子化アルゴリズムと動作している量子化アルゴリズムとを入れ替えるタイミングを管理する。***Explanation of configuration***
FIG. 8 shows a configuration example of the
The
The
***動作の説明***
図9は、推論装置100の動作の一例を示すフローチャートである。本図を参照して、実施の形態1に係る推論装置100の動作と、本実施の形態に係る推論装置100の動作との差異を主に説明する。***Operation explanation***
FIG. 9 is a flowchart showing an example of the operation of the
(ステップS102)
推論装置100は、本ステップの処理を再度実行する代わりに、ステップS201に進む。(Step S102)
The
(ステップS108)
推論装置100はステップS102に戻る代わりに、ステップS201に進む。(Step S108)
The
(ステップS201)
再量子化部140によって再量子化アルゴリズムが準備されていない場合、量子化推論部110はステップS102に進む。それ以外の場合、量子化推論部110はステップS202に進む。(Step S201)
If the requantization algorithm is not prepared by the
(ステップS202)
量子化推論部110は、量子化推論プロセスにおける量子化アルゴリズムを再量子化部140が準備した再量子化アルゴリズムに入れ替える。(Step S202)
The
(ステップS221)
再量子化部140は、退避データを用いて再量子化を実行することにより再量子化アルゴリズムを生成する。再量子化は、オーバーフローが発生したレイヤにおいてオーバーフローが発生しないように量子化アルゴリズムを調整することである。再量子化部140は、具体例として、オーバーフローが発生したレイヤにおける特徴データを変更する。
なお、複数のレイヤにおいてオーバーフローが発生した場合に、再量子化部140は、最も早く処理されるレイヤに対応する特徴データのみを調整してもよく、オーバーフローが発生した全てのレイヤの各々に対応する特徴データを一括で調整してもよい。(Step S221)
The
Note that when overflow occurs in multiple layers, the
(ステップS222)
再量子化部140は、ステップS221において生成した再量子化アルゴリズムを保存する。(Step S222)
The
***実施の形態2の効果の説明***
以上のように、本実施の形態によれば、オーバーフローが発生しないように量子化アルゴリズムを変更する処理を自動的に実行することができる。***Explanation of effects of Embodiment 2***
As described above, according to the present embodiment, it is possible to automatically execute the process of changing the quantization algorithm so that overflow does not occur.
***他の構成***
<変形例4>
量子化推論プロセスにおける量子化アルゴリズムを再量子化部140が準備した量子化アルゴリズムに量子化推論部110が入れ替えるタイミングは、推論装置100を備える組込みシステムの再起動時であってもよい。また、量子化推論部110は、次に推論を実行するタイミングを考慮して次に実行する推論に影響がないと判断した際に量子化アルゴリズムを入れ替えるよう動作予約する方式により量子化アルゴリズムを入れ替えてもよい。***Other configurations***
<Modification 4>
The timing at which the
***他の実施の形態***
前述した各実施の形態の自由な組み合わせ、あるいは各実施の形態の任意の構成要素の変形、もしくは各実施の形態において任意の構成要素の省略が可能である。
また、実施の形態は、実施の形態1から2で示したものに限定されるものではなく、必要に応じて種々の変更が可能である。フローチャート等を用いて説明した手順は、適宜変更されてもよい。***Other embodiments***
It is possible to freely combine the embodiments described above, to modify any component of each embodiment, or to omit any component in each embodiment.
Further, the embodiments are not limited to those shown in Embodiments 1 and 2, and various changes can be made as necessary. The procedures described using flowcharts and the like may be modified as appropriate.
11 プロセッサ、12 メモリ、13 補助記憶装置、14 入出力IF、15 通信装置、16 オフロードデバイス、18 処理回路、19 信号線、100 推論装置、110 量子化推論部、120 非量子化推論部、130 データ抽出部、140 再量子化部。 11 processor, 12 memory, 13 auxiliary storage device, 14 input/output IF, 15 communication device, 16 offload device, 18 processing circuit, 19 signal line, 100 inference device, 110 quantization inference section, 120 non-quantization inference section, 130 data extraction section, 140 requantization section.
Claims (6)
前記推論用データを用いて前記少なくとも1回の量子化演算それぞれに対応する少なくとも1回の非量子化演算の少なくともいずれかを実行する非量子化推論部と
を備える推論装置であって、
前記少なくとも1回の量子化演算それぞれは、前記少なくとも1回の量子化演算それぞれの特徴を示す少なくとも1つの量子化特徴データそれぞれに応じた演算であり、
前記少なくとも1回の非量子化演算それぞれは、前記少なくとも1回の非量子化演算それぞれの特徴を示す少なくとも1つの非量子化特徴データそれぞれに応じた演算であり、
前記推論装置は、さらに、
前記少なくとも1回の量子化演算の少なくともいずれかにおいてオーバーフローが発生した場合に、オーバーフローが発生した量子化演算の各々に対応する量子化特徴データと、オーバーフローが発生した量子化演算の各々に対応する非量子化演算に対応する非量子化特徴データとを抽出するデータ抽出部
を備える推論装置。 a quantization inference unit that performs at least one quantization operation based on a machine learning method using the inference data;
An inference device comprising: a non-quantization inference unit that executes at least one of at least one non-quantization operation corresponding to each of the at least one quantization operation using the inference data,
Each of the at least one quantization operation is an operation corresponding to at least one quantization feature data indicating a characteristic of each of the at least one quantization operation,
Each of the at least one non-quantized operation is an operation according to each of at least one non-quantized feature data indicating the characteristics of each of the at least one non-quantized operation,
The inference device further includes:
When an overflow occurs in at least one of the at least one quantization operation, quantization feature data corresponding to each quantization operation in which an overflow occurred, and quantization feature data corresponding to each quantization operation in which an overflow occurred. An inference device comprising a data extraction unit that extracts non-quantized feature data corresponding to a non-quantized operation.
前記少なくとも1つの非量子化特徴データそれぞれは、前記少なくとも1回の非量子化演算それぞれに対応するパラメータを含む請求項1に記載の推論装置。 Each of the at least one quantization feature data includes a parameter corresponding to each of the at least one quantization operation,
The inference device according to claim 1, wherein each of the at least one non-quantized feature data includes a parameter corresponding to each of the at least one non-quantized operation.
前記データ抽出部は、
前記量子化特徴データとして、オーバーフローが発生した量子化演算に対応するレイヤについてのパラメータを示すデータを抽出し、
前記非量子化特徴データとして、オーバーフローが発生した量子化演算に対応する非量子化演算に対応するレイヤについてのパラメータを示すデータを抽出する請求項1又は2に記載の推論装置。 The machine learning method is deep learning,
The data extraction unit is
Extracting data indicating parameters for a layer corresponding to a quantization operation in which an overflow has occurred as the quantization feature data;
The inference device according to claim 1 or 2, wherein data indicating a parameter for a layer corresponding to a non-quantized operation corresponding to a quantized operation in which an overflow has occurred is extracted as the non-quantized feature data.
抽出された量子化特徴データと非量子化特徴データとに基づいて、抽出された量子化特徴データに対応する量子化演算である対象演算においてオーバーフローが発生しないよう、前記対象演算に対応する量子化特徴データを変更する再量子化部を
備え、
前記量子化推論部は、変更された量子化特徴データに応じた量子化演算を実行する請求項1から3のいずれか1項に記載の推論装置。 The inference device further includes:
Based on the extracted quantized feature data and non-quantized feature data, quantization corresponding to the target operation is performed to prevent overflow from occurring in the target operation, which is a quantization operation corresponding to the extracted quantized feature data. Equipped with a requantization unit that changes feature data,
The inference device according to any one of claims 1 to 3, wherein the quantization inference unit executes a quantization operation according to changed quantized feature data.
前記コンピュータが、前記推論用データを用いて前記少なくとも1回の量子化演算それぞれに対応する少なくとも1回の非量子化演算の少なくともいずれかを実行する推論方法であって、
前記少なくとも1回の量子化演算それぞれは、前記少なくとも1回の量子化演算それぞれの特徴を示す少なくとも1つの量子化特徴データそれぞれに応じた演算であり、
前記少なくとも1回の非量子化演算それぞれは、前記少なくとも1回の非量子化演算それぞれの特徴を示す少なくとも1つの非量子化特徴データそれぞれに応じた演算であり、
前記コンピュータが、前記少なくとも1回の量子化演算の少なくともいずれかにおいてオーバーフローが発生した場合に、オーバーフローが発生した量子化演算の各々に対応する量子化特徴データと、オーバーフローが発生した量子化演算の各々に対応する非量子化演算に対応する非量子化特徴データとを抽出する推論方法。 the computer executes at least one quantization operation based on a machine learning method using the inference data;
An inference method , wherein the computer uses the inference data to execute at least one of at least one non-quantization operation corresponding to each of the at least one quantization operation,
Each of the at least one quantization operation is an operation corresponding to at least one quantization feature data indicating a characteristic of each of the at least one quantization operation,
Each of the at least one non-quantized operation is an operation according to each of at least one non-quantized feature data indicating the characteristics of each of the at least one non-quantized operation,
When an overflow occurs in at least one of the at least one quantization operation, the computer stores quantization feature data corresponding to each of the quantization operations in which the overflow has occurred, and quantization feature data for each of the quantization operations in which the overflow has occurred. An inference method for extracting non-quantized feature data corresponding to each corresponding non-quantized operation.
前記推論用データを用いて前記少なくとも1回の量子化演算それぞれに対応する少なくとも1回の非量子化演算の少なくともいずれかを実行する非量子化推論処理と
をコンピュータである推論装置に実行させる推論プログラムであって、
前記少なくとも1回の量子化演算それぞれは、前記少なくとも1回の量子化演算それぞれの特徴を示す少なくとも1つの量子化特徴データそれぞれに応じた演算であり、
前記少なくとも1回の非量子化演算それぞれは、前記少なくとも1回の非量子化演算それぞれの特徴を示す少なくとも1つの非量子化特徴データそれぞれに応じた演算であり、
前記推論プログラムは、さらに、
前記少なくとも1回の量子化演算の少なくともいずれかにおいてオーバーフローが発生した場合に、オーバーフローが発生した量子化演算の各々に対応する量子化特徴データと、オーバーフローが発生した量子化演算の各々に対応する非量子化演算に対応する非量子化特徴データとを抽出するデータ抽出処理を前記推論装置に実行させる推論プログラム。 quantization inference processing that performs at least one quantization operation based on a machine learning method using inference data;
An inference that causes an inference device, which is a computer, to perform a non-quantized inference process of executing at least one of at least one non-quantized operation corresponding to each of the at least one quantized operation using the inference data. A program,
Each of the at least one quantization operation is an operation corresponding to at least one quantization feature data indicating a characteristic of each of the at least one quantization operation,
Each of the at least one non-quantized operation is an operation according to each of at least one non-quantized feature data indicating the characteristics of each of the at least one non-quantized operation,
The inference program further includes:
When an overflow occurs in at least one of the at least one quantization operation, quantization feature data corresponding to each quantization operation in which an overflow occurred, and quantization feature data corresponding to each quantization operation in which an overflow occurred. An inference program that causes the inference device to execute a data extraction process of extracting non-quantized feature data corresponding to a non-quantized operation.
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/JP2021/012193 WO2022201352A1 (en) | 2021-03-24 | 2021-03-24 | Inference device, inference method, and inference program |
Publications (3)
Publication Number | Publication Date |
---|---|
JPWO2022201352A1 JPWO2022201352A1 (en) | 2022-09-29 |
JPWO2022201352A5 JPWO2022201352A5 (en) | 2023-06-28 |
JP7350214B2 true JP7350214B2 (en) | 2023-09-25 |
Family
ID=83396538
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2023508251A Active JP7350214B2 (en) | 2021-03-24 | 2021-03-24 | Inference device, inference method, and inference program |
Country Status (3)
Country | Link |
---|---|
JP (1) | JP7350214B2 (en) |
TW (1) | TW202238458A (en) |
WO (1) | WO2022201352A1 (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170316307A1 (en) | 2016-04-29 | 2017-11-02 | Intel Corporation | Dynamic management of numerical representation in a distributed matrix processor architecture |
JP2020009048A (en) | 2018-07-05 | 2020-01-16 | 株式会社日立製作所 | Neural network learning device and learning method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20200043169A (en) * | 2018-10-17 | 2020-04-27 | 삼성전자주식회사 | Method and apparatus for quantizing neural network parameters |
-
2021
- 2021-03-24 JP JP2023508251A patent/JP7350214B2/en active Active
- 2021-03-24 WO PCT/JP2021/012193 patent/WO2022201352A1/en active Application Filing
- 2021-08-18 TW TW110130424A patent/TW202238458A/en unknown
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170316307A1 (en) | 2016-04-29 | 2017-11-02 | Intel Corporation | Dynamic management of numerical representation in a distributed matrix processor architecture |
JP2020009048A (en) | 2018-07-05 | 2020-01-16 | 株式会社日立製作所 | Neural network learning device and learning method |
Also Published As
Publication number | Publication date |
---|---|
TW202238458A (en) | 2022-10-01 |
JPWO2022201352A1 (en) | 2022-09-29 |
WO2022201352A1 (en) | 2022-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102073873B1 (en) | Method for semantic segmentation and apparatus thereof | |
US8434073B1 (en) | Systems and methods for preventing exploitation of byte sequences that violate compiler-generated alignment | |
EP3756130B1 (en) | Image hidden information detector | |
AU2011254039A1 (en) | Dynamically adjusting the complexity of worker tasks in a multi-threaded application | |
CN109409210B (en) | Face detection method and system based on SSD (solid State disk) framework | |
WO2017145852A1 (en) | Neural network learning device, neural network learning method and storage medium storing program | |
US20220358269A1 (en) | Simulation execution system, simulation execution method, and computer readable medium | |
CN107066326A (en) | The method and terminal of a kind of scheduler task | |
JP2022099327A (en) | Pre-trained language model, apparatus, and computer-readable storage medium | |
US11556780B2 (en) | Neural network learning device, neural network learning method, and recording medium on which neural network learning program is stored | |
JP7350214B2 (en) | Inference device, inference method, and inference program | |
CN114943649A (en) | Image deblurring method, device and computer readable storage medium | |
JP2007133477A (en) | System for supporting action of user | |
CN110942488A (en) | Image processing apparatus, image processing system, image processing method, and recording medium | |
JP7241009B2 (en) | LEARNING DEVICE, LEARNING METHOD AND PROGRAM | |
US20210012192A1 (en) | Arithmetic processing apparatus, control method, and non-transitory computer-readable recording medium having stored therein control program | |
JP4194433B2 (en) | Likelihood calculation apparatus and method | |
CN113506287A (en) | Full-view pathological section image classification method, device, equipment and storage medium | |
CN114187465A (en) | Method and device for training classification model, electronic equipment and storage medium | |
CN111045687B (en) | Deployment method and related device for artificial intelligence application | |
CN117891760B (en) | DMA (direct memory access) sparse access method, intelligent computing subsystem and intelligent computing platform | |
WO2022190301A1 (en) | Learning device, learning method, and computer-readable medium | |
US20230005152A1 (en) | Apparatus and method for image segmentation | |
US20230162085A1 (en) | Learning device, learning method, and learning program | |
KR102585838B1 (en) | Method for lightweighting neural network model and electronic apparatus for performing the same |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20230407 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20230407 |
|
A871 | Explanation of circumstances concerning accelerated examination |
Free format text: JAPANESE INTERMEDIATE CODE: A871 Effective date: 20230407 |
|
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: 20230815 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230912 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7350214 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |