Exemplo n.º 1
0
    def __init__(
        self,
        datapipe: IterDataPipe,
        filter_fn: Callable,
        drop_empty_batches: Optional[bool] = None,
        input_col=None,
    ) -> None:
        super().__init__()
        self.datapipe = datapipe

        _check_lambda_fn(filter_fn)
        self.filter_fn = filter_fn  # type: ignore[assignment]

        if drop_empty_batches is None:
            drop_empty_batches = True
        else:
            _deprecation_warning(
                type(self).__name__,
                deprecation_version="1.12",
                removal_version="1.14",
                old_argument_name="drop_empty_batches",
            )
        self.drop_empty_batches = drop_empty_batches

        self.input_col = input_col
Exemplo n.º 2
0
 def __getattr__(self, attribute_name):
     if attribute_name in MapDataPipe.functions:
         if attribute_name in _map_deprecated_functional_names:
             kwargs = _map_deprecated_functional_names[attribute_name]
             _deprecation_warning(**kwargs)
         function = functools.partial(MapDataPipe.functions[attribute_name], self)
         return function
     else:
         raise AttributeError("'{0}' object has no attribute '{1}".format(self.__class__.__name__, attribute_name))
Exemplo n.º 3
0
 def __new__(
         cls,
         datapipe: Iterable[str],
         mode: str = 'b',
         length: int = -1):
     _deprecation_warning(
         cls.__name__,
         deprecation_version="1.12",
         removal_version="1.13",
         new_class_name="FileOpener",
     )
     return FileOpenerIterDataPipe(datapipe=datapipe, mode=mode, length=length)
Exemplo n.º 4
0
 def __init__(self,
              datapipe: Iterable[Tuple[str, BufferedIOBase]],
              *handlers: Callable,
              key_fn: Callable = extension_extract_fn) -> None:
     super().__init__()
     self.datapipe: Iterable[Tuple[str, BufferedIOBase]] = datapipe
     if not handlers:
         handlers = (decoder_basichandlers, decoder_imagehandler('torch'))
     self.decoder = Decoder(*handlers, key_fn=key_fn)
     _deprecation_warning(
         type(self).__name__,
         deprecation_version="1.12",
         removal_version="1.13",
         old_functional_name="routed_decode",
     )