code: def hardtanh(
      x: torch.Tensor,
      /,
      *,
      max_val: float = 1.0,
      min_val: float = -1.0,
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      ret = torch.nn.functional.hardtanh(
          x, max_val=max_val, min_val=min_val
      )
      if ivy.exists(out):
          return ivy.inplace_update(out, ret).astype(x.dtype)
      return ivy.astype(ret, x.dtype)
  
file_path: ivy/ivy/functional/backends/torch/experimental/activations.py
imports: from typing import Optional, Union, Literal
  import torch
  import torch.nn
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 9 for calling a global function with example usage: hardtanh() and returns: ivy, ivy