CN110766141A - Activation function hybrid calculation method and system based on CORDIC - Google Patents

Activation function hybrid calculation method and system based on CORDIC Download PDF

Info

Publication number
CN110766141A
CN110766141A CN201911037143.9A CN201911037143A CN110766141A CN 110766141 A CN110766141 A CN 110766141A CN 201911037143 A CN201911037143 A CN 201911037143A CN 110766141 A CN110766141 A CN 110766141A
Authority
CN
China
Prior art keywords
cordic
module
input value
calculation
core control
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.)
Pending
Application number
CN201911037143.9A
Other languages
Chinese (zh)
Inventor
李丽
陈辉
傅玉祥
程开丰
何书专
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Ningqi Intelligent Computing Chip Research Institute Co Ltd
Original Assignee
Nanjing Ningqi Intelligent Computing Chip Research Institute Co Ltd
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 Nanjing Ningqi Intelligent Computing Chip Research Institute Co Ltd filed Critical Nanjing Ningqi Intelligent Computing Chip Research Institute Co Ltd
Priority to CN201911037143.9A priority Critical patent/CN110766141A/en
Publication of CN110766141A publication Critical patent/CN110766141A/en
Pending legal-status Critical Current

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/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • 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/15Correlation function computation including computation of convolution operations

Landscapes

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

Abstract

The invention discloses an activation function hybrid calculation method and system based on CORDIC, and belongs to the technical field of function calculation. The method comprises the steps that a core control module processes a to-be-evaluated value x according to a calculation type t to obtain an input value a and inputs the input value a to a hyperbolic rotation mode CORDIC module; then, operation is carried out according to the input value a to obtain xnAnd yn,xnAnd ynAdding the values by an adder to obtain an input value b, inputting the input value b to a linear vector mode CORDIC module for division to obtain z'nThen according to the calculation type t to z'nAnd processing and outputting. The system comprises a core control module, a hyperbolic rotation mode CORDIC module and a linear vector mode CORDIC module, wherein the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module are respectively connected with the core control module. The invention aims to overcome the defects that in the prior art, the sigmoid function and the tanh function have low calculation precision and are countedThe invention can improve the calculation precision of sigmoid function and tanh function and expand the data range.

Description

