pytorch 与 tensorflow 2.0 的视图等价是什么?

2 torch tensorflow pytorch tensorflow2.0

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
Run Code Online (Sandbox Code Playgroud)

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

Jam*_*mie 5

l_conv7.reshape(batch_size, -1, 4)
Run Code Online (Sandbox Code Playgroud)