run() missing 1 required positional argument: 'fetches'

error 1:
def linear_function():
    """
    Implements a linear function: 
            Initializes W to be a random tensor of shape (4,3)
            Initializes X to be a random tensor of shape (3,1)
            Initializes b to be a random tensor of shape (4,1)
    Returns: 
    result -- runs the session for Y = WX + b 
    """
    
    np.random.seed(1)
    
    ### START CODE HERE ### (4 lines of code)
    X = tf.constant(np.random.randn(3,1),name='X')
    W = tf.constant(np.random.randn(4,3),name='W')
    b = tf.constant(np.random.randn(4,1),name='b')
    Y = tf.add(tf.matmul(W,X),b)
    ### END CODE HERE ### 
    
    # Create the session using tf.Session() and run it with sess.run(...) on the variable you want to calculate
    
    ### START CODE HERE ###
    sess = tf.Session
    result = sess.run(Y)
    ### END CODE HERE ### 
    
    # close the session 
    sess.close()

    return result
print( "result = " + str(linear_function()))

看到 sess=tf.Session 这句需要加(),这是函数,我搜到好多关于这个error的解决方法都是由于不认真造成的一点点错误,如果您遇到相同得错误建议仔细检查代码,如果是像我这样得新手还可能怀疑是不是自己软件包得问题,就丑大了!

error 2:

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

这个常见错误,需要在开头加入这两句话:

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'


你可能感兴趣的:(run() missing 1 required positional argument: 'fetches')