WO2018131059A1 - ニューラルネットワーク回路 - Google Patents

ニューラルネットワーク回路 Download PDF

Info

Publication number
WO2018131059A1
WO2018131059A1 PCT/JP2017/000367 JP2017000367W WO2018131059A1 WO 2018131059 A1 WO2018131059 A1 WO 2018131059A1 JP 2017000367 W JP2017000367 W JP 2017000367W WO 2018131059 A1 WO2018131059 A1 WO 2018131059A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
neural network
weight
shift
weighting
Prior art date
Application number
PCT/JP2017/000367
Other languages
English (en)
French (fr)
Inventor
敏明 中村
広津 鉄平
辰也 堀口
Original Assignee
株式会社日立製作所
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 株式会社日立製作所 filed Critical 株式会社日立製作所
Priority to JP2018561111A priority Critical patent/JP6734938B2/ja
Priority to PCT/JP2017/000367 priority patent/WO2018131059A1/ja
Priority to US16/470,633 priority patent/US11531896B2/en
Publication of WO2018131059A1 publication Critical patent/WO2018131059A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/082Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology

Definitions

  • the present invention relates to a neural network circuit.
  • Patent Document 1 As a neuron circuit configuration method in a neural network, an apparatus as disclosed in Japanese Patent Laid-Open No. 4-51384 (Patent Document 1) is disclosed.
  • the weight data is approximated by one power of two or a sum of a plurality of powers of two.
  • An example is shown in which multiplication of input data and weight data is approximated by a small circuit by configuring a power of 2 operation by a bit shift circuit and adding the results by an adder.
  • a neuron which is a basic unit of a neural network, is configured to multiply a plurality of input data and a corresponding weighting factor, add the multiplication results, and output the result. Therefore, when it is realized by a logic circuit such as an FPGA, a large number of multipliers are required, and the circuit scale becomes a problem.
  • a means for multiplying the rounded value of the mantissa part of the weight data by the input data a means for shifting the multiplication result by the number of bits of the rounded value, a means for adding the shift result and the input data, and a weight exponent And means for shifting by the number of bits.
  • multiplication of input data and weight data can be simplified and a neural network can be realized with a small circuit.
  • the block diagram which shows the neuron of an Example The block diagram which shows the shift addition means of an Example.
  • Block diagram showing an example of a general neural network circuit The block diagram which shows an example of the conventional neuron.
  • FIG. 10 is a block diagram of a neural network circuit mounting the embodiment.
  • a neural network that recognizes characters from a manually written character image.
  • image data indicating the gray value of a total of 100 pixels of 10 vertical pixels ⁇ 10 pixels is input as 100 signals.
  • the three intermediate layers are composed of 100 neurons 1 for each layer.
  • the output of each neuron is input to 100 neurons 1 in the next layer, and finally 100 neurons 1 in the output layer output the recognition result.
  • the character identification result is obtained by the number of the neuron that produces the maximum value.
  • FIG. 11 is a block diagram of a conventional general neuron 1.
  • Multiplication 100 performs multiplication of input in and weight Wn.
  • the adder 102 is a means for obtaining the sum of the multiplication results with the respective weight data of the inputs i0 to i99.
  • the adder 103 is means for adding the output of the adder 102 and the bias data.
  • the output function 104 is means for performing a certain function operation on the output value of the adder 103 and outputting the result.
  • one object of the present embodiment is to realize a neural network circuit with a small-scale circuit while maintaining the performance by making this multiplication an operation by a combination of addition and bit shift.
  • FIG. 1 is a block diagram of a neuron according to an embodiment.
  • the shift addition 101 executes a multiplication operation of the input in and the weight coefficient Wa. Details will be described later with reference to FIG.
  • the adder 102 is a means for obtaining the total sum of the shift addition results with the respective weighting factors from the input i0 to i99.
  • the adder 102 is a means for adding the output of the adder 102 and the bias data.
  • the output function 104 is means for performing a certain function operation on the output value of the adder 103 and outputting the result.
  • FIG. 2 is a block diagram of the shift addition means according to the embodiment.
  • the weight coefficient storage unit 201 is a means for storing a weight coefficient.
  • S indicates the sign of the weight, and is 1 for plus and -1 for minus.
  • m is an integer greater than or equal to 0, indicating the accuracy of the weighting factor, and has 2 m values in the range of 2 n to 2 n + 1 . Details will be described later with reference to FIG.
  • FIG. 5 is a diagram showing the weighting factor Wa according to the mantissa shift number m in the range of 2 n to 2 n ⁇ 1 .
  • the weighting coefficient score 2 m .
  • R is a rounded value of the weight, and is an integer in the range of 0 less than R ⁇ 2 m .
  • K is the number of bit shifts corresponding to the exponent of the weight and is an integer.
  • the shift addition 101 in FIG. 2 shows a specific method for realizing the above arithmetic expression.
  • the sign conversion 202 is a function for converting the input in to either positive or negative data. If the sign is 0, the input in is output as it is, and if the sign is 1, the input in is multiplied by -1 and output.
  • Multiplier 203 is means for multiplying the mantissa rounding value that is an output from weighting factor storage section 201.
  • the mantissa shift 204 is means for bit-shifting the output of the multiplier 203 in accordance with the mantissa shift number that is the output from the weight coefficient storage unit 201. If the mantissa shift number is a positive value, the shift is performed in the left direction. If the value is negative, the shift is performed in the right direction.
  • the adder 205 is a means for adding the output of the mantissa shift 204 and the output of the sign conversion 202.
  • the exponent shift 206 is means for bit-shifting the output of the adder 205 in accordance with the exponent shift number that is an output from the weight coefficient storage unit 201. If the exponent shift number is a positive value, shift to the left. If the value is negative, the shift is performed in the right direction.
  • the weighting coefficient according to the above equation a is surely applied from the time of learning for obtaining the weighting coefficient of each neuron first in the neural network of FIG.
  • learning for obtaining a weighting factor is performed by a floating point calculation by a computer, the obtained weighting factor is approximated to the weighting factor by the above formula, and the neural network is realized by a small-scale logic circuit. May be.
  • FIG. 3 is a block diagram showing the correspondence between the conventional weighting factor 301 described in the floating-point format and the weighting factor 201 used for the shift addition processing of this embodiment.
  • This embodiment is intended for fixed-point arithmetic, but shows an example in which the weighting factor used for the shift addition process is easily obtained from the floating-point weighting factor. This is effective when, for example, learning for obtaining a weighting factor is performed by a floating point calculation by a computer, the obtained weighting factor is converted into the weighting factor of the present invention, and a neural network is realized by a small-scale logic circuit. .
  • the symbol S is the same as the symbol in the weighting factor storage unit 301 in the floating point format.
  • the exponent shift number K is generated by the exponent conversion 302 based on the exponent data in the weight coefficient storage unit 301.
  • the exponent value in the floating-point format is a value obtained by adding 127 as an offset. Therefore, in exponent conversion 302, a value obtained by subtracting 127 is set as an exponent shift number in 2's complement notation.
  • the mantissa rounding value R is generated by the mantissa conversion 303 based on the mantissa data in the weight coefficient storage unit 301. Specifically, the upper m bits of the mantissa data are used as the mantissa rounding value.
  • the mantissa shift number m is generated by mantissa conversion 303 based on the mantissa data of the weight data 301. Specifically, the number of bits of the mantissa rounding value R is set as m.
  • FIG. 4 is a table showing examples of weighting factors.
  • the formula to be calculated is determined depending on which power of 2 the weighting factor is based on the power of 2.
  • specific numerical examples will be described.
  • the formula 1 is multiplied by 2 ⁇ 2 and the result of the formula 3 is obtained.
  • FIG. 6 is a diagram showing the weighting factor Wa according to the mantissa shift number m in the range of 1.0 to ⁇ 1.0. Since the number is always constant in the range of 2 n to 2 n ⁇ 1, the weight coefficient is not rounded to 0 even when the weight value is close to 0, and input data can be multiplied with high accuracy.
  • FIG. 7 is a block diagram of a shift addition means which is another embodiment.
  • the weighting coefficient storage unit 201 is means for storing a weighting system numerical value.
  • S indicates the sign of the weight, and is 1 for plus and -1 for minus.
  • m is an integer greater than or equal to 0 and indicates the accuracy of the weighting factor, and has 2 m weighting factors in the range of 2 n to 0. Details will be described later with reference to FIG.
  • FIG. 9 is a diagram showing the weighting factor Wb corresponding to the mantissa shift number m for the weighting factor in the range of 2 n to 0.
  • Wb weighting factor
  • m mantissa shift number
  • the weighting coefficient score 2 m .
  • R is a rounded value of the weight, and is an integer in the range of 0 ⁇ R ⁇ 2 m .
  • K is the number of bit shifts corresponding to the exponent of the weight and is an integer.
  • the shift addition 101 in FIG. 7 shows a specific method for realizing the above arithmetic expression.
  • the sign conversion 701 is a function for changing the input data to either positive or negative data. If the code is 0, the input data is output as it is, and if the code is 1, the input data is multiplied by -1 and output.
  • the multiplier 702 is a means for multiplying the mantissa rounding value that is an output from the weight coefficient storage unit 201.
  • the mantissa shift 703 is a means for bit-shifting the output of the multiplier 702 in accordance with the mantissa shift number that is an output from the weight coefficient storage unit 201. If the mantissa shift number is a positive value, the shift is performed in the left direction. If the value is negative, the shift is performed in the right direction.
  • the exponent shift 704 is means for bit-shifting the output from the mantissa shift 703 in accordance with the exponent shift number. If the exponent shift number is a positive value, shift to the left. If the value is negative, the shift is performed in the right direction.
  • the weighting coefficient according to the above equation b is surely applied from the time of learning for obtaining the weighting coefficient of each neuron in the first time in the neural network of FIG.
  • learning for obtaining a weighting factor is performed by a floating point calculation by a computer, the obtained weighting factor is approximated to the weighting factor by the above formula, and the neural network is realized by a small-scale logic circuit. May be.
  • FIG. 8 is a table showing examples of weighting factors in FIG.
  • the formula 1 is multiplied by 2 ⁇ 2 and the result of the formula 3 is obtained.
  • the number of weight coefficient values in the range of 2 n to 2 n ⁇ 1 is made constant, the small weight coefficient value is prevented from being rounded to 0, and the performance is improved.
  • a neural network can be realized with a small circuit while maintaining it.
  • the circuit system is generalized, and the performance and circuit scale can be easily adjusted according to the application target of DNN.
  • the present invention is not limited to the above-described embodiments, and includes various modifications. For example, it is possible to add, convert, delete, etc. a part of each embodiment within the scope of the effects of the present invention. Moreover, it is possible to replace a part of each Example.
  • the above-described embodiment is a description of the present invention in an easy-to-understand manner, and is not necessarily limited to the one having the described configuration.

