tf2.0不降版本也能完美解决module ‘tensorflow’ has no attribute 'contrib’的问题

看图

tf2.0不降版本也能完美解决module ‘tensorflow’ has no attribute ‘contrib’的问题
tf2.0不降版本也能完美解决module ‘tensorflow’ has no attribute ‘contrib’的问题

tf2.0版本更改

tf2.0不降版本也能完美解决module ‘tensorflow’ has no attribute ‘contrib’的问题
tf2.0不降版本也能完美解决module ‘tensorflow’ has no attribute ‘contrib’的问题

我在学习的过程中,发现了大佬们写的项目都是在1.0版本的基础上搭建的,所以在学习他们的项目的时候遇到了非常棘手的contrib模块(2.0中被弃用),看到网上所有人的解决方法都是讲2.0版本降到1.0版本(个人不想降,所以就尝试找其他的代替),最后发现,只要将

cell = tf.contrib.rnn.BasicLSTMCel

cell = tf.compat.v1.nn.rnn_cell.BasicLSTMCell

代替就可以完美的解决出现的问题。得到的结果没啥区别。

我只是知识的搬运工,刚开始学习不久,大佬们勿喷!大家一起学习。

相关文章:

  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-07-18
  • 2021-09-07
  • 2021-05-17
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案