Search code examples
tensorflowpytorchtensorflow2.0torch

what is the pytorch's view equivalence with tensorflow 2.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

what is the equivalence with torch's view in TensorFlow? how to change the l_conv7.view in TensorFlow 2.0?


Solution

  • Use

    l_conv7.reshape(batch_size, -1, 4)