【问题标题】:Is tf.contrib.layers.flatten(x) the same as tf.reshape(x, [n, 1])?tf.contrib.layers.flatten(x) 和 tf.reshape(x, [n, 1]) 一样吗?
【发布时间】:2017-10-24 21:26:47
【问题描述】:

我只是想知道tf.contrib.layers.flatten(x) 是否与tf.reshape(x, [n, 1]) 相同?有人对此有想法吗?

【问题讨论】:

  • Flatten 折叠除批量大小之外的所有维度。 [bs, n, m, k] -> [bs, n*m*k]

标签: tensorflow


【解决方案1】:

tf.layers.flatten()implementation 揭示了答案。相当于如下:

flattened = tf.reshape(x, [tf.shape(x)[0], -1])

【讨论】:

    猜你喜欢
    • 2018-08-30
    • 2018-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 1970-01-01
    • 2020-10-07
    • 2020-11-18
    相关资源
    最近更新 更多