Python版本升级常用函数变更

1. AttributeError: module 'tensorflow' has no attribute 'batch_matmul'

batch_matmul-->matmul

eg:

#out = tf.batch_matmul(outputs, W_repeated) + b
out = tf.matmul(outputs, W_repeated) + b

2. AttributeError: module 'tensorflow' has no attribute 'pack'

pack-->stack

3. AttributeError: ‘module’ object has no attribute ‘mul’

tf.multiply-->tf.mul
4. AttributeError: ‘module’ object has no attribute ‘sub’ 
tf.subtract-->tf.sub
5. AttributeError: ‘module’ object has no attribute ‘neg’

tf.negative-->tf.neg
6. ValueError: Only call sigmoid_cross_entropy_with_logits with named arguments (labels=…, logits=…, …)
tf.nn.sigmoid_cross_entropy_with_logits(self.D2_logits_, tf.ones_like(self.D2_) * 0.9))-->

tf.nn.sigmoid_cross_entropy_with_logits(labels=tf.ones_like(self.D2_) * 0.9, logits=self.D2_logits_))
 

发布了34 篇原创文章 · 获赞 15 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/fuhanga123/article/details/89187706