Module 'Tensorflow' Has No Attribute 'Variable' in Google Colaboratory
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...
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'
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_1
Click here, for more details