Activation function hybrid calculation method and system based on CORDIC
Technical Field
The invention relates to the technical field of function calculation, in particular to an activation function hybrid calculation method and system based on CORDIC.
Background
Cordic (coordinate rotation digital computer), which is a coordinate rotation digital computer, can be widely applied to the calculation of basic functions, including operations such as exponential function, division, etc. Volder was first proposed in 1959 by j.d. Walter, later, proposed a unified CORDIC algorithm in 1971; in 2004, Tso-BingJuang and the like also put forward an improved parallel CORDIC algorithm, thereby greatly improving the iteration speed of the CORDIC algorithm and achieving high precision. Its advantage lies in that only through shift and add and subtract operation balance calculation precision, area and speed etc. important hardware index, therefore extensively be applied to fields such as digital signal processing. The CORDIC algorithm has two modes of rotation and vector, and can be applied to a circular coordinate system, a linear coordinate system and a hyperbolic coordinate system, so that 6 types of CORDIC can be deduced, and further, the operation of a plurality of basic functions can be derived.
An activation function is a function that runs on a neuron of an artificial neural network, responsible for mapping the input of the neuron to the output. The activation function plays an important role in learning and understanding very complex and nonlinear functions of the artificial neural network model. They introduce non-linear characteristics into the network so that the neural network can arbitrarily approximate any non-linear function, and thus the neural network can be applied to a plurality of non-linear models. In deep learning, the commonly used activation functions are mainly: sigmoid function, tanh function, Relu function, etc. The invention mainly focuses on the hardware implementation of sigmoid and tanh functions, because exponential operation and division operation are complex and area-consuming in hardware implementation, so that the invention has gained high attention in the hardware implementation of neural network algorithm.
Therefore, how to design a hardware circuit with high precision, small area, low power consumption and high speed is a main research problem. The traditional method for calculating the sigmoid function and the tanh function mainly comprises a lookup table, a piecewise linear approximation method, a polynomial approximation method and the like, but the methods have the defects that the calculation range is not easy to expand or the precision is low, so that the method for overcoming the problems is significant in research, and the efficiency and the performance of hardware realization of the neural network algorithm can be improved.
In summary, how to improve the calculation accuracy of the sigmoid function and the tanh function and reduce the calculation resource overhead is an urgent problem to be solved in the prior art.
Disclosure of Invention
1. Problems to be solved
The invention aims to overcome the defects that the calculation results of the sigmoid function and the tanh function are low in precision and the calculation range is not easy to expand in the prior art, and provides an activation function hybrid calculation method and an activation function hybrid calculation system based on CORDIC (coordinated rotation digital computer), which can improve the calculation precision of the sigmoid function and the tanh function, expand the data range and reduce the calculation resource overhead.
2. Technical scheme
In order to solve the problems, the technical scheme adopted by the invention is as follows:
the invention relates to an activation function hybrid calculation method based on CORDIC, which comprises the steps of firstly inputting a to-be-evaluated value x and a calculation type t to a core control module, processing the to-be-evaluated value x by the core control module according to the calculation type t to obtain an input value a, and inputting the input value a to a hyperbolic rotation mode CORDIC module; then the hyperbolic rotation mode CORDIC module carries out operation according to the input value a to obtain xnAnd yn,xnAnd ynAdding the input value b through an adder, and inputting the input value b to a linear vector mode CORDIC module; the linear vector mode CORDIC module carries out division operation according to the input value b to obtain z'nThen the core control module calculates t to z 'according to the type of calculation'nAnd processing and outputting.
Further, the specific process of the core control module processing the to-be-evaluated x according to the calculation type t is as follows:
when t is 0, the core control module inverts the sign bit of the x to be evaluated;
when t is 1, the core control module shifts the value x to be evaluated by one bit to the left.
Further, the hyperbolic rotation mode CORDIC module performs operation according to the input value a to obtain xnAnd ynThe specific process comprises the following steps:
initial input value x is input by a hyperbolic rotation mode CORDIC module0,y0,z0Are respectively arranged as
Figure BDA0002251827690000021
0,D1And then the pair of CORDIC modules in hyperbolic rotation mode0Y0, z0 to obtain xnAnd yn(ii) a Wherein K is a scaling factor, D1=a,xn=cosh(D1),yn=sinh(D1)。
Furthermore, the linear vector mode CORDIC module carries out division operation according to the input value b to obtain z'nThe specific process comprises the following steps:
linear vector mode CORDIC Module will initially input value x'0,y′0,z′0Are respectively set as D 21,0, then Linear vector mode CORDIC Module pair x'0,y′0,z′0Performing iterative calculation to obtain z'nWherein D is2=b+1。
Further, the air conditioner is provided with a fan,or
Figure BDA0002251827690000023
Wherein m is the total iteration number in the reverse direction, and n is the total iteration number in the positive direction.
Further, an iterative calculation formula of the hyperbolic rotation mode CORDIC module is as follows:
when k is>At 0, xk+1=xk+sign(zk)(2-kyk),yk+1=yk+sign(zk)(2-kxk),zk+1=zk-sign(zk)tanh-1(2-k);
When k is less than or equal to 0,
Figure BDA0002251827690000025
Figure BDA0002251827690000026
wherein sign (z)k) According to zkThe positive or negative of the value determines whether the current operation is "+" or "-".
Further, x is added by an addernAnd ynAdding the two to obtain an input value b, wherein the input value b is cosh (D)1)+sinh(D1)。
Further, the iterative calculation formula of the linear vector mode CORDIC module is:
x′k+1=x′k,y′k+1=y′k-sign(y′k)(2-kx′k),z′k+1=z′k+sign(y′k)2-k
further, the core control module calculates the type t to z'nThe specific process of processing and outputting is as follows:
when t is 0, the core control module will z'nOutput as a result of the sigmoid function;
when t is 1, the core control module will z'nThe sign bit of (c) is inverted and then shifted left by one bit, and then the output value obtained by adding 1 is used as the result of the tanh function.
The invention discloses an activation function hybrid computing system based on CORDIC (coordinated rotation digital computer), which comprises a core control module, a hyperbolic rotation mode CORDIC module and a linear vector mode CORDIC module, wherein the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module are respectively connected with the core control module, and the hyperbolic rotation mode CORDIC module is connected with the linear vector mode CORDIC module through an adder; the core control module is used for task scheduling, the hyperbolic rotation mode CORDIC module is used for calculating an exponential function and expanding a calculation range, the linear vector mode CORDIC module is used for division operation, and the quotient range in the division operation result is between (0 and 1).
3. Advantageous effects
Compared with the prior art, the invention has the beneficial effects that:
(1) according to the CORDIC-based activation function hybrid calculation method, the calculation of the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module is adopted, so that the precision of the calculation result of the activation function can be improved, and the precision of a neural network algorithm is further improved; furthermore, the precision of the calculation results of the sigmoid function and the tanh function is higher through multiple iterations of the module, and the data range can be expanded through reverse iteration.
(2) According to the CORDIC-based activation function hybrid computing system, exponential operation and division operation are achieved by arranging the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module, and module hardware is simple in structure, small in area and low in power consumption, so that computing resource overhead can be reduced, and the efficiency and performance of hardware implementation of a neural network algorithm are improved.
Drawings
FIG. 1 is a first schematic diagram of the system of the present invention;
FIG. 2 is a second schematic structural diagram of the system of the present invention;
FIG. 3 is a schematic diagram of a hyperbolic rotation mode CORDIC module according to the present invention;
FIG. 4 is a schematic diagram of a CORDIC module according to the present invention;
FIG. 5 is a graph of the accuracy distribution of the present invention at different iterations of the linear vector mode CORDIC module;
FIG. 6 is a diagram of the accuracy distribution of the CORDIC module in hyperbolic rotation mode according to the present invention at different forward iteration times;
FIG. 7 is a diagram of the accuracy distribution of the hyperbolic rotation mode CORDIC module in different backward iteration times.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments; moreover, the embodiments are not relatively independent, and can be combined with each other according to needs, so that a better effect is achieved. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
For a further understanding of the invention, reference should be made to the following detailed description taken in conjunction with the accompanying drawings and examples.
Example 1
With reference to fig. 1 and fig. 2, the activation function hybrid calculation method based on CORDIC of the present invention is used for calculating a sigmoid function and a tanh function, and can improve the calculation accuracy of the sigmoid function and the tanh function and expand the calculation range. It should be noted that because
Figure BDA0002251827690000041
Figure BDA0002251827690000042
T (x) stands for tanh function, S (x) stands for sigmoid function; the invention utilizes a hyperbolic rotation mode CORDIC module to calculate e-xOr e2xAnd is calculated by using a linear vector model CORDIC module
Figure BDA0002251827690000043
Or
Figure BDA0002251827690000044
And finally, obtaining the result of the sigmoid function or the tanh function through shifting or addition and subtraction operation.
The invention relates to an activation function hybrid calculation method based on CORDIC (coordinate rotation digital computer), which comprises the following stepsFirstly, inputting a to-be-evaluated value x and a calculation type t to a core control module, processing the to-be-evaluated value x by the core control module according to the calculation type t to obtain an input value a, and inputting the input value a to a hyperbolic rotation mode CORDIC module; then the hyperbolic rotation mode CORDIC module carries out operation according to the input value a to obtain xnAnd yn,xnAnd ynAdding the input value b through an adder, and inputting the input value b to a linear vector mode CORDIC module; the linear vector mode CORDIC module carries out division operation according to the input value b to obtain z'nThen the core control module calculates t to z 'according to the type of calculation'nAnd processing and outputting. It is worth to be noted that through the calculation of the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module, the precision of the function calculation result can be improved, and the precision of the neural network algorithm can be further improved. The specific process of the core control module for processing the to-be-evaluated value x according to the calculation type t is as follows:
when t is 0, the core control module inverts the sign bit of the x to be evaluated;
when t is 1, the core control module shifts the value x to be evaluated by one bit to the left.
Then the hyperbolic rotation mode CORDIC module obtains x through operation according to the input value anAnd ynThe specific process comprises the following steps:
referring to FIG. 3 (RHC for hyperbolic rotation mode CORDIC Module), the initial input value x is input by the hyperbolic rotation mode CORDIC module0,y0,z0Are respectively arranged as
Figure BDA0002251827690000045
0,D1And then the pair of CORDIC modules in hyperbolic rotation mode0,y0,z0Iterative calculation is carried out to obtain xnAnd yn(ii) a Wherein K is a scaling factor, D1=a,xn=cosh(D1),yn=sinh(D1)。
It is worth mentioning that it is possible to show,or
Figure BDA0002251827690000052
Wherein m is the total iteration number in the reverse direction, and n is the total iteration number in the positive direction; particularly, the forward direction iteration number is determined according to the required precision, the reverse direction iteration number is related to the required calculation range, the original calculation range is limited, and when the reverse direction iteration number is more, the calculation range is larger, namely the data range is expanded through reverse iteration.
Further, when the number of iterations satisfies the following condition:
k1=4,k2=3*4+1=13,k3=3*13+1=40……kn=3*kn-1+1, the hyperbolic rotation mode CORDIC module needs repeated iteration once; it should be noted that 1/K is a constant in hardware, and does not need to be calculated separately, and the total number of iterations may be determined in advance according to the error requirement, and then the constant value is calculated.
In addition, the iterative calculation formula of the hyperbolic rotation mode CORDIC module is as follows:
when k is>At 0 (P-RHC of FIG. 3 denotes k>0),xk+1=xk+sign(zk)(2-kyk),yk+1=yk+sign(zk)(2- kxk),zk+1=zk-sign(zk)tanh-1(2-k);
When k is less than or equal to 0 (NP-RHC in FIG. 3 means k is less than or equal to 0),
Figure BDA0002251827690000053
Figure BDA0002251827690000055
wherein sign (z)k) According to zkThe positive or negative of the value determines whether the current operation is "+" or "-".
Then x is added through an addernAnd ynAdding the two to obtain an input value b, wherein the input value b is cosh (D)1)+sinh(D1) I.e. by
Figure BDA0002251827690000056
Furthermore, the linear vector mode CORDIC module carries out division operation according to the input value b to obtain z'nThe specific process comprises the following steps:
in connection with FIG. 4 (VLC stands for Linear vector mode CORDIC Module), the Linear vector mode CORDIC Module will initially input the value x'0,y′0,z′0Are respectively set as D 21,0, then Linear vector mode CORDIC Module pair x'0,y′0,z′0Performing iterative calculation to obtain z'nWherein D is2=b+1=cosh(D1)+sinh(D1)+1. The iterative calculation formula of the linear vector mode CORDIC module is as follows: x'k+1=x′k、y′k+1=y′k-sign(y′k)(2-kx′k)、z′k+1=z′k+sign(y′k)2-k. Wherein sign (y'k) Is according to y'kThe positive or negative of the value determines whether the current operation is "+" or "-". It is worth to be noted that the more the iteration times of the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module are, the higher the precision of the calculated results of the sigmoid function and the tanh function can be.
Further, the core control module calculates the type t to z'nThe specific process of processing and outputting is as follows:
when t is 0, the core control module will z'nOutput as a result of the sigmoid function;
when t is 1, the core control module will z'nThe sign bit of (c) is inverted and then left shifted by one bit, and then 1 is added to output as the result of the tanh function.
The invention discloses an activation function hybrid computing system based on CORDIC (coordinated rotation digital computer), which comprises a core control module, a hyperbolic rotation mode CORDIC module and a linear vector mode CORDIC module, wherein the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module are respectively connected with the core control module, and the hyperbolic rotation mode CORDIC module is connected with the linear vector mode CORDIC module through an adder; the core control module is used for task scheduling, the hyperbolic rotation mode CORDIC module is used for calculating an exponential function and expanding a calculation range, the linear vector mode CORDIC module is used for division operation, and the quotient range in the division operation result is between (0 and 1). It is worth to be noted that the system of the invention realizes the exponential operation and the division operation by arranging the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module, and the module hardware has simple structure, small area and low power consumption, thereby reducing the expense of computing resources and further improving the efficiency and the performance of realizing the hardware of the neural network algorithm.
According to the CORDIC-based activation function hybrid calculation method and the CORDIC-based activation function hybrid calculation system, the precision distribution of the hybrid system is explored by a control variable method. The following three cases are mainly discussed: (assuming that the iteration number of a hyperbolic rotation mode CORDIC module is-m-n, the iteration number of a linear vector mode CORDIC module is 0-p, the precision is expressed by root mean square difference, and the formula is as follows:
Figure BDA0002251827690000061
number of test samples 50000)
(i) When m is 0, n is 16, and p is from 15 to 20, the accuracy of the system is as shown in fig. 5, with an accuracy of the order of 10-5
(ii) When m is 0, p is 18, and n is from 15 to 20, the accuracy of the system is as shown in fig. 6, with an accuracy of the order of 10-6
(iii) When n is 15, p is 18, and m is from 0 to 4, the accuracy of the system is as shown in fig. 7, with an accuracy of the order of 10-6
An example of the present invention is illustrated below and design verification is performed by MATLAB simulation and Verilog's RTL level description.
In the embodiment, the iteration numbers of the hyperbolic rotation mode CORDIC module are-1 to 15, and the iteration numbers of the linear vector mode CORDIC module are 0 to 18. The input range of the sigmoid function is calculated to be [ -3.74,3.74], and the input range of the tanh function is calculated to be [ -1.87,1.87 ]. The input and the output of the core control module are fixed point numbers, the input is composed of a 1-bit sign bit, a 3-bit integer bit and a 25-bit decimal bit, and the output is composed of a 1-bit sign bit, a 0-bit integer bit and a 25-bit decimal bit. For the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module, the decimal place of the hyperbolic rotation mode CORDIC module and the linear vector mode CORDIC module is 25 bits, and comprises input, output and intermediate variables.
The simulation accuracy of the above special case in MATLAB is 10-6After being coded and verified by using a Verilog hardware description language, the performance indexes shown in the table 1 can be obtained by synthesizing the coded data under a process library of 40nm of station power.
TABLE 1 Performance index Table
Frequency of Area of Power consumption
1GHz 36512.78μm2 12.35mW
1.5GHz 40428.81μm2 21.66mW
As can be seen from fig. 5 to fig. 7, the CORDIC-based active function hybrid computing system not only has flexible computing precision, but also has the advantages of fast operating frequency, small area, low power consumption, easy expansion, and the like, which provides an excellent solution for the disadvantages of large resource overhead, low precision, difficult data range expansion, and the like of the conventional hardware implementation method. The Sigmoid function and the tanh function are commonly used activation functions in the neural network algorithm, and the computing system and the implementation method provided by the invention can improve the efficiency and the performance of the overall algorithm and have good reference significance and wide application prospect.
The invention has been described in detail hereinabove with reference to specific exemplary embodiments thereof. It will, however, be understood that various modifications and changes may be made without departing from the scope of the invention as defined in the appended claims. The detailed description and drawings are to be regarded as illustrative rather than restrictive, and any such modifications and variations are intended to be included within the scope of the present invention as described herein. Furthermore, the background is intended to be illustrative of the state of the art as developed and the meaning of the present technology and is not intended to limit the scope of the invention or the application and field of application of the invention.

Claims (10)

1. An activation function hybrid calculation method based on CORDIC is characterized in that: firstly, inputting a to-be-evaluated value x and a calculation type t to a core control module, processing the to-be-evaluated value x by the core control module according to the calculation type t to obtain an input value a, and inputting the input value a to a hyperbolic rotation mode CORDIC module; then the hyperbolic rotation mode CORDIC module carries out operation according to the input value a to obtain xnAnd yn,xnAnd ynAdding the input value b through an adder, and inputting the input value b to a linear vector mode CORDIC module; the linear vector mode CORDIC module carries out division operation according to the input value b to obtain z'nThen the core control module calculates t to z 'according to the type of calculation'nAnd processing and outputting.
2. The CORDIC-based hybrid computation method of an activation function according to claim 1, wherein: the specific process of the core control module for processing the to-be-evaluated value x according to the calculation type t is as follows:
when t is 0, the core control module inverts the sign bit of the x to be evaluated;
when t is 1, the core control module shifts the value x to be evaluated by one bit to the left.
3. The CORDIC-based hybrid computation method of an activation function according to claim 1, wherein: the hyperbolic rotation mode CORDIC module is operated according to an input value aCalculating to obtain xnAnd ynThe specific process comprises the following steps:
initial input value x is input by a hyperbolic rotation mode CORDIC module0,y0,z0Are respectively arranged as
Figure FDA0002251827680000011
0,D1And then the pair of CORDIC modules in hyperbolic rotation mode0,y0,z0Iterative calculation is carried out to obtain xnAnd yn(ii) a Wherein K is a scaling factor, D1=a,xn=cosh(D1),yn=sinh(D1)。
4. The CORDIC-based hybrid computation method of an activation function according to claim 1, wherein: the linear vector mode CORDIC module carries out division operation according to the input value b to obtain z'nThe specific process comprises the following steps:
linear vector mode CORDIC Module will initially input value x'0,y′0,z′0Are respectively set as D21,0, then Linear vector mode CORDIC Module pair x'0,y′0,z′0Performing iterative calculation to obtain z'nWherein D is2=b+1。
5. The CORDIC-based hybrid computation method of an activation function according to claim 3, wherein:
Figure FDA0002251827680000012
or
Figure FDA0002251827680000013
Wherein m is the total iteration number in the reverse direction, and n is the total iteration number in the positive direction.
6. The CORDIC-based hybrid computation method of an activation function according to claim 3, wherein: the iterative calculation formula of the hyperbolic rotation mode CORDIC module is as follows:
when k is>At 0, xk+1=xk+sign(zk)(2-kyk),yk+1=yk+sign(zk)(2-kxk),zk+1=zk-sign(zk)tanh-1(2-k);
When k is less than or equal to 0,
Figure FDA0002251827680000014
Figure FDA0002251827680000015
wherein sign (z)k) According to zkThe positive or negative of the value determines whether the current operation is "+" or "-".
7. The CORDIC-based hybrid computation method of an activation function according to claim 3, wherein: x is added by an addernAnd ynAdding the two to obtain an input value b, wherein the input value b is cosh (D)1)+sinh(D1)。
8. The CORDIC-based activation function hybrid computation method of claim 4, wherein: the iterative calculation formula of the linear vector mode CORDIC module is as follows:
x′k+1=x′k,y′k+1=y′k-sign(y′k)(2-kx′k),z′k+1=z′k+sign(y′k)2-k
9. the CORDIC-based activation function hybrid computation method according to any one of claims 1 to 8, wherein: the core control module is used for calculating z 'according to the calculation type t'nThe specific process of processing and outputting is as follows:
when t is 0, the core control module will z'nOutput as a result of the sigmoid function;
when t is equal to 1, the first step is carried out,the core control module converts z'nThe sign bit of (c) is inverted and then shifted left by one bit, and then the output value obtained by adding 1 is used as the result of the tanh function.
10. An activation function hybrid computing system based on CORDIC, characterized by: the CORDIC module is connected with the core control module through an adder; the core control module is used for task scheduling, the hyperbolic rotation mode CORDIC module is used for calculating an exponential function and expanding a calculation range, the linear vector mode CORDIC module is used for division operation, and the quotient range in the division operation result is between (0 and 1).
CN201911037143.9A 2019-10-29 2019-10-29 Activation function hybrid calculation method and system based on CORDIC Pending CN110766141A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911037143.9A CN110766141A (en) 2019-10-29 2019-10-29 Activation function hybrid calculation method and system based on CORDIC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911037143.9A CN110766141A (en) 2019-10-29 2019-10-29 Activation function hybrid calculation method and system based on CORDIC

