def testBasic(self):
        selector_dataset = dataset_ops.Dataset.range(10).repeat(100)
        input_datasets = [
            dataset_ops.Dataset.from_tensors(i).repeat(100) for i in range(10)
        ]
        dataset = interleave_ops._DirectedInterleaveDataset(
            selector_dataset, input_datasets)
        next_element = self.getNext(dataset)

        for _ in range(100):
            for i in range(10):
                self.assertEqual(i, self.evaluate(next_element()))
        with self.assertRaises(errors.OutOfRangeError):
            self.evaluate(next_element())
  def testBasic(self):
    selector_dataset = dataset_ops.Dataset.range(10).repeat(100)
    input_datasets = [
        dataset_ops.Dataset.from_tensors(i).repeat(100) for i in range(10)
    ]
    dataset = interleave_ops._DirectedInterleaveDataset(selector_dataset,
                                                        input_datasets)
    next_element = self.getNext(dataset)

    for _ in range(100):
      for i in range(10):
        self.assertEqual(i, self.evaluate(next_element()))
    with self.assertRaises(errors.OutOfRangeError):
      self.evaluate(next_element())
  def testBasic(self):
    selector_dataset = dataset_ops.Dataset.range(10).repeat(100)
    input_datasets = [
        dataset_ops.Dataset.from_tensors(i).repeat(100) for i in range(10)
    ]
    dataset = interleave_ops._DirectedInterleaveDataset(selector_dataset,
                                                        input_datasets)
    iterator = dataset.make_initializable_iterator()
    next_element = iterator.get_next()

    with self.cached_session() as sess:
      self.evaluate(iterator.initializer)
      for _ in range(100):
        for i in range(10):
          self.assertEqual(i, self.evaluate(next_element))
      with self.assertRaises(errors.OutOfRangeError):
        sess.run(next_element)
예제 #4
0
    def testBasic(self):
        selector_dataset = dataset_ops.Dataset.range(10).repeat(100)
        input_datasets = [
            dataset_ops.Dataset.from_tensors(i).repeat(100) for i in range(10)
        ]
        dataset = interleave_ops._DirectedInterleaveDataset(
            selector_dataset, input_datasets)
        iterator = dataset.make_initializable_iterator()
        next_element = iterator.get_next()

        with self.cached_session() as sess:
            self.evaluate(iterator.initializer)
            for _ in range(100):
                for i in range(10):
                    self.assertEqual(i, self.evaluate(next_element))
            with self.assertRaises(errors.OutOfRangeError):
                self.evaluate(next_element)