TypeError: ‘function‘ object is not subscriptable

阎小妍

关注

阅读 111

2022-07-14


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

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

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

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

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

更多《计算机视觉与图形学》知识,可关注下方公众号:

TypeError: ‘function‘ object is not subscriptable_Tensorflow

精彩评论(0)

0 0 举报