Landscapes

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

Abstract

本発明は、入力データと重みデータの乗算を簡略化しニューラルネットワークを小規模な回路で実現することが課題である。そこで、重みデータの仮数部の丸め値と入力データを乗算する手段と、その乗算結果を丸め値のビット数分シフトする手段と、そのシフト結果と入力データを加算する手段と、重みの指数部のビット数分シフトする手段とで構成される。

Description

ニューラルネットワーク回路
 本発明は、ニューラルネットワーク回路に関する。
 ニューラルネットワークにおけるニューロンの回路構成方法としては、特開平4―51384号公報(特許文献1)に記載のような装置が開示されている。特許文献1では、重みデータを、1つの2のべき乗、または複数の2のべき乗の和で近似する。2のべき乗演算をビットシフト回路で構成し、それらの結果を加算器で加算することで入力データと重みデータの乗算を小規模の回路で近似する例が示されている。
特開平4―51384号公報
 機械学習の1つの手法として、ディープニューラルネットワークがある。ニューラルネットワークの基本単位であるニューロンは、複数の入力データとそれに対応する重み係数を乗算し、それらの乗算結果を加算し出力する構成である。そのため、FPGA等の論理回路で実現する場合、多数の乗算器が必要となり回路の大規模化が問題となる。
 そこで、入力データと重みデータの乗算を簡略化しニューラルネットワークを小規模な回路で実現することが課題である。
 本発明はこのような事情に鑑みてなされたものである。一例として、重みデータの仮数部の丸め値と入力データを乗算する手段と、その乗算結果を丸め値のビット数分シフトする手段と、そのシフト結果と入力データを加算する手段と、重みの指数部のビット数分シフトする手段とで構成される。
 本発明によれば、入力データと重みデータの乗算を簡略化しニューラルネットワークを小規模な回路で実現することができる。
