尝试用张量流建立线性回归模型。现在,我要为权重和偏差创建变量:
w = tf.get_variable('weights', shape = None, initializer = None)
b = tf.get_variable('bias', shape = None, initializer = None)
在斯坦福大学的CS20si课程中,我读到“如果 使用常量初始化”。但这部分代码引发了:
ValueError: Shape of a new variable (weights) must be fully defined, but instead was <unknown>.
这是否意味着我应该为这些变量设置形状?我想我松了点东西。有什么建议吗?在
您应该设置形状以初始化这些变量。以logistic回归为例。在
如果像下面这样使用常量初始化,则不需要设置形状。在
^{pr2}$相关问题 更多 >
编程相关推荐