class_docstr: Implements an abstract preprocessor object which performs casting, resizing, batching and normalization.
  
  Args:
  ----
      output_size: expected size of each page in format (H, W)
      batch_size: the size of page batches
      mean: mean value of the training distribution by channel
      std: standard deviation of the training distribution by channel
class_docstr_tok: ["Implements","an","abstract","preprocessor","object","which","performs","casting",",","resizing",",","batching","and","normalization",".","Args",":","--","--","output_size",":","expected","size","of","each","page","in","format","(","H",",","W",")","batch_size",":","the","size","of","page","batches","mean",":","mean","value","of","the","training","distribution","by","channel","std",":","standard","deviation","of","the","training","distribution","by","channel"]
docstr: Gather samples into batches for inference purposes
  
  Args:
  ----
      samples: list of samples of shape (C, H, W)
  
  Returns:
  -------
      list of batched samples (*, C, H, W)
docstr_tok: ["Gather","samples","into","batches","for","inference","purposes","Args",":","--","--","samples",":","list","of","samples","of","shape","(","C",",","H",",","W",")","Returns",":","--","--","--","-","list","of","batched","samples","(","*",",","C",",","H",",","W",")"]
code: def batch_inputs(
      self, samples: List[torch.Tensor]
  ) -> List[torch.Tensor]:
      """Gather samples into batches for inference purposes
  
      Args:
      ----
          samples: list of samples of shape (C, H, W)
  
      Returns:
      -------
          list of batched samples (*, C, H, W)
      """
      num_batches = int(math.ceil(len(samples) / self.batch_size))
      batches = [
          torch.stack(
              samples[
                  idx
                  * self.batch_size : min(
                      (idx + 1) * self.batch_size, len(samples)
                  )
              ],
              dim=0,
          )
          for idx in range(int(num_batches))
      ]
  
      return batches
  
file_path: doctr/doctr/models/preprocessor/pytorch.py
imports: import math
  from typing import Any, List, Tuple, Union
  import numpy
  import torch
  from torch import nn
  from torchvision.transforms import functional
  from torchvision.transforms import transforms
  from doctr.transforms import Resize
  from doctr.utils.multithreading import multithread_exec
label_desc: Use image node_id 2 for calling the PreProcessor obj's underlying member method code with example usage: obj.batch_inputs(samples) and returns: batches