TF2.0中 LSTM与LSTMCell的区别

The base LSTMCell class implements the main functionality required, such as the build method, whereas the LSTM class only container an entry point: the call method, as well as a bunch of getters to retrieve attribute values. LSTMCell is the base class, which is used as a cell that is used inside the LSTM class.

as normal we used to use the standard LSTM class in your model as a normal layer. If you have a GPU at your disposal, you might want to use the version of the layer that is optimised with CUDA for execution on a GPU. As per the documentation:

Note that this cell is not optimized for performance on GPU. Please use tf.keras.layers.CuDNNLSTM for better performance on GPU.

There is also a GRU layer as well as a CuDNNGRU layer.

If you want to tweak how things work under the hood, you might create a class and inherit from the LSTMCell, or even the base class:

But you would have to implement many things for yourself.

来自于
https://datascience.stackexchange.com/questions/54549/in-tensorflow-2-0-what-is-the-different-between-lstm-and-lstmcell-objects

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值