class_docstr: An universal tensor clip function
  
  Pytorch's clamp() only supports scalar range and doesn't support broadcast. This implementation uses min/max which
  is more genaral. The gradient is defined according to IBM's PACT paper https://arxiv.org/abs/1805.06085, which is
  also the behavior of Tensorflow's clip_by_value()
class_docstr_tok: ["An","universal","tensor","clip","function","Pytorch","'s","clamp","(",")","only","supports","scalar","range","and","does","n't","support","broadcast",".","This","implementation","uses","min\/max","which","is","more","genaral",".","The","gradient","is","defined","according","to","IBM","'s","PACT","paper","https",":","\/\/arxiv.org\/abs\/1805.06085",",","which","is","also","the","behavior","of","Tensorflow","'s","clip_by_value","(",")"]
code: def forward(ctx, input, clip_value_min, clip_value_max):
      output = torch.min(input, clip_value_max)
      output = torch.max(output, clip_value_min)
      ctx.save_for_backward(input, clip_value_min, clip_value_max)
      return output
  
imports: import logging
  import torch
  from torch.autograd import Function
label_desc: Use image node_id 1 for calling the ClipFunction obj's underlying member method code with example usage: obj.forward(ctx, input, clip_value_min, clip_value_max) and returns: output