if isinstance(value, PIL.Image.Image):
                value = np.asarray(value)
        if config.DECORD_AVAILABLE and "decord" in sys.modules:
            # We need to import torch first, otherwise later it can cause issues
            # e.g. "RuntimeError: random_device could not be read"
            # when running `torch.tensor(value).share_memory_()`
            if config.TORCH_AVAILABLE:
                import torch  # noqa
            from decord import VideoReader
            from decord.bridge import to_tensorflow

            if isinstance(value, VideoReader):
                value._hf_bridge_out = to_tensorflow
                return value

        return tf.convert_to_tensor(value, **{**default_dtype, **self.tf_tensor_kwargs})

    def _recursive_tensorize(self, data_struct):
        import tensorflow as tf

        # support for torch, tf, jax etc.
        if config.TORCH_AVAILABLE and "torch" in sys.modules:
            import torch