実施例のニューロンを示すブロック図。 実施例のシフト加算手段を示すブロック図。 実施例の重み係数の変換を示すブロック図。 実施例の重み係数の値を示す表。 実施例の2のn乗から2のn-1乗の範囲に対する仮数シフト数に応じた重み係数を示す図。 実施例の1から-1までの重みの範囲に対する仮数シフト数に応じた重み係数を示す図。 実施例のシフト加算手段を示すブロック図。 実施例の重み係数の値を示す表。 実施例の2のn乗から0の範囲に対する仮数シフト数に応じた重み係数を示す図。 一般的なニューラルネットワーク回路の一例を示すブロック図 従来のニューロンの一例を示すブロック図。
 以下、本発明の実施例を図1~図11により説明する。
  図10は、実施例を搭載するニューラルネットワーク回路のブロック図である。実施例として、人手で書かれた文字の画像から文字を認識するニューラルネットワークを考える。図10において、入力層では、縦10画素×10画素の合計100画素の濃淡値を示す画像データを100個の信号として入力する。次に、3つの中間層は、各層ごとに100個のニューロン1で構成されている。各ニューロンの出力が次の層の100個のニューロン1に入力し、最後に出力層の100個のニューロン1が認識結果を出力する。
 例えば、出力層の一番上のニューロン1の出力が文字「あ」である場合に、他の出力層のニューロン1に比べて大きな値を出力するようになっている。また、上から2番目のニューロン1の出力は文字「い」である場合に、他の出力層のニューロンに比べて大きな値を出力するようになっている。上記のようにして、何番目のニューロンが最大値を出すかで文字の識別結果を得る。
 図11は、従来の一般的なニューロン1のブロック図である。乗算100は、入力inと重みWnの乗算を実行する。加算器102は、入力i0からi99までのそれぞれの重みデータとの乗算結果の総和を求める手段である。加算器103は、加算器102の出力とバイアスデータを加算する手段である。出力関数104は、加算器103の出力値に対し、ある関数演算を行いその結果を出力する手段である。
 図10のニューラルネットワーク回路を高速で処理することを目的に、論理回路で実現する場合、1つのニューロン1に100個の乗算器が必要となる。中間層の1層だけを一度に演算する場合でも100ニューロン×100個=10000個の乗算器が必要となる。高い文字認識の性能を得るためには、乗算器100に入力する重みWのビット数は8ビット、画像入力データのビット数は8ビット必要であり、これらを論理回路で実現しようとすると膨大な回路規模となる。
 したがって、本実施例では、この乗算を加算とビットシフトの組み合わせによる演算とすることで、性能を維持しながら小規模な回路でニューラルネットワーク回路を実現することを一つの目的としている。
 図1は、実施例であるニューロンのブロック図である。シフト加算101は入力inと重み係数Waの乗算演算を実行する。なお、詳細は図2を参照して後述する。加算器102は、入力i0からi99までのそれぞれの重み係数とのシフト加算結果の総和を求める手段である。加算器102は、加算器102の出力とバイアスデータを加算する手段である。出力関数104は、加算器103の出力値に対し、ある関数演算を行いその結果を出力する手段である。
 図2は、実施例であるシフト加算手段のブロック図である。重み係数記憶部201は重み係数を記憶する手段である。シフト加算101は重み係数Waを、

