class_docstr: Constructs a Fuyu processor which wraps a Fuyu image processor and a Llama tokenizer into a single processor.
  
  [`FuyuProcessor`] offers all the functionalities of [`FuyuImageProcessor`] and [`LlamaTokenizerFast`]. See the
  [`~FuyuProcessor.__call__`] and [`~FuyuProcessor.decode`] for more information.
  
  Args:
      image_processor ([`FuyuImageProcessor`]):
          The image processor is a required input.
      tokenizer ([`LlamaTokenizerFast`]):
          The tokenizer is a required input.
class_docstr_tok: ["Constructs","a","Fuyu","processor","which","wraps","a","Fuyu","image","processor","and","a","Llama","tokenizer","into","a","single","processor",".","[","`","FuyuProcessor","`","]","offers","all","the","functionalities","of","[","`","FuyuImageProcessor","`","]","and","[","`","LlamaTokenizerFast","`","]",".","See","the","[","`","~FuyuProcessor.__call__","`","]","and","[","`","~FuyuProcessor.decode","`","]","for","more","information",".","Args",":","image_processor","(","[","`","FuyuImageProcessor","`","]",")",":","The","image","processor","is","a","required","input",".","tokenizer","(","[","`","LlamaTokenizerFast","`","]",")",":","The","tokenizer","is","a","required","input","."]
code: def get_sample_encoding(
      self,
      prompts,
      scale_factors,
      image_unpadded_heights,
      image_unpadded_widths,
      image_placeholder_id,
      image_newline_id,
      tensor_batch_images,
  ):
      image_present = torch.ones(1, 1, 1)
      model_image_input = (
          self.image_processor.preprocess_with_tokenizer_info(
              image_input=tensor_batch_images,
              image_present=image_present,
              image_unpadded_h=image_unpadded_heights,
              image_unpadded_w=image_unpadded_widths,
              image_placeholder_id=image_placeholder_id,
              image_newline_id=image_newline_id,
              variable_sized=True,
          )
      )
      # FIXME max_tokens_to_generate is embedded into this processor's call.
      (
          prompt_tokens,
          prompts_length,
      ) = _tokenize_prompts_with_image_and_batch(
          tokenizer=self.tokenizer,
          prompts=prompts,
          scale_factors=scale_factors,
          max_tokens_to_generate=self.max_tokens_to_generate,
          max_position_embeddings=self.max_position_embeddings,
          add_BOS=True,
          add_beginning_of_answer_token=True,
      )
      image_padded_unpacked_tokens = construct_full_unpacked_stream(
          num_real_text_tokens=prompts_length,
          input_stream=prompt_tokens,
          image_tokens=model_image_input["image_input_ids"],
          batch_size=1,
          num_sub_sequences=self.subsequence_length,
      )
      # Construct inputs for image patch indices.
      unpacked_image_patch_indices_per_batch = (
          construct_full_unpacked_stream(
              num_real_text_tokens=prompts_length,
              input_stream=torch.full_like(prompt_tokens, -1),
              image_tokens=model_image_input[
                  "image_patch_indices_per_batch"
              ],
              batch_size=1,
              num_sub_sequences=self.subsequence_length,
          )
      )
      max_prompt_length = max(
          x.shape[-1] for x in image_padded_unpacked_tokens
      )
      max_seq_len_batch = min(
          max_prompt_length + self.max_tokens_to_generate,
          self.max_position_embeddings,
      )
      tokens_to_place = min(
          max_seq_len_batch,
          max(0, image_padded_unpacked_tokens[0].shape[0]),
      )
  
      # Use same packing logic for the image patch indices.
      image_patch_input_indices = full_unpacked_stream_to_tensor(
          all_bi_tokens_to_place=[tokens_to_place],
          full_unpacked_stream=unpacked_image_patch_indices_per_batch,
          fill_value=-1,
          batch_size=1,
          new_seq_len=max_seq_len_batch,
          offset=0,
      )
      image_patches_tensor = torch.stack(
          [img[0] for img in model_image_input["image_patches"]]
      )
      batch_encoding = {
          "input_ids": image_padded_unpacked_tokens[0].unsqueeze(0),
          "image_patches": image_patches_tensor,
          "image_patches_indices": image_patch_input_indices,
      }
      return batch_encoding
  
imports: import re
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  from ...processing_utils import ProcessorMixin
  from ...tokenization_utils_base import PaddingStrategy, TruncationStrategy
  from ...utils import TensorType, is_torch_available, logging, requires_backends
label_desc: Use image node_id 3 for calling the FuyuProcessor obj's underlying member method code with example usage: obj.get_sample_encoding(prompts, scale_factors, image_unpadded_heights, image_unpadded_widths, image_placeholder_id, image_newline_id, tensor_batch_images) and returns: batch_encoding