当前位置:   article > 正文

关于tensorflow中报错NotImplementedError的解决_set_input_embeddings notimplementederror

set_input_embeddings notimplementederror

跟着tensorflow入门与实践学习,程序如下:

  1. import tensorflow as tf
  2. tf.compat.v1.disable_eager_execution() #此为V1与V2版本兼容增加,原程序没有这部分
  3. weight1 = tf.compat.v1.Variable(0.001)
  4. weight2 = tf.compat.v1.Variable(weight1.initial_value * 2) #weight2 = tf.Variable(weight1.initialized_value() * 2)报错NotImplementedError
  5. init = tf.compat.v1.global_variables_initializer()
  6. with tf.compat.v1.Session() as sess:
  7. sess.run(init)
  8. print("weight1 is:")
  9. print(sess.run(weight1))
  10. print("weight2 is:")
  11. print(sess.run(weight2))

需把原程序中的weight1.initialized_value()改为initial_value,就不会再报错了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/57727
推荐阅读
相关标签
  

闽ICP备14008679号