class_docstr: The :class:`~poutyne.ModelBundle` class provides a straightforward experimentation tool for efficient and entirely
  customizable finetuning of the whole neural network training procedure with PyTorch. The
  :class:`~poutyne.ModelBundle` object takes care of the training and testing processes while also managing to keep
  traces of all pertinent information via the automatic logging option.
  
  Use ``ModelBundle.from_*`` methods to instanciate a :class:`~poutyne.ModelBundle`.
class_docstr_tok: ["The",":","class",":","`","~poutyne.ModelBundle","`","class","provides","a","straightforward","experimentation","tool","for","efficient","and","entirely","customizable","finetuning","of","the","whole","neural","network","training","procedure","with","PyTorch",".","The",":","class",":","`","~poutyne.ModelBundle","`","object","takes","care","of","the","training","and","testing","processes","while","also","managing","to","keep","traces","of","all","pertinent","information","via","the","automatic","logging","option",".","Use","``","ModelBundle.from_","*","``","methods","to","instanciate","a",":","class",":","`","~poutyne.ModelBundle","`","."]
docstr: Computes and returns the loss and the metrics of the model on a given test dataset.
  
  If the ModelBundle has logging enabled (i.e. self.logging is True), a checkpoint (the best one by default)
  is loaded and test and validation statistics are saved in a specific test output .tsv file. Otherwise, the
  current weights of the network is used for testing and statistics are only shown in the standard output.
  
  Args:
      test_dataset (~torch.utils.data.Dataset): Test dataset.
      checkpoint (Union[str, int]): Which model checkpoint weights to load for the test evaluation.
  
          - If 'best', will load the best weights according to ``monitor_metric`` and ``monitor_mode``.
          - If 'last', will load the last model checkpoint.
          - If int, will load the checkpoint of the specified epoch.
          - If a path (str), will load the model pickled state_dict weights (for instance, saved as
            ``torch.save(a_pytorch_network.state_dict(), "./a_path.p")``).
  
          This argument has no effect when logging is disabled. (Default value = 'best')
      seed (int, optional): Seed used to make the sampling deterministic.
          (Default value = 42)
      name (str): Prefix of the test log file. (Default value = 'test')
      kwargs: Any keyword arguments to pass to :func:`~Model.evaluate_dataset()`.
  
  If the ModelBundle has logging enabled (i.e. self.logging is True), one callback will be automatically
  included to save the test metrics. Moreover, a :class:`~poutyne.AtomicCSVLogger` will save the test
  metrics in an output .tsv file.
  
  Returns:
      dict sorting of all the test metrics values by their names.
docstr_tok: ["Computes","and","returns","the","loss","and","the","metrics","of","the","model","on","a","given","test","dataset",".","If","the","ModelBundle","has","logging","enabled","(","i.e",".","self.logging","is","True",")",",","a","checkpoint","(","the","best","one","by","default",")","is","loaded","and","test","and","validation","statistics","are","saved","in","a","specific","test","output",".tsv","file",".","Otherwise",",","the","current","weights","of","the","network","is","used","for","testing","and","statistics","are","only","shown","in","the","standard","output",".","Args",":","test_dataset","(","~torch.utils.data.Dataset",")",":","Test","dataset",".","checkpoint","(","Union","[","str",",","int","]",")",":","Which","model","checkpoint","weights","to","load","for","the","test","evaluation",".","-","If","'best","'",",","will","load","the","best","weights","according","to","``","monitor_metric","``","and","``","monitor_mode","``",".","-","If","'last","'",",","will","load","the","last","model","checkpoint",".","-","If","int",",","will","load","the","checkpoint","of","the","specified","epoch",".","-","If","a","path","(","str",")",",","will","load","the","model","pickled","state_dict","weights","(","for","instance",",","saved","as","``","torch.save","(","a_pytorch_network.state_dict","(",")",",","``",".\/a_path.p","''",")","``",")",".","This","argument","has","no","effect","when","logging","is","disabled",".","(","Default","value","=","'best","'",")","seed","(","int",",","optional",")",":","Seed","used","to","make","the","sampling","deterministic",".","(","Default","value","=","42",")","name","(","str",")",":","Prefix","of","the","test","log","file",".","(","Default","value","=","'test","'",")","kwargs",":","Any","keyword","arguments","to","pass","to",":","func",":","`","~Model.evaluate_dataset","(",")","`",".","If","the","ModelBundle","has","logging","enabled","(","i.e",".","self.logging","is","True",")",",","one","callback","will","be","automatically","included","to","save","the","test","metrics",".","Moreover",",","a",":","class",":","`","~poutyne.AtomicCSVLogger","`","will","save","the","test","metrics","in","an","output",".tsv","file",".","Returns",":","dict","sorting","of","all","the","test","metrics","values","by","their","names","."]
code: def test_dataset(self, test_dataset, **kwargs) -> Dict:
      """
      Computes and returns the loss and the metrics of the model on a given test dataset.
  
      If the ModelBundle has logging enabled (i.e. self.logging is True), a checkpoint (the best one by default)
      is loaded and test and validation statistics are saved in a specific test output .tsv file. Otherwise, the
      current weights of the network is used for testing and statistics are only shown in the standard output.
  
      Args:
          test_dataset (~torch.utils.data.Dataset): Test dataset.
          checkpoint (Union[str, int]): Which model checkpoint weights to load for the test evaluation.
  
              - If 'best', will load the best weights according to ``monitor_metric`` and ``monitor_mode``.
              - If 'last', will load the last model checkpoint.
              - If int, will load the checkpoint of the specified epoch.
              - If a path (str), will load the model pickled state_dict weights (for instance, saved as
                ``torch.save(a_pytorch_network.state_dict(), "./a_path.p")``).
  
              This argument has no effect when logging is disabled. (Default value = 'best')
          seed (int, optional): Seed used to make the sampling deterministic.
              (Default value = 42)
          name (str): Prefix of the test log file. (Default value = 'test')
          kwargs: Any keyword arguments to pass to :func:`~Model.evaluate_dataset()`.
  
      If the ModelBundle has logging enabled (i.e. self.logging is True), one callback will be automatically
      included to save the test metrics. Moreover, a :class:`~poutyne.AtomicCSVLogger` will save the test
      metrics in an output .tsv file.
  
      Returns:
          dict sorting of all the test metrics values by their names.
      """
      return self._test(
          self.model.evaluate_dataset, test_dataset, **kwargs
      )
  
imports: import os
  import warnings
  from typing import Any, Callable, Dict, List, Tuple, Union
  import torch
  from poutyne.framework.callbacks import AtomicCSVLogger, BestModelRestore, LRSchedulerCheckpoint, ModelCheckpoint, OptimizerCheckpoint, PeriodicSaveLambda, RandomStatesCheckpoint, TensorBoardLogger
  from poutyne.framework.model import Model
  from poutyne.plotting import plot_history
  from poutyne.utils import load_random_states, set_seeds
label_desc: Use image node_id 30 for calling the ModelBundle obj's underlying member method code with example usage: obj.test_dataset(test_dataset) and returns: self