class_docstr: Default Petastorm-based DataModule for KerasEstimator.
class_docstr_tok: ["Default","Petastorm-based","DataModule","for","KerasEstimator","."]
code: def val_data(self):
      from petastorm.pytorch import (
          BatchedDataLoader,
          InMemBatchedDataLoader,
      )
  
      if self.inmemory_cache_all:
          val_loader = InMemBatchedDataLoader(
              self.val_reader,
              batch_size=self.val_batch_size,
              num_epochs=self.num_train_epochs,
              rows_capacity=self.steps_per_epoch_val
              * self.val_batch_size,
              shuffle=False,
          )
      else:
          val_loader = BatchedDataLoader(
              self.val_reader,
              batch_size=self.val_batch_size,
              shuffling_queue_capacity=0,
          )
      return val_loader
  
imports: import contextlib
  import glob
  import horovod.torch
  import os
  from horovod.spark.common import constants
  from horovod.spark.common.datamodule import DataModule
label_desc: Use image node_id 6 for calling the PetastormDataModule obj's underlying member method code with example usage: obj.val_data() and returns: val_loader