code: def trim_zeros(
      a: torch.Tensor, /, *, trim: Optional[str] = "bf"
  ) -> torch.Tensor:
      first = 0
      trim = trim.upper()
      if "F" in trim:
          for i in a:
              if i != 0.0:
                  break
              else:
                  first = first + 1
      last = len(a)
      if "B" in trim:
          for i in torch.flip(a, [0]):
              if i != 0.0:
                  break
              else:
                  last = last - 1
      return a[first:last]
  
imports: from typing import Iterable, Optional, Union, Sequence, Tuple, NamedTuple, List, Literal, Callable, Any
  from numbers import Number
  from collections import namedtuple
  import torch
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from ..None import backend_version
  import ivy
  from ivy.functional.ivy.experimental.manipulation import _to_tf_padding, _check_paddle_pad, _to_paddle_padding
label_desc: Use image node_id 29 for calling a global function with example usage: trim_zeros() and returns: a