Equivalence of some tensorflow functions in pytorch

Hello everyone
I would like to ask how can I implement the following Tensorflow functions in Pytorch

  1. tf.greater_equal(iou, T)
  2. tf.less(iou, T)
  3. sum_FP = tf.reduce_sum(FP)
  4. imgs = tf.expand_dims(imgs_ph, 3) #### [batch_size, 480, 640, 1]

Thanks for your help!
Warm regards

1 Like

Try the following:

  1. iou >= T
  2. iou < T
  3. sum_FP = FP.sum()
  4. imgs = torch.expand(imgs_ph, 3)

Let me know if any of those don’t do what you’re trying to do

2 Likes

The last one should be imgs = imgs.unsqueeze(3)

7 Likes