【问题标题】:what is the pytorch's view equivalence with tensorflow 2.0?pytorch 与 tensorflow 2.0 的视图等效性是什么?
【发布时间】:2020-09-22 21:15:46
【问题描述】:
l_conv7 = self.loc_conv7(conv7_feats)  # (N, 24, 19, 19)
l_conv7 = l_conv7.permute(0, 2, 3, 1).contiguous()  # (N, 19, 19, 24)
l_conv7 = l_conv7.view(batch_size, -1, 4)  # (N, 2166, 4), there are a total 2116 boxes on this feature map

在 TensorFlow 中与 torch 的视图等价的是什么? 如何在 TensorFlow 2.0 中更改 l_conv7.view?

【问题讨论】:

  • 您可以使用tf.reshape()。更具体地说,使用l_conv7 = tf.reshape(l_conv7, new_shape)

标签: tensorflow pytorch tensorflow2.0 torch


【解决方案1】:

使用

l_conv7.reshape(batch_size, -1, 4)

【讨论】:

    猜你喜欢
    • 2020-08-12
    • 1970-01-01
    • 2019-12-02
    • 2020-12-28
    • 1970-01-01
    • 2020-03-28
    • 2019-11-11
    • 1970-01-01
    • 2022-06-22
    相关资源
    最近更新 更多