(式a)Wa= S*(1+R*2-m)*2

により求め、入力inと乗算を行う。ここで、Sは、重みの正負の符号を示しており、プラスの場合は1、マイナスの場合は-1である。mは、0以上の整数で、重み係数の精度を示しており、2から2n+1の範囲に2個の値を持つ。詳しくは図5にて後述する。
 図5は、2~2n-1の範囲における仮数シフト数mに応じた重み係数Waを示す図である。2~2n-1の範囲において、m=1では2点、m=2では4点、m=3では8点の重み係数を持つ。以上のように、重み係数の点数=2となる。
 次に上記の式aにおいて、Rは重みの丸め値であり、0小なりR<2 の範囲の整数である。Kは、重みの指数に相当するビットシフト数であり整数である。
 図2のシフト加算101は、上記の演算式の具体的な実現方法を示している。符号変換202は、入力inを正負のどちらかのデータにする機能である。符号が0であれば入力inをそのまま出力し、符号が1であれば入力inに-1を乗算して出力する。
 乗算器203は、重み係数記憶部201からの出力である仮数丸め値を乗算する手段である。
 仮数シフト204は、乗算器203の出力を重み係数記憶部201からの出力である仮数シフト数に応じてビットシフトする手段である。仮数シフト数がプラスの値であれば左方向にシフトを行う。また、マイナスの値であれば右方向にシフトを行う。
 加算器205は、仮数シフト204の出力と符号変換202の出力を加算する手段である。
 指数シフト206は、加算器205の出力を重み係数記憶部201からの出力である指数シフト数に応じてビットシフトする手段である。指数シフト数がプラスの値であれば左方向にシフトを行う。また、マイナスの値であれば右方向にシフトを行う。
 上記の式aによる重み係数は、図10のニューラルネットワークにおいて、最初の各ニューロンの重み係数を求めるための学習時から適用するのが確実である。なお、図3に示すように、重み係数を求めるための学習をコンピュータによる浮動小数点演算で行い、求まった重み係数を上記の式による重み係数に近似し、ニューラルネットを小規模な論理回路で実現してもよい。
 図3は、浮動小数点形式で記述された従来の重み係数301と、本実施例のシフト加算処理に使う重み係数201との対応を示すブロック図である。
 本実施例は、固定小数点演算を対象にしているが、シフト加算処理に使う重み係数が浮動小数点形式の重み係数から容易に求めるための一例を示す。これは、例えば重み係数を求めるための学習をコンピュータによる浮動小数点演算で行い、求まった重み係数を本発明の重み係数に変換し、ニューラルネットを小規模な論理回路で実現する場合に有効である。
 重み係数201において、符号Sは、浮動小数点形式の重み係数記憶部301の符号と同一である。
 指数シフト数Kは、重み係数記憶部301の指数部データを基に指数変換302にて生成する。具体的には、浮動小数点形式の指数の値はオフセットとして127を加えた値となっている。したがって、指数変換302では127を引いた値を指数シフト数として2の補数表示で設定する。
 仮数丸め値Rは、重み係数記憶部301の仮数部データを基に仮数変換303にて生成する。具体的には、仮数部データの上位mビットを仮数丸め値とする。
 仮数シフト数mは、重みデータ301の仮数部データを基に仮数変換303にて生成する。具体的には、仮数丸め値Rのビット数をmとして設定する。
 図4は、重み係数の実施例を示す表である。本実施例では、重み係数が、2のべき乗を基準に、どの2のべき乗の範囲にあるかで、計算する式が決まる。以下に具体的な数値例で説明する。
 最初に表401は重みの範囲Wが2から1の範囲で、仮数シフト数m=2の場合の重み係数Waの値と、それを求めるための式1を示したものである。式1よりRの値は0から3までの4つの整数値を取り得るので、重み係数Waは1.0から1.75までの0.25刻みの4つの値を取る。
 次に、表402は重みの範囲Wが1.0から0.5の範囲で、仮数シフト数m=2の場合の重み近似値Waの値と、それを求めるための式2を示したものである。指数シフト数K=-1とすることで式1に2-1を乗じる形となり、式2の結果を得る。
 次に、表403は重みの範囲Wが0.5~0.25の範囲で、仮数シフト数m=2の場合の重み係数Waの値と、それを求めるための式3を示したものである。指数シフト数K=-2とすることで式1に2-2を乗じる形となり、式3の結果を得る。
 以上のように、式1で求めた重み係数値を元に、重み係数の含まれる2のべき乗の範囲に応じてビットシフトを行うことで、重みの値が0に近い値であっても、0に丸められないことが本実施例の特徴である。
 図6は、1.0~-1.0の範囲での仮数シフト数mに応じた重み係数Waを示す図である。2~2n-1の範囲において常に一定の個数となるため、重み値が0に近い値であっても重み係数が0に丸められることがなく、入力データと精度良く乗算ができる。
 図7はもう一つの実施例であるシフト加算手段のブロック図である。重み係数記憶部201は重み系数値を記憶する手段である。シフト加算101は入力inに対し重み係数値Wbを、

