现象:AttributeError: ‘module’ object has no attribute ‘LinearOperatorTriL’
原因:Tensorflow 版本问题
解决方法:
把 tril = tf.contrib.linalg.LinearOperatorTriL(diag_vals).to_dense() # (T_q, T_k)
换成 tril = tf.linalg.LinearOperatorLowerTriangular(diag_vals).to_dense() # (T_q, T_k)
参考: https://github.com/Kyubyong/transformer/issues/30
本文解决了一个常见的TensorFlow错误:AttributeError: ‘module’ object has no attribute ‘LinearOperatorTriL’。此错误通常由TensorFlow版本不兼容引起。文章提供了一个简单的替换方案,将tf.contrib.linalg.LinearOperatorTriL替换为tf.linalg.LinearOperatorLowerTriangular,以解决此问题。
3万+

被折叠的 条评论
为什么被折叠?



