0
   prior_boxes = torch.FloatTensor(prior_boxes).to(device)  # (8732, 4)
   prior_boxes.clamp_(0, 1)  # (8732, 4)

what dooes clamp_ do in pytorch and how to change it to the tensorflow 2.0?
I'm not sure what clamp_ do exactly?

  • Please consider accepting my answer it helps solve your question. Or let me know that the problem with my answer. – one Jun 09 '20 at 10:37
  • 2
    It is interesting, because you added the tag "clamp" and its description says "Constrains a value between a lower and upper bound". It should answer your last question. Perhaps you just need to know that the trailing "_" means that it happens in-place. – Berriel Jun 09 '20 at 12:46

1 Answers1

3

clamp_(0, 1) Clamp all elements in prior_boxes into the range [ 0, 1].

Tensorflow:

tf.clip_by_value
https://www.tensorflow.org/api_docs/python/tf/clip_by_value

one
  • 2,205
  • 1
  • 15
  • 37