code: def to_detach(b:Tensors, cpu:bool=True):
      "Recursively detach lists of tensors in `b `; put them on the CPU if `cpu=True`."
      if is_listy(b): return [to_detach(o, cpu) for o in b]
      if not isinstance(b,Tensor): return b
      b = b.detach()
      return b.cpu() if cpu else f to_detach(b:Tensors, cpu:bool=True):
      "Recursively detach lists of tensors in `b `; put them on the CPU if `cpu=True`."
      if is_listy(b): return [to_detach(o, cpu) for o in b]
      if not isinstance(b,Tensor): return b
      b = b.detach()
      return b.cpu() if cpu else b
docs: Recursively detach lists of tensors in `b `; put them on the CPU if `cpu=True`.