(式b)Wb= S*R*2-m*2 

により求め、入力inと乗算を行う。ここで、Sは、重みの正負の符号を示しており、プラスの場合は1、マイナスの場合は-1である。mは、0以上の整数で重み係数の精度を示しており、2から0の範囲に2個の重み係数を持つ。詳しくは図9にて後述する。
 図9は、2~0の範囲の重み係数に対する仮数シフト数mに応じた重み係数Wbを示す図である。2~0の範囲において、m=1では2点、m=2では4点、m=3では8点となる。以上のように、重み係数の点数=2となる。
 次に、上記の式bにおいて、Rは重みの丸め値であり、0≦R<2 の範囲の整数である。
 Kは、重みの指数に相当するビットシフト数であり整数である。図7のシフト加算101は、上記の演算式の具体的な実現方法を示している。
 符号変換701は、入力データを正負のどちらかのデータにする機能である。符号が0であれば入力データをそのまま出力し、符号が1であれば入力データに-1を乗算して出力する。
 乗算器702は、重み係数記憶部201からの出力である仮数丸め値を乗算する手段である。
 仮数シフト703は、乗算器702の出力を重み係数記憶部201からの出力である仮数シフト数に応じてビットシフトする手段である。仮数シフト数がプラスの値であれば左方向にシフトを行う。また、マイナスの値であれば右方向にシフトを行う。
 指数シフト704は、仮数シフト703からの出力を指数シフト数に応じてビットシフトする手段である。指数シフト数がプラスの値であれば左方向にシフトを行う。また、マイナスの値であれば右方向にシフトを行う。
 上記の式bによる重み係数は、図10のニューラルネットワークにおいて、最初の各ニューロンの重み係数を求めるための学習時から適用するのが確実である。なお、図3に示すように、重み係数を求めるための学習をコンピュータによる浮動小数点演算で行い、求まった重み係数を上記の式による重み係数に近似し、ニューラルネットを小規模な論理回路で実現してもよい。
 図8は、図7における重み係数の実施例を示す表である。
 本実施例では、重みの値が、2のべき乗を基準に、どの2のべき乗の範囲に含まれているかで、計算する式が決まる。以下に具体的な数値例で説明する。
 最初に表801は重みの範囲Wが1から0の範囲で、仮数シフト数m=2の場合の重み係数Wbの値とそれを求めるための式1を示したものである。式1よりRの値は0から3までの4つの整数値を取り得るので、重み係数Wbは1~0までの0.25刻みの4つの値を取る。
 次に、表802は重みの範囲Wが0.5~0の範囲で、仮数シフト数m=2の場合の重み係数Wbの値とそれを求めるための式2を示したものである。指数シフト数K=-1とすることで式1に2-1を乗じる形となり、式2の結果を得る。
 次に、表803は重みの範囲Wが0.25~0の範囲で、仮数シフト数m=2の場合の重み係数Wbの値と、それを求めるための式3を示したものである。指数シフト数K=-2とすることで式1に2-2を乗じる形となり、式3の結果を得る。
 以上のように、式1で求めた重み係数を元に、重み係数の含まれる2のべき乗の範囲に応じてビットシフトを行うことで、重みの値が0に近い値であっても、0に丸められないことが本実施例の特徴である。
 以上のように説明した各実施例によれば、2~2n-1の範囲の重み係数値の個数を一定とし、小さな重み係数値が0に丸められてしまうのを回避し、性能を維持しながらニューラルネットワークを小規模な回路で実現できる。また、回路方式を一般式化し、DNNの適用対象に応じて性能と回路規模の調整が容易である。
 以上で本発明の実施例を説明したが、本発明は上記した各実施例に限定されるものではなく、様々な変形例が含まれる。例えば、本発明の効果を奏する範囲で、各実施例の一部を付加、転換、削除等することが可能である。また、各実施例の一部を入れ替えることが可能である。
 すなわち、上記した実施例は本発明を分かりやすく説明したものであり、必ずしも説明した構成を備えるものに限定されるものではない。
