Machine Learning error reporting of python

import tensorflow as tf
import numpy as np
x_data=np.float32(np.random.rand(2,100))
y_data=np.dot([0.100,0.200],x_data)+0.300
b = tf.Variable(tf.zeros([1]))
W = tf.Variable(tf.random_uniform([1, 2], -1.0, 1.0))
y=tf.matmul(W,x_data)+b

loss=tf.reduce_mean(tf.squre(y-y_data))
optimizer=tf.train.GatdientDescentOptimzer(0.5)
train=optimizer.minimize(loss)

init=tf.initialize_all_variables()

sess=tf.Session()
sess.run(init)

for step in xrange(0,201):
    sess.run(train)
    if step%20==0:
        print (step,sess.run(W),sess.run(b))
    

shenjianlin@newdev:~/tensorflow (spider) $python3 tensorflow.py
Traceback (most recent call last):
File "tensorflow.py", line 1, in < module >

import tensorflow as tf

File "/ home/shenjianlin/tensorflow/tensorflow.py", line 5, in < module >

b = tf.Variable(tf.zeros([1]))

AttributeError: "module" object has no attribute" Variable"

Dec.10,2021

you import tensorflow module, and your own file is also called tensorflow.py . This is the most common problem for beginner python students. Don't conflict with the introduced system module command when you name your file. Change your name

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7bb890-2a13c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7bb890-2a13c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?