Publications (1)

Publication Number Publication Date
CN110766141A true CN110766141A (en) 2020-02-07

Family

ID=69334824

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911037143.9A Pending CN110766141A (en) 2019-10-29 2019-10-29 Activation function hybrid calculation method and system based on CORDIC

Country Status (1)

Country Link
CN (1) CN110766141A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111680782A (en) * 2020-05-20 2020-09-18 河海大学常州校区 FPGA-based RBF neural network activation function implementation method
CN111752532A (en) * 2020-06-24 2020-10-09 上海擎昆信息科技有限公司 Method, system and device for realizing 32-bit integer division with high precision
CN112260687B (en) * 2020-09-24 2023-10-13 成都振芯科技股份有限公司 Phase-amplitude converter and conversion method thereof

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103677738A (en) * 2013-09-26 2014-03-26 中国人民解放军国防科学技术大学 Method and device for achieving low delay basic transcendental function based on mixed model CORDIC algorithmic
US20140164461A1 (en) * 2012-12-10 2014-06-12 Andreas Boehme Method and Apparatus for Iteratively Calculating a Value
CN109343826A (en) * 2018-08-14 2019-02-15 西安交通大学 A kind of reconfigurable processor arithmetic element towards deep learning
CN109643392A (en) * 2016-09-07 2019-04-16 罗伯特·博世有限公司 The method of the neuronal layers of multilayer perceptron model is calculated using simplified activation primitive
CN109739470A (en) * 2018-12-30 2019-05-10 南京大学 A kind of computing system based on 2 type hyperbolic CORDIC arbitrary characteristics functions
CN110147879A (en) * 2019-04-03 2019-08-20 中国科学院计算技术研究所 A kind of activation device and method for neural network processor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140164461A1 (en) * 2012-12-10 2014-06-12 Andreas Boehme Method and Apparatus for Iteratively Calculating a Value
CN103677738A (en) * 2013-09-26 2014-03-26 中国人民解放军国防科学技术大学 Method and device for achieving low delay basic transcendental function based on mixed model CORDIC algorithmic
CN109643392A (en) * 2016-09-07 2019-04-16 罗伯特·博世有限公司 The method of the neuronal layers of multilayer perceptron model is calculated using simplified activation primitive
CN109343826A (en) * 2018-08-14 2019-02-15 西安交通大学 A kind of reconfigurable processor arithmetic element towards deep learning
CN109739470A (en) * 2018-12-30 2019-05-10 南京大学 A kind of computing system based on 2 type hyperbolic CORDIC arbitrary characteristics functions
CN110147879A (en) * 2019-04-03 2019-08-20 中国科学院计算技术研究所 A kind of activation device and method for neural network processor

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
RAUT G ET AL.: "Efficient Low-Precision CORDIC Algorithm for Hardware Implementation of Artificial Neural Network", 《INTERNATIONAL SYMPOSIUM ON VLSI DESIGN AND TEST》 *
曹剑英: "基于Cordic算法的正切余切函数的设计及FPGA实现", 《中国优秀硕士学位论文全文数据库基础科学辑》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111680782A (en) * 2020-05-20 2020-09-18 河海大学常州校区 FPGA-based RBF neural network activation function implementation method
CN111680782B (en) * 2020-05-20 2022-09-13 河海大学常州校区 FPGA-based RBF neural network activation function implementation method
CN111752532A (en) * 2020-06-24 2020-10-09 上海擎昆信息科技有限公司 Method, system and device for realizing 32-bit integer division with high precision
CN112260687B (en) * 2020-09-24 2023-10-13 成都振芯科技股份有限公司 Phase-amplitude converter and conversion method thereof

