当前位置:网站首页>Gru of RNN
Gru of RNN
2022-07-01 07:43:00 【Programming bear】
LSTM Have longer memory ability , In most sequential tasks, we have achieved better results than the basic RNN Better performance of the model ,LSTM Gradient dispersion is not easy to occur . however LSTM The structure is relatively complex , It's expensive to calculate , The amount of model parameters is large .
One 、GRU principle
The study found that , The forgetting door is LSTM The most important gating in , It is even found that the network with only forgetting gate outperforms the standard on multiple benchmark data sets LSTM The Internet . In simplified version LSTM in , Gated loop network (Gated Recurrent Unit, abbreviation GRU) Is the most widely used RNN One of the variants . GRU Merge the internal state vector and the output vector , Unified as state vector , door The control quantity is also reduced to 2 individual : Reset door (Reset Gate) And update the door (Update Gate)
1. Reset door
The reset gate is used to control the status of the last timestamp
Get into GRU The amount of .

Gating vector
Entered by the current timestamp
and Last timestamp status
The result of change , Relationship :
. Gating vector
Control status only
, Without controlling the input
:
. When
= 0 when , New input
All from input
, Don't accept
, This is equivalent to resetting
. When
= 1 when ,
And the input
Together produce new output 
2. Update door
Update the last timestamp status of door control
And Xintu
For the new state vector
The degree of influence . Update gating vector
from
obtain .

be used for Control new input
The signal ,
be used for Control the last time status
The signal :
and
Yes
The number of updates is competing with each other 、 A state of ebb and flow . When updating the door
= 0 when ,
All from the last timestamp status
; When updating the door
= 1 when ,
All from new losses 
Two 、GRU Realization
1.GRUCell
GRUCell and SimpleRNNCell、LSTMCell Use the same , establish GRU Cell object , And circularly expand the operation on the time axis . It needs to maintain only one initialization state vector ( monolayer )
x = tf.random.normal([2, 80, 100])
# Initialize the state vector , GRU only one
h = [tf.zeros([2, 64])]
cell = layers.GRUCell(64) # newly build GRU Cell, The length of the vector is 64
# Untie in the timestamp dimension , Cycle through cell
for xt in tf.unstack(x, axis=1):
out, h = cell(xt, h)2.GRU
adopt layers.GRU Class can be easily passed through Sequential Containers can be stacked in multiple layers GRU Layer network , And do not maintain the initialization state vector
net = keras.Sequential([
layers.GRU(64, return_sequences=True),
layers.GRU(64)
])
out = net(x)
边栏推荐
- 2022电工(中级)复训题库及答案
- 2022 Guangdong Provincial Safety Officer a certificate third batch (main person in charge) special operation certificate examination question bank simulated examination platform operation
- 【mysql学习笔记28】存储函数
- Jax's deep learning and scientific computing
- base64
- weback5基础配置详解
- Apple account password auto fill
- redisson使用全解——redisson官方文档+注释(中篇)
- Cadence OrCAD capture "network name" is the same, but it is not connected or connected incorrectly. The usage of nodeName of liberation scheme
- Minecraft 1.16.5模组开发(五十一) 方块实体 (Tile Entity)
猜你喜欢
随机推荐
AUTOSAR learning record (1) – ECUM_ Init
Custom events of components ②
Oracle create auto increment ID
Apple account password auto fill
Illusory and simple screen raindrop post-processing effect
Reply and explanation on issues related to "online training of network security education in 2022"
Jax's deep learning and scientific computing
Huawei modelarts training alexnet model
How to make the two financial transactions faster
PWN攻防世界int_overflow
atguigu----脚手架--02-使用脚手架(2)
2022制冷与空调设备运行操作国家题库模拟考试平台操作
[MySQL learning notes 26] view
[R language] age sex frequency matching select samples for case-control study, and perform frequency matching on age and sex
C# 读写自定义的Config文件
1286_ Implementation analysis of task priority setting in FreeRTOS
三极管是一项伟大的发明
What information does the supplier need to know about Audi EDI project?
Operation and maintenance management system, humanized operation experience
How do the top ten securities firms open accounts? In addition, is it safe to open a mobile account?








