TypeError: 'function' object is not subscriptable in tensorflow

Viewed 6439

There are some errors using tensorflow.Varaible:

import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.placeholder(tf.float32,[None, 784])
W = tf.Variable(tf.zeros[784,10])
b = tf.Variable(tf.zeros[10])

but it shows error:

TypeError:Traceback (most recent call last)
<ipython-input-8-3086abe5ee8f> in <module>()
----> 1 W = tf.Variable(tf.zeros[784,10])
  2 b = tf.Variable(tf.zeros[10])

TypeError: 'function' object is not subscriptable

I don't know where is wrong, can someone help me?(The version of tensorflow is 0.12.0)

2 Answers
W=tf.Variable(tf.zeros([784,10]))
b=tf.Variable(tf.zeros([10]))
Related