1 ニューロン
100 乗算器
101 シフト加算
102 加算器
103 加算器
104 出力関数
201 本発明の重み係数記憶部
202 符号変換
203 乗算器
204 ビットシフタ
205 加算器
206 ビットシフタ
301 浮動小数点形式の重み係数記憶部
401~403 重み係数表
701 符号変換
702 乗算器
703 ビットシフタ
704 ビットシフタ
801~803 重み係数表

Claims (6)

  1.  ニューラルネットワークを構成するニューロンにおいて、複数の入力データに対応する重み係数を、重み丸め値と、ビットシフト量を示す情報として与え、前記入力データに対し、前記重み丸め値との乗算と前記ビットシフトにて重み付け演算を行う手段を備えることを特徴とするニューラルネットワーク回路。
  2.  ニューラルネットワークを構成するニューロンにおいて、前記入力データに対する重み付け演算後の値が、前記重み丸め値との乗算と前記ビットシフトの結果となることを特徴とする、請求項1記載のニューラルネットワーク回路。
  3.  前記複数の入力データに対応する重み係数が実装された回路は、前記重み丸め値と、前記ビットシフト量を示す情報に変換する手段を有することを特徴とする、請求項1または2記載のニューラルネットワーク回路。
  4.  2のn乗と2のn-1乗の範囲で前記重み係数の個数が一定となる演算にて求めた重み係数を有することを特徴とする、請求項1乃至3のいずれかに記載のニューラルネットワーク回路。
  5.  2のn乗と0の範囲で前記重み係数の個数が一定となる演算にて求めた重み係数を有することを特徴とする、請求項1乃至3のいずれかに記載のニューラルネットワーク回路。
  6.  重みデータの仮数部の丸め値と入力データを乗算する手段と、前記乗算の結果を丸め値のビット数分シフトする手段と、前記シフトの結果と前記入力データを加算する手段と、重みの指数部のビット数分シフトする手段と、を備えるニューラルネットワーク回路。
