code: def clamp(input, min=None, max=None):
      ndim = input.ndimension()
      if min is None:
          pass
      elif isinstance(min, (float, int)):
          input = torch.clamp(input, min=min)
      elif isinstance(min, torch.Tensor):
          if (
              min.ndimension() == ndim - 1
              and min.shape == input.shape[1:]
          ):
              input = torch.max(input, min.view(1, *min.shape))
          else:
              assert min.shape == input.shape
              input = torch.max(input, min)
      else:
          raise ValueError(
              "min can only be None | float | torch.Tensor"
          )
  
      if max is None:
          pass
      elif isinstance(max, (float, int)):
          input = torch.clamp(input, max=max)
      elif isinstance(max, torch.Tensor):
          if (
              max.ndimension() == ndim - 1
              and max.shape == input.shape[1:]
          ):
              input = torch.min(input, max.view(1, *max.shape))
          else:
              assert max.shape == input.shape
              input = torch.min(input, max)
      else:
          raise ValueError(
              "max can only be None | float | torch.Tensor"
          )
      return input
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 10 for calling a global function with example usage: clamp(input, min, max) and returns: input