module 'tensorflow' has no attribute 'variable' in google Colaboratory
Emily Wong
I'm trying to create a variable tensor in google Collaboratory with this code, but error because TensorFlow doesn't have a module about variables. what's the solution?
import tensorflow as tf
var_1 = tf.variable(tf.ones([2,3]))Error:
AttributeError Traceback (most recent call last) <ipython-input-2-2666f49bf801> in <module>() ----> 1 var_1 = tf.variable(tf.ones([2,3]))
AttributeError: module 'tensorflow' has no attribute 'variable' 2 1 Answer
There is a typo error. Use capital letter V for Variable.
You can refer below code for the same.
import tensorflow as tf
var_1 = tf.Variable(tf.ones([2,3]))
var_1Click here, for more details