TypeError: 'function' object is not subscriptable

在tensorflow中使用零矩阵初始化变量的时候出现的:

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

这是由于tf.zeros是一个函数,应该有括号,所以应该改为tf.zeros([1])

像这种问题TypeError: 'function' object is not subscriptable

一般都是由于函数没加括号导致的;


猜你喜欢

转载自blog.csdn.net/weixin_38859557/article/details/80878298