我有以下TensorFlow代码:
tf.constant(tf.random_normal([time_step, batch_size], -1, 1))
Run Code Online (Sandbox Code Playgroud)
我到了TypeError: List of Tensors when single Tensor expected.你能告诉我代码有什么问题吗?
小智 13
其他人在另一个帖子/sf/answers/2496340941/上回答了这个问题
本质上,tf.constant()将NumPy数组作为参数或某种数组或仅作为值.
tf.random_normal()返回一个不能作为参数的Tensor tf.constant().
要解决此问题,请使用tf.Variable()而不是tf.constant().
请参阅链接中的答案.这个人解释得更好.
| 归档时间: |
|
| 查看次数: |
9359 次 |
| 最近记录: |