PCT/JP2017/000367 2017-01-10 2017-01-10 ニューラルネットワーク回路 WO2018131059A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2018561111A JP6734938B2 (ja) 2017-01-10 2017-01-10 ニューラルネットワーク回路
PCT/JP2017/000367 WO2018131059A1 (ja) 2017-01-10 2017-01-10 ニューラルネットワーク回路
US16/470,633 US11531896B2 (en) 2017-01-10 2017-01-10 Neural network circuit providing for operations with bit shifting and rounded values of weight information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2017/000367 WO2018131059A1 (ja) 2017-01-10 2017-01-10 ニューラルネットワーク回路

Publications (1)

Publication Number Publication Date
WO2018131059A1 true WO2018131059A1 (ja) 2018-07-19

Family

ID=62839498

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2017/000367 WO2018131059A1 (ja) 2017-01-10 2017-01-10 ニューラルネットワーク回路

Country Status (3)

Country Link
US (1) US11531896B2 (ja)
JP (1) JP6734938B2 (ja)
WO (1) WO2018131059A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022515343A (ja) * 2018-12-29 2022-02-18 ベイジン センスタイム テクノロジー デベロップメント シーオー.,エルティーディー 画像処理方法、装置、インテリジェント運転システム及び車載演算プラットフォーム

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109284827A (zh) * 2017-07-19 2019-01-29 阿里巴巴集团控股有限公司 神经网络计算方法、设备、处理器及计算机可读存储介质

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06259585A (ja) * 1993-03-10 1994-09-16 Toyota Central Res & Dev Lab Inc ニューラルネットワーク装置
JP2006155102A (ja) * 2004-11-26 2006-06-15 Asahi Kasei Microsystems Kk 演算処理装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0461902B1 (en) 1990-06-14 1998-12-23 Canon Kabushiki Kaisha Neural network
JP2862337B2 (ja) * 1990-06-19 1999-03-03 キヤノン株式会社 ニューラルネットワークの構築方法
US9268529B2 (en) * 2006-11-09 2016-02-23 Pentomics, Inc. Efficient angle rotator configured for dynamic adjustment
US10275394B2 (en) * 2015-10-08 2019-04-30 Via Alliance Semiconductor Co., Ltd. Processor with architectural neural network execution unit
US10565494B2 (en) * 2016-12-31 2020-02-18 Via Alliance Semiconductor Co., Ltd. Neural network unit with segmentable array width rotator
US10140574B2 (en) * 2016-12-31 2018-11-27 Via Alliance Semiconductor Co., Ltd Neural network unit with segmentable array width rotator and re-shapeable weight memory to match segment width to provide common weights to multiple rotator segments

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06259585A (ja) * 1993-03-10 1994-09-16 Toyota Central Res & Dev Lab Inc ニューラルネットワーク装置
JP2006155102A (ja) * 2004-11-26 2006-06-15 Asahi Kasei Microsystems Kk 演算処理装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022515343A (ja) * 2018-12-29 2022-02-18 ベイジン センスタイム テクノロジー デベロップメント シーオー.,エルティーディー 画像処理方法、装置、インテリジェント運転システム及び車載演算プラットフォーム

