code: def test_with_torch_api(synthetic_dataset):
      """Verify that WeightedSamplingReader is compatible with petastorm.pytorch.DataLoader"""
      readers = [reader0, reader1]
  
      with WeightedSamplingReader(readers, [0.5, 0.5]) as mixer:
          assert not mixer.batched_output
          sample = next(mixer)
          assert sample is not None
          with DataLoader(mixer, batch_size=2) as loader:
              for batch in loader:
                  assert batch["f1"].shape[0] == 2
                  break
  
imports: from __future__ import division
  import numpy
  import pytest
  import six
  import tensorflow.compat.v1
  from petastorm import make_reader
  from petastorm.ngram import NGram
  from petastorm.predicates import in_lambda
  from petastorm.pytorch import DataLoader
  from petastorm.test_util.reader_mock import ReaderMock
  from petastorm.tf_utils import tf_tensors, make_petastorm_dataset
  from petastorm.unischema import Unischema, UnischemaField
  from petastorm.weighted_sampling_reader import WeightedSamplingReader
  from petastorm.tests.test_tf_utils import create_tf_graph
label_desc: Use image node_id 12 for calling a global function with example usage: test_with_torch_api(synthetic_dataset) without return types