code: def _td_array_cmp(cls, op):
      
      opname = '__{name}__'.format(name=op.__name__)
      nat_result = opname == '__ne__'
  
      def wrapper(self, other):
          if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)):
              return NotImplemented
  
          if _is_convertible_to_td(other) or other is NaT:
              try:
                  other = Timedelta(other)
              except ValueError:
                  # failed to parse as timedelta
                  return ops.invalid_comparison(self, other, op)
  
              result = op(self.view('i8'), other.value)
              if isna(other):
                  result.fill(nat_result)
  
          elif not is_list_like(other):
              return ops.invalid_comparison(self, other, op)
  
          elif len(other) != len(self):
              raise ValueError("Lengths must match")
  
          else:
              try:
                  other = type(self)._from_sequence(other)._data
              except (ValueError, TypeError):
                  return ops.invalid_comparison(self, other, op)
  
              result = op(self.view('i8'), other.view('i8'))
              result = com.values_from_object(result)
  
              o_mask = np.array(isna(other))
              if o_mask.any():
                  result[o_mask] = nat_result
  
          if self._hasnans:
              result[self._isnan] = nat_result
  
          return result
  
      return compat.set_function_name(wrapper, opname, cls)
docs: Wrap comparison operations to convert timedelta-like to timedelta64