Also Published As

Publication number Publication date
US11531896B2 (en) 2022-12-20
JP6734938B2 (ja) 2020-08-05
JPWO2018131059A1 (ja) 2019-11-07
US20190325311A1 (en) 2019-10-24

Similar Documents

Publication Publication Date Title
Wang et al. A high-speed and low-complexity architecture for softmax function in deep learning
CN109214509B (zh) 一种用于深度神经网络高速实时量化结构和运算实现方法
CN108021537B (zh) 一种基于硬件平台的softmax函数计算方法
JPH07248841A (ja) 非線形関数発生装置およびフォーマット変換装置
JP2019164595A (ja) 演算システム
EP3782019B1 (en) Multi-input floating-point adder
WO2018131059A1 (ja) ニューラルネットワーク回路
CN112651496A (zh) 一种处理激活函数的硬件电路及芯片
TW202319909A (zh) 用於將輸入集相乘之硬體電路及方法,以及非暫時性機器可讀儲存裝置
JP4376904B2 (ja) 乗算装置
JP2010079840A (ja) デジタル演算回路
US4677583A (en) Apparatus for decimal multiplication
CN110879697B (zh) 一种近似计算tanh函数的装置
RU2717915C1 (ru) Вычислительное устройство
JP2006172035A (ja) 除算・開平演算器
CN113672196B (zh) 一种基于单数字信号处理单元的双乘法计算装置和方法
CN111492369A (zh) 人工神经网络中移位权重的残差量化
JP3660075B2 (ja) 除算装置
EP4285215A1 (en) Digital circuitry for normalization functions
JP2005056032A (ja) 剰余系演算システム、スケーリング演算器、スケーリング演算方法、及びそのプログラムと記録媒体
KR102592708B1 (ko) 로그 영역의 연산을 수행하도록 구성된 신경망 가속기
JP2606326B2 (ja) 乗算器
CN116991359B (zh) Booth乘法器、混合Booth乘法器及运算方法
US20230144950A1 (en) Modulo-space processing in multiply-and-accumulate units
US5923888A (en) Multiplier for the multiplication of at least two figures in an original format

Legal Events

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

Ref document number: 17891435

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2018561111

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17891435

Country of ref document: EP

Kind code of ref document: A1