Similar Documents

Publication Publication Date Title
Hu et al. Efficient hardware architecture of softmax layer in deep neural network
Liu et al. Design and analysis of approximate redundant binary multipliers
CN110766141A (en) Activation function hybrid calculation method and system based on CORDIC
CN112486455B (en) Hardware computing system for solving complex N times of root numbers based on CORDIC method and computing method thereof
CN109739470B (en) Computing system based on arbitrary exponential function of type 2 hyperbolic CORDIC
CN108196822A (en) A kind of method and system of double-precision floating point extracting operation
CN112051980B (en) Non-linear activation function computing device based on Newton iteration method
CN111984227A (en) Approximate calculation device and method for complex square root
CN107403466A (en) Ultra-large unstrctured grid generation method based on overall situation encryption
CN110187866B (en) Hyperbolic CORDIC-based logarithmic multiplication computing system and method
CN112734023A (en) Reconfigurable circuit applied to activation function of recurrent neural network
Chen et al. A cordic-based architecture with adjustable precision and flexible scalability to implement sigmoid and tanh functions
CN113612559B (en) Reconfigurable channel fading simulation device and fading twinning method thereof
CN104038770A (en) Discrete cosine transform (DCT) implementation method and system based on randomized computation
CN111984226B (en) Cube root solving device and solving method based on hyperbolic CORDIC
CN110825346B (en) Low logic complexity unsigned approximation multiplier
CN110879697B (en) Device for approximately calculating tanh function
CN103001605B (en) DA-RNS (distributed arithmetic-residue number system) algorithm based FIR (finite impulse response) filter realizing method
CN104102471A (en) Method for extending convergence domain of exponential CORDIC (coordinate rotation digital computer) algorithm by aid of FPGA (field programmable gate array) fixed-point technology
CN110837624A (en) Approximate calculation device for sigmoid function
Cao et al. Cordic-based softmax acceleration method of convolution neural network on FPGA
Daud et al. Hybrid modified booth encoded algorithm-carry save adder fast multiplier
CN115037340A (en) Signal detection method, signal detection device, electronic equipment and storage medium
Kumar et al. Complex multiplier: implementation using efficient algorithms for signal processing application
Dalmia et al. Novel high speed vedic multiplier proposal incorporating adder based on quaternary signed digit number system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200207