Esempio n. 1
0
    def test_encode(self, record_batch, examples_text_proto):
        expected_examples = [
            text_format.Parse(pbtxt, tf.train.Example())
            for pbtxt in examples_text_proto
        ]
        actual_examples = [
            tf.train.Example.FromString(encoded)
            for encoded in example_coder.RecordBatchToExamples(record_batch)
        ]

        self.assertEqual(actual_examples, expected_examples)
Esempio n. 2
0
 def record_batch_to_examples(data_batch):
   # Ignore unary pass-through features.
   record_batch, _ = data_batch
   return example_coder.RecordBatchToExamples(record_batch)
Esempio n. 3
0
 def test_invalid_input(self, record_batch, error, error_msg_regex):
     with self.assertRaisesRegex(error, error_msg_regex):
         example_coder.RecordBatchToExamples(record_batch)