小编Dan*_*Dan的帖子

tensorflow:AttributeError:'module'对象没有属性'mul'

我已经使用了tensorflow一天,但是有一些麻烦,当我导入tensorflow时,会出现AttributeError:'module'对象没有属性'XXXXXX'

环境

我使用ubuntu14.04,python2.7,CUDA工具包8.0和CuDNN v5.我的六个和protobuf的版本是:名称:六个版本:1.10.0位置:/usr/local/lib/python2.7/dist-packages需要:名称:protobuf版本:3.2.0位置:/ usr/local/lib/python2.7/dist-packages需要:six,setuptools

这是我的测试代码:

import tensorflow as tf
a = tf.placeholder(tf.int16)
b = tf.placeholder(tf.int16)
add = tf.add(a, b)
mul = tf.mul(a, b)
with tf.Session() as sess:
    # Run every operation with variable input
    print "Addition with variables: %i" % sess.run(add, feed_dict={a: 2, b: 3})
    print "Multiplication with variables: %i" % sess.run(mul, feed_dict={a: 2, b: 3})
Run Code Online (Sandbox Code Playgroud)

我得到这个输出:

在此输入图像描述

tensorflow安装有问题吗?还是其他任何问题?

python tensorflow

68
推荐指数
1
解决办法
6万
查看次数

标签 统计

python ×1

tensorflow ×1